Only sending relevant ticks to EA for backtesting

 

I am currently backtesting my EA using 1 minute OHLC but since the EA trades on a higher time frame, there are a lot of "unnecessary" ticks that the EA is being run on slowing down the optimisation.

What I would like to achieve is to send every single tick to the EA until it enters into a trade, then only send the ticks in which the prices are, for example

(-50 pips and above of the TP) and (+50 pips and below of the SL) While in a BUY trade

(+50 pips and below of the TP) and (-50 pips and above of the SL) While in a SELL trade

If these conditions are not met, the entire code of the EA need not be run. I imagine this would significantly increase the speed of the optimisation while maintaining the same level of accuracy. 

Am I making sense? if so how do I achieve this, thank you in advance. 

 
  1. 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 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)
    Or, reduce Tools → Options (control+O) → Charts → Max bars in chart to something reasonable (like 1K.)

 
show your OnTick() code so we can help you how to improve it
Reason: