Converting indicators from MT4 to FT format (Delphi)

How to create strategies and indicators
Message
Author
dackjaniels
Posts: 151
Joined: Tue Feb 24, 2009 1:03 pm

Converting indicators from MT4 to FT format (Delphi)

#1 Postby dackjaniels » Tue Feb 24, 2009 1:20 pm

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

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

Re: Converting indicators from MT4 to FT format (Delphi)

#2 Postby Terranin » Tue Feb 24, 2009 11:39 pm

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

dackjaniels
Posts: 151
Joined: Tue Feb 24, 2009 1:03 pm

#3 Postby dackjaniels » Thu Feb 26, 2009 4:57 am

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

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

#4 Postby Terranin » Thu Feb 26, 2009 10:50 am

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

ghamm
Posts: 39
Joined: Wed Feb 11, 2009 3:02 pm

#5 Postby ghamm » Thu Feb 26, 2009 11:21 am

If you post the code, we can take a look and try and help, hard to guess :)

dackjaniels
Posts: 151
Joined: Tue Feb 24, 2009 1:03 pm

#6 Postby dackjaniels » Thu Feb 26, 2009 1:51 pm

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

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

#7 Postby Terranin » Thu Feb 26, 2009 2:45 pm

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

ghamm
Posts: 39
Joined: Wed Feb 11, 2009 3:02 pm

#8 Postby ghamm » Thu Feb 26, 2009 11:45 pm

There is a Stoch function, its the same result as MT4 , far as I can tell

dackjaniels
Posts: 151
Joined: Tue Feb 24, 2009 1:03 pm

#9 Postby dackjaniels » Sat Feb 28, 2009 4:47 pm

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


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 19 guests