Indicator values from other timeperiod

 

Hello, how I can get indicator values from other time periods gotten during the strategy testers runs, with the Livechart that goes simply by just adjusts another period parameter, but with the strategy tester run does not function it. I hope someone know the problem and can help.

 
echnaton:
Hello, how I can get indicator values from other time periods gotten during the strategy testers runs, with the Livechart that goes simply by just adjusts another period parameter, but with the strategy tester run does not function it. I hope someone know the problem and can help.

double iCustom( string symbol, int timeframe, ...

 

hello and thank you very much for help, i have tried to get the indicator values from the stochastic indicator with this code :

iCustom(NULL,240,"Stochastic",0,1)

but it dont work, i just want to get the value from the 4 hour and daily stochastic Indikator during the strategy tester runs in the 15min chart?

 
echnaton:
hello and thank you very much for help, i have tried to get the indicator values from the stochastic indicator with this code :
iCustom(NULL,240,"Stochastic",0,1)
but it dont work, i just want to get the value from the 4 hour and daily stochastic Indikator during the strategy tester runs in the 15min chart?

Stochastic is not a custom indic, you have tu use:

double iStochastic( string symbol, int timeframe, int %Kperiod, int %Dperiod, int slowing, int method, int price_field, int mode, int shift)

See MT4 dictionary.

 

hello, bcause of my bad english nobody undestands me perhabs. for first i also use the standard stochstic indicator and gave him other timeframe parameters at the time frame parameter there, this way i know thats nothing new. but this only works if you are in a live chart, then you get of this way valus from other timeframes, but if you try the same at a chart in the strategy tester runs it is not possible to get valus from other timeframes an that ist what i want. if the strategy tester runs you only get values from the current timeframe and is it not possible to get some right of other, so there is no simulation possible. i hope its understandable what i mean.

 
echnaton:
hello, bcause of my bad english nobody undestands me perhabs. for first i also use the standard stochstic indicator and gave him other timeframe parameters at the time frame parameter there, this way i know thats nothing new. but this only works if you are in a live chart, then you get of this way valus from other timeframes, but if you try the same at a chart in the strategy tester runs it is not possible to get valus from other timeframes an that ist what i want. if the strategy tester runs you only get values from the current timeframe and is it not possible to get some right of other, so there is no simulation possible. i hope its understandable what i mean.

Yes, I understand you very well (maybe because my english is even worst than yours).

Here, almost nobody want to see this problem and that's why most of BT of strategy using higher timeframes are wrong.

I have no generic solution, but sometime I have one. You are luky the use of stochastic may be solved by my method.

Look at the attached DynamicRange indicator, and a simplified version for DailyRange. No one DailyRange indicator in this forum is right, but this well.

If you just use CopyRate() or get the value from the indic on higher tf, the tester will use the values of the closed bar. This means it knows the futur.

What you have do for the stochastic is the same as the DynamicRange code; in two words :

1) take the time of bar in the working timeframe;

2) find the same bar in the M1 timeframe using iBarShift(); this is the EndBar

3) find the StartBar, which shift is EndBar + StocPeriod in minutes;

4) compute the range between StartBar and EndBar using iHighest() and iLowest() on M1;

5) Use iClose() of EndBar on M1 as your usual close;

6) now you can calculate your Stochastic: S = 100*(close - RangeLow)/Range;

Regards

Michel

Files:
 

Hello, your post was very helpfull i think.

Now here is what i had find out.

If I put the DynamicRange Indicator on a Chart during the Strategy tester runs it doesnt draw his lines, if i put it on a livechart wihich has fineshd the previous bars it drwas his line.

If i put the DailyRange indicator on the strategy tester chart und let it run, it functioned, it drwas his line and look like it fit.

Now, this way you told me now i have had time ago in my head want to try. Now i now that it must be solve so, just by calculating the values of indicator self by taking every pricevalues from the chart with help of time constant and so on.

i hope i can solve it and understands this problem for that i can test what i want in the strategy tester in future.

thank you very much for yours help at all.