| View previous topic :: View next topic |
| Author |
Message |
dackjaniels
Joined: 24 Feb 2009 Posts: 151
|
Posted: Tue Feb 24, 2009 6:20 pm Post subject: Converting indicators from MT4 to FT format (Delphi) |
|
|
Hi,
I am new to ForexTester (which appears to be an excellent product) and have a few questions regarding indicator conversion from MT4 format.
1. In MT4, as I understand it the IndicatorCounted() function returns the number of bars already calculated by the indicator. Using this allows one to programatically ensure only new bars are re-calculated on each tick.
Is it necessary to apply a similar strategy when creating an FT indicator?
If I didn't, would every bar in the chart be recalculated on every tick (or bar)?
2. Are there any steps necessary when programming an indicator to ensure there are no issues when stepping 'backwards' in a chart using the BackSpace key?
3. Can you recommend a good reference for Delphi programming? I did a little Pascal about 15years ago and have only really used VB since then so am a little rusty.
Many thanks.
Steve |
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Wed Feb 25, 2009 4:39 am Post subject: Re: Converting indicators from MT4 to FT format (Delphi) |
|
|
| dackjaniels wrote: | Hi,
I am new to ForexTester (which appears to be an excellent product) and have a few questions regarding indicator conversion from MT4 format.
1. In MT4, as I understand it the IndicatorCounted() function returns the number of bars already calculated by the indicator. Using this allows one to programatically ensure only new bars are re-calculated on each tick.
Is it necessary to apply a similar strategy when creating an FT indicator?
If I didn't, would every bar in the chart be recalculated on every tick (or bar)?
2. Are there any steps necessary when programming an indicator to ensure there are no issues when stepping 'backwards' in a chart using the BackSpace key?
3. Can you recommend a good reference for Delphi programming? I did a little Pascal about 15years ago and have only really used VB since then so am a little rusty.
Many thanks.
Steve |
1. The difference with MT in programming indicator - you do not need to worry about order of calculating and cycle through bars. When you get info Calculate procedure it gives you index of a bar needed to be recalculated. You need to calculate only this bar, Forex Tester will care about calling this procedure for all not calculated bars in correct order.
2. no steps required
3. Really I can not, because my sources are mainly help and google. _________________ Hasta la vista
Mike |
|
| Back to top |
|
 |
dackjaniels
Joined: 24 Feb 2009 Posts: 151
|
Posted: Thu Feb 26, 2009 9:57 am Post subject: |
|
|
Hi Mike,
Many thanks for your clear reply.
Whilst creating an indicator based on moving averages utilising the GetMA function I came across a problem.
I created two MA's as follows...
Period 5, EMA, apply to close
Period 8, EMA apply to open
I noticed in testing that the MA lines were not consistent and eventually confirmed the following: When the indicator was dropped onto a chart containing data the lines were drawn correctly. However, when I pressed 'Connect' and ran the data through in accellerated 'real time' the faster EMA (period 5) was calculated according to OPEN rather than close.
In the GetMA statements I had used the ma_EMA, pt_open and pt_close terms to pass the required info.
I then regsitered options for the pricetype and MAType and used the following terms in the GetMA function call......TMAType(FastMAtype), TPriceType(FastApplyToPrice).
This time it worked fine, both on populated charts and in accelerated 'real time' mode.
Was I incorrect to use pt_open, pt_close and ma_EMA in my original attempt or is this perhaps a program bug?
Best regards and keep up the good work, version 2 has some great improvements, looking forward to its first retail release.
Steve |
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Thu Feb 26, 2009 3:50 pm Post subject: |
|
|
| dackjaniels wrote: | Hi Mike,
Many thanks for your clear reply.
Whilst creating an indicator based on moving averages utilising the GetMA function I came across a problem.
I created two MA's as follows...
Period 5, EMA, apply to close
Period 8, EMA apply to open
I noticed in testing that the MA lines were not consistent and eventually confirmed the following: When the indicator was dropped onto a chart containing data the lines were drawn correctly. However, when I pressed 'Connect' and ran the data through in accellerated 'real time' the faster EMA (period 5) was calculated according to OPEN rather than close.
In the GetMA statements I had used the ma_EMA, pt_open and pt_close terms to pass the required info.
I then regsitered options for the pricetype and MAType and used the following terms in the GetMA function call......TMAType(FastMAtype), TPriceType(FastApplyToPrice).
This time it worked fine, both on populated charts and in accelerated 'real time' mode.
Was I incorrect to use pt_open, pt_close and ma_EMA in my original attempt or is this perhaps a program bug?
Best regards and keep up the good work, version 2 has some great improvements, looking forward to its first retail release.
Steve |
Without seeing the code I can not say anything. _________________ Hasta la vista
Mike |
|
| Back to top |
|
 |
ghamm
Joined: 11 Feb 2009 Posts: 37
|
Posted: Thu Feb 26, 2009 4:21 pm Post subject: |
|
|
If you post the code, we can take a look and try and help, hard to guess  |
|
| Back to top |
|
 |
dackjaniels
Joined: 24 Feb 2009 Posts: 151
|
Posted: Thu Feb 26, 2009 6:51 pm Post subject: |
|
|
| ghamm wrote: | If you post the code, we can take a look and try and help, hard to guess  |
Hi,
I've overwritten the code with the working version now so not to worry. I have a few more indicators to create so am sure I will be back for more advice very soon.
In fact, to start with, can you tell me if there is a stochastic function in Forex Tester (similar to iStochastic function in MT4)?
Thanks,
Steve |
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Thu Feb 26, 2009 7:45 pm Post subject: |
|
|
| dackjaniels wrote: | | ghamm wrote: | If you post the code, we can take a look and try and help, hard to guess  |
Hi,
I've overwritten the code with the working version now so not to worry. I have a few more indicators to create so am sure I will be back for more advice very soon.
In fact, to start with, can you tell me if there is a stochastic function in Forex Tester (similar to iStochastic function in MT4)?
Thanks,
Steve |
There is no such functions. But source codes of all indicators are available in Examples/Indicators/Delphi/IndicatorsSrc/ _________________ Hasta la vista
Mike |
|
| Back to top |
|
 |
ghamm
Joined: 11 Feb 2009 Posts: 37
|
Posted: Fri Feb 27, 2009 4:45 am Post subject: |
|
|
| There is a Stoch function, its the same result as MT4 , far as I can tell |
|
| Back to top |
|
 |
dackjaniels
Joined: 24 Feb 2009 Posts: 151
|
Posted: Sat Feb 28, 2009 9:47 pm Post subject: |
|
|
| ghamm wrote: | | There is a Stoch function, its the same result as MT4 , far as I can tell |
Where can I find this Stoch function you speak of ghamm?
Thanks,
Steve |
|
| Back to top |
|
 |
|