Error with EA : "DT Oscillator EURUSD.I,H1: incorrect start position 1057 for ArrayMaximum function"

Hello Everybody,

I used “DT Oscillator” in my EA by iCustom Function,

But when I backtest, the error shows that "DT Oscillator EURUSD.I,H1: incorrect start position 1057 for ArrayMaximum function,

How can I fix it?

DT Oscillator indicator is attached.



DT_Oscillator.mq4 4 KB

I believe there is little that we can do, unless you let us see the EA code as well…

my code is Here:

string DToscilator(string SymbolOfPosition,int DToscTIMEFRAME)
   string resultOfDT;

   double Trend0=iCustom(SymbolOfPosition,DToscTIMEFRAME,"DT Oscillator","Current time frame",PeriodRSI,PeriodStoch,PeriodSK,PeriodSD,MAMode,0,1);
   double Trend1=iCustom(SymbolOfPosition,DToscTIMEFRAME,"DT Oscillator","Current time frame",PeriodRSI,PeriodStoch,PeriodSK,PeriodSD,MAMode,1,1); 
   double Trend2=iCustom(SymbolOfPosition,DToscTIMEFRAME,"DT Oscillator","Current time frame",PeriodRSI,PeriodStoch,PeriodSK,PeriodSD,MAMode,0,2); 
   double Trend3=iCustom(SymbolOfPosition,DToscTIMEFRAME,"DT Oscillator","Current time frame",PeriodRSI,PeriodStoch,PeriodSK,PeriodSD,MAMode,1,2); 
   if(Trend0>Trend1 && Trend0>Trend2 && Trend1>Trend3){resultOfDT="UpTrend";}
   if(Trend0<Trend1 && Trend0<Trend2 && Trend1<Trend3){resultOfDT="DnTrend";}

Thanks. I just wanted to be able to run up and see if the figure I get is different from yours, and whether the figure corresponds to the bars I have in my chart, without pointing finger at the ArrayMinimum and ArrayMaximum functions hastily… So with that information available, I can now conclude that in your DT Oscillator.mq4 file, these lines:

Ld_16 = G_ibuf_116[ArrayMinimum(G_ibuf_116, PeriodStoch, Li_0)];       Ld_24 = G_ibuf_116[ArrayMaximum(G_ibuf_116, PeriodStoch, Li_0)];

Li_0 is outside the array’s range. Li_0 must range between 0 to (1057-1) in your case, since your array size is 1057.

Tempted, but I refrained from fixing anything… because I couldn’t figure out the meaning of your variables…, but u’ll simply have to fix how numbers are assigned to Li_4, or give it a new name if you did have any reason to name it Li_4 and it MUST retain it’s original values… LOL

Thanks Dear Seng for your help,

But DT Oscillator.mq4 is Robert Miner famous Indicator and I didn’t make it and haven’t any information for variables.

Can you help me to fix this indicator?


Ok then.

Here’s what I did - I created two copies, one original, the other with the following change (just modified line 60 (add a -1 behind)):

int Li_4 = Bars - Li_8 - 1;

Then I run both together for comparison, and noticed that they still display the same graph (phew), so it’s probably fine…

(in the attached graphics, the one on top is the modified one)


DT_Oscillator.png 35 KB



You are the best!

The problem solved.

Thanks for your help.

By the way this is decompiled code.

:scream: no wonder all variables are named that way.