Is there any answer to the question, why if I use iHigh, iTime, iHighest or any of that function and choose a lower Timeframe in the function as it is in the chart, the result will be 0 for about 16hours(if I use 1M in the function).
This Problem also only occurs in the Backtester.
I've been reading several Forums to find something about it, but the closest answer I could find was: https://www.mql5.com/en/forum/134617, which doesn't really solve the Problem.
how many bars back did you wanna have the value ?
I tryed 20 to see, if that is the cause of the problem.
We are limited with backtesting we know from what date we wanna test. If we visual test we will see that the bars are not looking back at some point.
Although we have more history for the Symbol( )
What can we do I think begin the test Earlier
And put in the EA a funtion like
Extern datetime Beginbacktestdate = D'....... // Begin you want the EA do the test //after Start() If (Beginbacktestdate > Time[0])return(0);
You have then a High[20] value for the time you do the test and the test is beginning with the date you want correctly...
The Data is definitely available. I runned the Backtest several times in the 1M-chart before. It works for higher Timeframes in the iTime-Function as the Chart is. And it also works after the Backtest runs for a while. - As I said 16hours for iTime(Symbol(),1,1) in any higher timeframe for the Backtest.
I think it has to do with the totally bars import in visual trading to do a backtest. With 1Minute Timeframe there is not so many time downloaded for the start of the backtest. With 5M you can have go back 5 times more then 1 M timeframe that's why i think if you wanna do a right backtest on 1M you have to find a way to get those bars you need and begin the test the moment you want.... ofcours this can only if you have the source code of the EA
I created this . . .
//+------------------------------------------------------------------+ //| | //| TestLowerTFData.mq4 | //| 16th April 2012 | //| | //| First version | //| | //| ---------------------------------------------------------------- | //+------------------------------------------------------------------+ #property copyright "Copyright © 2012, RaptorUK" #property link "" #define VERSION "1.0" #define EA_NAME "TestLowerTFData" //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { Print(StringConcatenate(EA_NAME, " ", VERSION), " launched."); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { static bool RunStartSequence = true; int Index; while(Index < 20 && RunStartSequence) { Print("Index = ", Index, " iHigh M1 = ",iHigh(NULL, PERIOD_M1, Index), " iLow M5 = ",iLow(NULL, PERIOD_M5, Index)); Index++; } RunStartSequence = false; // only runs once at first tick of Strategy Tester (back test) return(0); } // end of start
and got past values for M1 & M5 while testing on H1 . . .
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 19 iHigh M1 = 1.3107 iLow M5 = 1.3098
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 18 iHigh M1 = 1.3107 iLow M5 = 1.3099
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 17 iHigh M1 = 1.3107 iLow M5 = 1.3099
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 16 iHigh M1 = 1.3106 iLow M5 = 1.31
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 15 iHigh M1 = 1.3107 iLow M5 = 1.31
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 14 iHigh M1 = 1.3107 iLow M5 = 1.31
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 13 iHigh M1 = 1.3106 iLow M5 = 1.3102
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 12 iHigh M1 = 1.3106 iLow M5 = 1.3105
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 11 iHigh M1 = 1.3107 iLow M5 = 1.3106
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 10 iHigh M1 = 1.3107 iLow M5 = 1.3106
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 9 iHigh M1 = 1.3107 iLow M5 = 1.3107
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 8 iHigh M1 = 1.3108 iLow M5 = 1.3107
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 7 iHigh M1 = 1.3108 iLow M5 = 1.3106
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 6 iHigh M1 = 1.3108 iLow M5 = 1.3107
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 5 iHigh M1 = 1.3108 iLow M5 = 1.3107
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 4 iHigh M1 = 1.3108 iLow M5 = 1.3105
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 3 iHigh M1 = 1.3108 iLow M5 = 1.3105
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 2 iHigh M1 = 1.3109 iLow M5 = 1.3107
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 1 iHigh M1 = 1.3108 iLow M5 = 1.3107
2012.04.16 14:24:28 2012.04.12 00:00 TestLowerTFData EURUSD,H1: Index = 0 iHigh M1 = 1.3108 iLow M5 = 1.3108
2012.04.16 14:24:25 2012.04.12 00:00 TestLowerTFData EURUSD,H1: TestLowerTFData 1.0 launched.
I think the problem was with testing on 1M Timeframe there is no data for 20 hours back so iHigh(Symbol(),60,20)=0
I don't think so, the OP said . . . " Is there any answer to the question, why if I use iHigh, iTime, iHighest or any of that function and choose a lower Timeframe in the function as it is in the chart, "
If he was on M1 then he couldn't chose a lower timeframe . . .
This thread might be relevant: https://www.mql5.com/en/forum/137045/page2
I don't think so, the OP said . . . " Is there any answer to the question, why if I use iHigh, iTime, iHighest or any of that function and choose a lower Timeframe in the function as it is in the chart, "
If he was on M1 then he couldn't chose a lower timeframe . . .
You are right I look wrong to the problem... Sorry..
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is there any answer to the question, why if I use iHigh, iTime, iHighest or any of that function and choose a lower Timeframe in the function as it is in the chart, the result will be 0 for about 16hours(if I use 1M in the function).
This Problem also only occurs in the Backtester.
I've been reading several Forums to find something about it, but the closest answer I could find was: https://www.mql5.com/en/forum/134617, which doesn't really solve the Problem.