- Mario0407: Any ideas why my EA gets slowly over time when backtesting? I have a loop that is executed three times, based on the time frame.
if(iHigh(Symbol(),tf,i)
Your loop is three timeframes times whatever i loops on.
-
Why are you looking at multiple candles? If the earlier candles had your condition, you would have opened then. You only need to look at the last.
-
Do you have a new bar test for each timeframe?
detecting a new bar without removing ability to detect tick in multiple timeframe - Easy Trading Strategy - MQL4 programming forum #8 (2021.08) -
Do you have indicator(s) that calculates all bars each tick?
-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
Messages Editor
1. correct i look on three timefrimes on the same candel pattern.
2. I look at multiple candles because i want to find a certain scenario. Looking for high then lows,...
3. EA runs every minute
if(LastActionTime != Time[0]) { // Code // ... // ... LastActionTime = Time[0]; }
do you mean something link that? to not run every minute the loop?
if(candelcounter[m] >= 1) { candelcounter[m] ++; lowest_Low_Price[m] =iLow(Symbol(),tf,candelcounter[m]); High_of_Lowest_Bar[m]=iHigh(Symbol(),tf,candelcounter[m]); Lowest_Low_Bar[m] = candelcounter[m]; lowest_Low_Pricere_time[m] = iTime(Symbol(),tf,Lowest_Low_Bar[m]); } if(candelcounter[m] >=20) { Lowest_Low_Bar[m] =0; candelcounter[m] =0; } if(iLow(Symbol(),tf,1) <= lowest_Low_Price[m]) { Lowest_Low_Bar[m] =0; candelcounter[m] =0; } if(candelcounter[m] ==0) { for(int i=0; i<=Check_Candles[m]; i++) // Finds the lowes low { if(iLow(Symbol(),tf,i) <= lowest_Low_Price[m]) { lowest_Low_Price[m] =iLow(Symbol(),tf,i); Lowest_Low_Bar[m]=i; High_of_Lowest_Bar[m]=iHigh(Symbol(),tf,i); lowest_Low_Pricere_time[m] = iTime(Symbol(),tf,Lowest_Low_Bar[m]); candelcounter[m] = i; } } }
4. no, every minute
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
Any ideas why my EA gets slowly over time when backtesting?
CPU runs on 25% ram 280MB.
I am Running the EA each minute.
The variable are initialize before getting into the loop, there are approx 100 variables.
I have a loop that is executed three times, based on the time frame.
inside the loop i have another 50 loops which calculates variable
Variables getting defined in the loop
inside the loop there are aprox. 50 loops which calculates variables.
Not all loops do run always but only condition-wise, when 1st condition is fulfill, 2nd loop - 5th loop,
All variables in the loop are Arrays as the have to fill three times.