Ask How can Fast optimization by use small time and cheap cost? (waiting time long 95 hour calculate) and MQL5 Cloud Network cheap or not? - page 2

 
William Roeder #:
  1. 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)

  2. 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.)

hello. thank you for sharing your valuable information. i have implemented the 1st solution with this simple code:

  //global variable
 int totalBars;

void OnTick(){
 int bars = iBars(_Symbol,PERIOD_CURRENT);
  if (totalBars != bars){
  totalBars = bars;
//full EA codes and functions is placed here
 }
}

this code made a huge difference in the speed of my EAs optimization process. if you think there is even a better solution, please let us know.