I have some great trading ideas, well tested in manual trading and in some basic MQL4 code, but I lack experience in making EAs.
The code works fine in indicators, but it fails in EA. For example: For Loops used to fill in and update arrays, they work fine in indicators,
and yet the EAs complile ok, no errors, and the for-loop just doesn't run at all, what I am I missing here?
I tested everything, arrays work on their own, it is the for /while loops that simply don't work, even if you ask them to do J=J+1 for J times
Arrays work fine. For/while loops work fine. Do you really expect an answer? We can't see your broken code.There are no mind readers here and our crystal balls are cracked.
Post all the relevant code. Like where you declare myarray. You say "code works fine in indicators, but it fails in EA." Is myarray a buffer? There are no buffers in EAs.
I put even this simple loop and it doesn't work, it compliles ok, it runs, but it doesn't run, I tried all steps, checking with Alter() function to see tick by tick, nothing happens, and it's the for loop that's the problem. No I don't use buffers or anything. Just this loop inside the OnTick function....
could it be the variable J? does it need to be declared withthin the loop?
As I said, I am new to MT4, and even more so to EAs, I can detect errors fast, but this one compliles with no errors. Today is Saturday there no ticks, but I was testing this on trading days and the for loops wouldn't run, even though everything else in the OnTick function run. I will try again next week, the only warning I remember seeing once was 'expression not boolean'
You can just use it in OnTimer() function in stead of OnTIck() no need to wait for next week.
Did you try ?
Forum on trading, automated trading systems and testing trading strategies
for loops don't work in EAs what am I missing?
Icham Aidibe, 2018.03.24 13:39