Hello,
I'm studying MQL and I created an EA, but when I run it, Journal gives me "Array Out of Range" each time it tries to buy or sell.
This is the code:
if(SignalToday > Close[i] && SignalYesterday < Close[i+1]){ // <- This line is the one that Journal says has the error
signalBufferBuy[i] = 1;
signalBufferSell[i] = 0;
}
SignalToday is taken from an iCustom("Signal",0, i)
SignalYesterday is taken from an iCustom("Signal",0 ,i+1)
Signal.ex4 is a bought indicator so I can't give the code. All I know is that if I test the indicator alone in MT4 dragging it to the Price window, the signals are displayed correctly. Basically it's a Moving Average that I'd like to know if it's above or under the close, so if it's below yesterday's close but above today's close, then enter.
The strange thing is that if I change the indicator in the iCustom, with some work and with some doesn't.
Any help would be greatly appreciated.
I'm studying MQL and I created an EA, but when I run it, Journal gives me "Array Out of Range" each time it tries to buy or sell.
This is the code:
if(SignalToday > Close[i] && SignalYesterday < Close[i+1]){ // <- This line is the one that Journal says has the error
signalBufferBuy[i] = 1;
signalBufferSell[i] = 0;
}
SignalToday is taken from an iCustom("Signal",0, i)
SignalYesterday is taken from an iCustom("Signal",0 ,i+1)
Signal.ex4 is a bought indicator so I can't give the code. All I know is that if I test the indicator alone in MT4 dragging it to the Price window, the signals are displayed correctly. Basically it's a Moving Average that I'd like to know if it's above or under the close, so if it's below yesterday's close but above today's close, then enter.
The strange thing is that if I change the indicator in the iCustom, with some work and with some doesn't.
Any help would be greatly appreciated.
Hard work and patience.