PLEASE SEE REPLY BELOW FOR UPDATED CODE ATTACHMENT, THANKS!
Hi,
I am converting a few MT4 indicators using Turbo Delphi and FT V 1.12.
One of these is the Heiken Ashi Smoothed indicator. Having successfully coded the indicator values correctly I am having trouble with the HA onscreen painting.
Specifically, it uses four buffers, and despite setting all colour and width values in code whenever I attach the indicator to a chart the colour and width values for the first buffer always changes. This messes up the look of the HA on screen. The pic below should be clearer than my description of the problem. Right hand side shows correctly painted indicator in MT4, left is Forex Tester (.dpr file attached).
Incidentally, I have tried both ColoredCandles and HistogramFill options with the same result.
I always delete the .opt file when trying a new build of the indicator in FT.
Also, when I try this indicator in FT 2 Beta it crashes the app as soon as I add it to a chart. Any idea why? Do FT2 indicators need to be compiled with a newer version of TechnicalFunctions.pas?
This crash also leaves multiple .idx files in the indicator directory for each indicator in there (although none of these were added to the charts in FT2), over 160 .idx files altogether! EDIT: Ignore this paragraph, just realised files are always created and simply are not deleted if the program crashes and can't 'clean up' after itself.
I would appreciate any advice Mike or anyone else can offer.
Thanks,
Steve
[/img]
Problem with custom HeikenAshi indicator
-
- Posts: 151
- Joined: Tue Feb 24, 2009 1:03 pm
Problem with custom HeikenAshi indicator
- Attachments
-
- CUSTOMHASData.rar
- (1.5 KiB) Downloaded 808 times
Last edited by dackjaniels on Mon Mar 09, 2009 8:50 am, edited 1 time in total.
-
- Posts: 151
- Joined: Tue Feb 24, 2009 1:03 pm
-
- Posts: 151
- Joined: Tue Feb 24, 2009 1:03 pm
Hi again,
I have attached a new version of my code. I've cleaned it up a little and made a few comments to help anyone who wishes to examine it.
I also fixed a problem relating to updating the 'Previous' value for the SSMA calculation only once the candle has closed.
My only issue now is that the HA candles are incorrect in colour. The red HA candles are always defaulting back to blue and red regardless of what settings I make manually or in code.
Once I find the problem I will be sure to post the finished indicator in case it may be useful to someone else.
Regards,
Steve
I have attached a new version of my code. I've cleaned it up a little and made a few comments to help anyone who wishes to examine it.
I also fixed a problem relating to updating the 'Previous' value for the SSMA calculation only once the candle has closed.
My only issue now is that the HA candles are incorrect in colour. The red HA candles are always defaulting back to blue and red regardless of what settings I make manually or in code.
Once I find the problem I will be sure to post the finished indicator in case it may be useful to someone else.
Regards,
Steve
- Attachments
-
- CUSTOMHASData.rar
- (1.67 KiB) Downloaded 778 times
- Terranin
- Site Admin
- Posts: 833
- Joined: Sat Oct 21, 2006 4:39 pm
If you see Heiken Ashi source code you will see how buffers are initialized:
IndicatorBuffers(4);
SetIndexBuffer(0, buff1);
SetIndexStyle(0, ds_None, psSolid, 1, clRed);
SetIndexLabel(0, 'Up bar color');
SetIndexBuffer(1, buff2);
SetIndexStyle(1, ds_None, psSolid, 1, clRed);
SetIndexLabel(1, 'Up bar fill color');
SetIndexBuffer(2, buff3);
SetIndexStyle(2, ds_None, psSolid, 1, clBlue);
SetIndexLabel(2, 'Down bar color');
SetIndexBuffer(3, buff4);
SetIndexStyle(3, ds_ColoredCandles, psSolid, 1, clBlue);
SetIndexLabel(3, 'Down bar fill color');
use the same color scheme. Also, original indicator works fine in version 2 without recompiling. 3 buffers has style None, one last buffer has style ds_ColoredCandles.
IndicatorBuffers(4);
SetIndexBuffer(0, buff1);
SetIndexStyle(0, ds_None, psSolid, 1, clRed);
SetIndexLabel(0, 'Up bar color');
SetIndexBuffer(1, buff2);
SetIndexStyle(1, ds_None, psSolid, 1, clRed);
SetIndexLabel(1, 'Up bar fill color');
SetIndexBuffer(2, buff3);
SetIndexStyle(2, ds_None, psSolid, 1, clBlue);
SetIndexLabel(2, 'Down bar color');
SetIndexBuffer(3, buff4);
SetIndexStyle(3, ds_ColoredCandles, psSolid, 1, clBlue);
SetIndexLabel(3, 'Down bar fill color');
use the same color scheme. Also, original indicator works fine in version 2 without recompiling. 3 buffers has style None, one last buffer has style ds_ColoredCandles.
Hasta la vista
Mike
Mike
-
- Posts: 151
- Joined: Tue Feb 24, 2009 1:03 pm
Hi Mike,
Problem solved, thankyou very much for the info. I couldn't find the HA source code in the indicator source files so have been struggling on without. Is this code available for download?
Thanks,
Steve
P.S. Congrats on getting FT2 retail version released. I can tell you have put a lot of effort into this software and supporting it, you should be proud of your results. Hats off to you sir.
Problem solved, thankyou very much for the info. I couldn't find the HA source code in the indicator source files so have been struggling on without. Is this code available for download?
Thanks,
Steve
P.S. Congrats on getting FT2 retail version released. I can tell you have put a lot of effort into this software and supporting it, you should be proud of your results. Hats off to you sir.
- Terranin
- Site Admin
- Posts: 833
- Joined: Sat Oct 21, 2006 4:39 pm
dackjaniels wrote:Hi Mike,
Problem solved, thankyou very much for the info. I couldn't find the HA source code in the indicator source files so have been struggling on without. Is this code available for download?
Thanks,
Steve
P.S. Congrats on getting FT2 retail version released. I can tell you have put a lot of effort into this software and supporting it, you should be proud of your results. Hats off to you sir.
Thanks
- Attachments
-
- HeikenAshi.zip
- (795 Bytes) Downloaded 898 times
Hasta la vista
Mike
Mike
Who is online
Users browsing this forum: No registered users and 13 guests