-
if(CopyHigh(Symbol(), PERIOD_CURRENT, 0, rates_total, High) <= 0) return(rates_total); ArraySetAsSeries(High, true); //--- main loop for(int i = limit-1; i >= 0; i--) { ⋮ && High[5+i]<Ichimoku_Kijunsen[5+i]
It only processes bars [limit-1 … 0] with a look back of five (5). Why are you reading in all bars, instead of only [limit+4 … 0] ?
-
You can move all your set as series to OnInit like the example shows.
-
if(BarsCalculated(Ichimoku_handle) <= 0) return(0);
Why are you calling that multiple times?
-
for(int i = limit-1; i >= 0; i--) { if (i >= MathMin(100-1, rates_total-1-10)) continue
See How to do your lookbacks correctly #9 — #14 & #19.
- Ahmed Abd El Aziz: while i backtesting it working too slow
-
EAs : Don't do per tick what you can do per bar, or on open.
If you are waiting for a level, don't reevaluate, wait until price reaches it (or a new bar starts, and you recalculate.)
If you are waiting for an order to close, only look when OrdersTotal (or MT5 equivalent) has changed.
How to get backtesting faster ? - MT4 - MQL4 programming forum (2017) -
Indicators: Code it properly so it only recomputes bar zero (after the initial run.)
How to do your lookbacks correctly. (2016)
3 Methods of Indicators Acceleration by the Example of the Linear Regression - MQL5 Articles. (2011)
Or, reduce Tools → Options (control+O) → Charts → Max bars in chart to something reasonable (like 1K.)
-
- 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,
I Created an Expert depending on external indicator
while i backtesting it working too slow
I think the problem is in the indicator code
Can somebody refer to me the mistake that cause this slow?
I think the mistake is here:
Can you help me in this topic?