Indicator not working in #property strict mode . - page 2 12 New comment Jebs siptungkha 2022.09.15 06:02 #11 is this what you are trying to get with multi time frames? extern bool UseATRMode = true; extern int NonATRStopPips = 40; extern int ATRPeriod = 9; extern double ATRMultiplier = 3.0; extern int ATRSmoothing = 0; William Roeder 2022.09.15 16:01 #12 int limit = rates_total-(prev_calculated>0 ? prev_calculated : 1); ictr = limit - 1;After the first run, ictr is equals minus one. for ( xctr = ictr; xctr >= 0; xctr-- ) { // Calculate the stop amountSo your loop stops working. Drop ictr and use limit. Your initial run starts at rates_total-1. You access: double PrevStop = TrStopLevel[xctr+1]; Meaning your lookback is one. And in retval = iMAOnArray( indBuffer, 0, ( Periods * 2 ) - 1, 0, MODE_EMA, shift ); Your lookback is Periods*2-1. Array exceeded. How to do your lookbacks correctly #9 — #14 & #19 (2016) Your code int per = Period(); string perstr = ""; switch( per ) { case PERIOD_M1: perstr = "M1"; break; case PERIOD_M5: perstr = "M5"; break; case PERIOD_M15: perstr = "M15"; break; case PERIOD_M30: perstr = "M30"; break; case PERIOD_H1: perstr = "H1"; break; case PERIOD_H4: perstr = "H4"; break; case PERIOD_D1: perstr = "D1"; break; case PERIOD_W1: perstr = "W1"; break; case PERIOD_MN1: perstr = "MN1"; break; Simplified string perstr = as_string(ENUM_TIMEFRAMES(_Period) ); Always write self-documenting code: Need some help with some MT5 code - MT5 - Expert Advisors and Automated Trading - MQL5 programming forum (2018) 12 New comment
is this what you are trying to get with multi time frames?
Your initial run starts at rates_total-1. You access:
Meaning your lookback is one. And in
Your lookback is Periods*2-1.
Array exceeded.
How to do your lookbacks correctly #9 — #14 & #19 (2016)
Need some help with some MT5 code - MT5 - Expert Advisors and Automated Trading - MQL5 programming forum (2018)