When backtesting my EA is filling Stop Orders and TP, SL with market closed and in non existent traded levels.

 

My EA is based on price action on the analysis of each of the bars. But every time a Stop Loss, Take Profit, or Stop Order stays open from one day to the other, when next day market opens on a gap down or gap up, the strategy tester of the meta trader accepts and considers the order being filled on the Stop Order level, even if on that day markets never traded there.

 

This is bringing unreal results to the test. What I want  is to make sure my EA only fills on really traded levels.

I tried closing positions everyday and opening in the morning, but it's not efficient, doubles my trade flow and this is not what i would do in real life.

 

Any thoughts?  

 

 
cadumorlotti:

My EA is based on price action on the analysis of each of the bars. But every time a Stop Loss, Take Profit, or Stop Order stays open from one day to the other, when next day market opens on a gap down or gap up, the strategy tester of the meta trader accepts and considers the order being filled on the Stop Order level, even if on that day markets never traded there.

 

This is bringing unreal results to the test. What I want  is to make sure my EA only fills on really traded levels.

I tried closing positions everyday and opening in the morning, but it's not efficient, doubles my trade flow and this is not what i would do in real life.

 

Any thoughts?  

 

Not sure about your problem...what is the red arrow you surrounded ?
 
Alain Verleyen:
Not sure about your problem...what is the red arrow you surrounded ?

That is the sell arrow,  blues are the longs and reds the sell. In this piece of the chart, my EA connected directly longs to shorts, reversing open positions, that's why they are all connected.

That sell was triggered by a SellStop order on that level. But market opened gap down and never traded during that day on that level. the Strategy tester considered that level as valid and counted that as a real sale on that level.

when i get details over the symbol i am using it says the type of Trade Execution is "instant", do you think that maybe changing to "market" would solve? (is it possible to change or force that?). tried to find more detail on that but couldnt find

 
cadumorlotti:

That is the sell arrow,  blues are the longs and reds the sell. In this piece of the chart, my EA connected directly longs to shorts, reversing open positions, that's why they are all connected.

That sell was triggered by a SellStop order on that level. But market opened gap down and never traded during that day on that level. the Strategy tester considered that level as valid and counted that as a real sale on that level.

when i get details over the symbol i am using it says the type of Trade Execution is "instant", do you think that maybe changing to "market" would solve? (is it possible to change or force that?). tried to find more detail on that but couldnt find

I see. You will have to deal with that.
Bug in the Strategy Tester (MT4, build 950)
Bug in the Strategy Tester (MT4, build 950)
  • www.mql5.com
13000, when the current ask price is 1. - - Category: expert advisors and automated trading
Reason: