- andrw11: i have included this indicator into my EA.
Don't try to do that. There are no buffers, no IndicatorCounted() or prev_calculated. No way to know if older bars have changed or been added (history update.)
Just get the value(s) of the indicator(s) into EA/indicator (using iCustom) and do what you want with it.
You should encapsulate your iCustom calls to make your code self-documenting.
Detailed explanation of iCustom - MQL4 programming forum #33 2017.05.23 - andrw11: Can anyone help me find how to optimize it or anyway to accelerate the testing?
- EAs : Don't do per tick that 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 open or close, only look when OrdersTotal (or MT5 equivalent) has changed.
How to get backtesting faster ? - MT4 - MQL4 programming forum 2017.08.07 - Indicators: Code it properly so it only recomputes bar zero (after the initial run.)
How to do your lookbacks correctly. 2016.05.11
Or, reduce Tools → Options (control+O) → Charts → Max bars in chart to something reasonable (like 1K.)
- EAs : Don't do per tick that you can do per bar, or on open.
-
Don't try to do that. There are no buffers, no IndicatorCounted() or prev_calculated. No way to know if older bars have changed or been added (history update.)
Just get the value(s) of the indicator(s) into EA/indicator (using iCustom) and do what you want with it.
You should encapsulate your iCustom calls to make your code self-documenting.
Detailed explanation of iCustom - MQL4 programming forum #33 2017.05.23 - EAs : Don't do per tick that 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 open or close, only look when OrdersTotal (or MT5 equivalent) has changed.
How to get backtesting faster ? - MT4 - MQL4 programming forum 2017.08.07 - Indicators: Code it properly so it only recomputes bar zero (after the initial run.)
How to do your lookbacks correctly. 2016.05.11
Or, reduce Tools → Options (control+O) → Charts → Max bars in chart to something reasonable (like 1K.)
- EAs : Don't do per tick that you can do per bar, or on open.
Thanks a lot for your help
1. i have already included the indicator using an iCustom function.
2.
1- so as in your code example , i should put all my code (calculations and indicators) inside the IF statement of "isnew bar" ?
and regarding orders , i have already mentioned that if (signal="buy" && orderstotal < 2 ) then execute a buy order
2- i'm not quite sure i understand the code mentioned ! but i have tried the second option of reducing "Max bars" and it's slightly faster
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i have included this indicator into my EA.However, after including it , strategy tester became so slow , it barley moves !!
Indicator used : https://www.mql5.com/en/code/19825
Can anyone help me find how to optimize it or anyway to accelerate the testing?