james272: i have encountered some array out of range error.
int CountBars = Bars; for (i = 0; i < CountBars; i++){ double ima10 = iMA(NULL, 0, 10, 0, MODE_SMA, PRICE_CLOSE, i + 1); double ima21 = iMA(NULL, 0, 21, 0, MODE_SMA, PRICE_CLOSE, i + 1); ⋮ for (counter = i; counter <= i + 2; counter++){ AvgRange = AvgRange + MathAbs(High[counter] - Low[counter]); } ⋮ cl1 = Close[i + 1]; cl2 = Close[i + 2]; op1 = Open[i + 1]; op2 = Open[i + 2]; // UP
CountBars equals Bars. So when i becomes Bars-1 you do a iMA(Bars) Close[Bars] and Close[Bars+1], and counter+1==Bars and High[Bars] do not exist. Etc.
Count down and Do your lookbacks correctly.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi...
i have encountered some array out of range error.
i tried to figure out where is problem but it difficult figure out .
here is part of source code
i can see array out of range error happened in this line.
if anyone enlighten me much appreciate!