tested with error "critical runtime error 502 in OnTester function (array out of range)

 
Has anyone encountered this ERROR before? I keep receiving this ERROR ALERT while optimizing, but eventually, the entire optimization process completes successfully. Do I need to fix this ERROR? Does it affect the optimization results?


I attached my source code and hope someone can tell me why and how to solve.........

thank you guys


2024.01.14 00:31:15.139   MQL5 Cloud USA         genetic pass (2, 366) tested with error "critical runtime error 502 in OnTester function (array out of range, module Experts\Advisors\EA_istoch_BB.ex5, file Indicators.mqh, line 256, col 40)" in 0:00:00.159 (PR 138)

Files:
Indicators.mqh  28 kb
 
 

how to use ArraySize to below code ?

double value = NormalizeDouble((upper[pShift]-lower[pShift])/main[pShift],_Digits);

 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 

Chou Hei Leong:
Has anyone encountered this ERROR before? I keep receiving this ERROR ALERT while optimizing, but eventually, the entire optimization process completes successfully. Do I need to fix this ERROR? Does it affect the optimization results?

I attached my source code and hope someone can tell me why and how to solve.........

thank you guys

2024.01.14 00:31:15.139   MQL5 Cloud USA         genetic pass (2, 366) tested with error "critical runtime error 502 in OnTester function (array out of range, module Experts\Advisors\EA_istoch_BB.ex5, file Indicators.mqh, line 256, col 40)" in 0:00:00.159 (PR 138)

There is a bug in the code and it needs to be fixed. When indexing an array it needs to be within its bounds.
Reason: