Try to change:
else first=prev_calculated-1; // start index for the new bars -> to else first=HighPeriod-1;
Try to change:
Thank you, 3rjfx.
I tried that but still got the same result. Still working on it.
Thank you, 3rjfx.
I tried that but still got the same result. Still working on it.
- www.youtube.com
Watch this video arrayOutOfRange
Thanks for your reply yassin.
I have watched the video and try to edit my EA. The array works well when running the auto trading.
But the same problem still occurs whenever the EA is tested on Strategy Tester, just as I described.
Would appreciate any further suggestion from you guys.
Thank you much.
Thanks for your reply yassin.
I have watched the video and try to edit my EA. The array works well when running the auto trading.
But the same problem still occurs whenever the EA is tested on Strategy Tester, just as I described.
Would appreciate any further suggestion from you guys.
Thank you much.
Hi anuwat,
I saw the problem is on this code
double rhigh= high[ArrayMaximum(high,bar-HighPeriod,HighPeriod)];
Try to change with this
double rhigh= high[ArrayMaximum(high,MathAbs(bar-HighPeriod),HighPeriod)];
Hi anuwat,
I saw the problem is on this code
Try to change with this
This seems to solve my problems.
Thank you a lot! 3rjfx.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I'm trying to test an EA, on Metatrader5, which includes custom indicator "Highest High", coded as below, on stock data.
The indicator determines the highest of high prices of N recent bars (input HighPeriod in the code).
The Highest High indicator works fine without error when using on Chart, whatever the period (HighPeriod) is.
But when testing the EA in Strategy Tester, the error occurs whenever the period is set to be a specific number or above, say 101 bars.
I notice that the number, which in this case is 101, is the same number as "bars of beginning data" appearing in Journal when the test is started, as in the image below.
The number varies upon the stock data. When the data "contains 217 bars of beginning data", the indicator starts to get array out of range error when the HighPeriod input is 217 or above.
As the indicator works normally on chart, I assume the problem is with the Strategy Tester.
Do you have any idea about how to make the EA work for any value HighPeriod?
What determines the number of "contains xxx bars of beginning data" ?
Thanks in advance for your help.