| View previous topic :: View next topic |
| Author |
Message |
dackjaniels
Joined: 24 Feb 2009 Posts: 151
|
Posted: Mon Mar 09, 2009 10:39 am Post subject: Problem with custom HeikenAshi indicator |
|
|
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]
| Description: |
|
 Download |
| Filename: |
CUSTOMHASData.rar |
| Filesize: |
1.5 KB |
| Downloaded: |
582 Time(s) |
Last edited by dackjaniels on Mon Mar 09, 2009 1:50 pm; edited 1 time in total |
|
| Back to top |
|
 |
dackjaniels
Joined: 24 Feb 2009 Posts: 151
|
Posted: Mon Mar 09, 2009 11:21 am Post subject: |
|
|
UPDATE:
Since re-ordering the buffers for the HA as follows:
Buffer1 - OPEN
Buffer2 - HIGH
Buffer3 - LOW
Buffer4 - CLOSE
I have achieved the correct HA candle shape as shown below.
How do I correct the colour?
Regards,
Steve
|
|
| Back to top |
|
 |
dackjaniels
Joined: 24 Feb 2009 Posts: 151
|
Posted: Mon Mar 09, 2009 1:57 pm Post subject: |
|
|
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
| Description: |
|
 Download |
| Filename: |
CUSTOMHASData.rar |
| Filesize: |
1.67 KB |
| Downloaded: |
537 Time(s) |
|
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Mon Mar 09, 2009 2:19 pm Post subject: |
|
|
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.
_________________ Hasta la vista
Mike |
|
| Back to top |
|
 |
dackjaniels
Joined: 24 Feb 2009 Posts: 151
|
Posted: Mon Mar 09, 2009 2:53 pm Post subject: |
|
|
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.
|
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|