Open Prices Only Effect on Active SL & TP

 

There have been similar topics discussed on here but I haven't seen one where this specific question has been fully answered.

When using the open prices only method in the strategy tester, if a stop loss and take profit were set on the previous bar, and the market trades at or below the stop loss and at or above the take profit (presuming it's a long trade), does the platform know which one has been hit first, and if so, how?

 
koranged:

There have been similar topics discussed on here but I haven't seen one where this specific question has been fully answered.

When using the open prices only method in the strategy tester, if a stop loss and take profit were set on the previous bar, and the market trades at or below the stop loss and at or above the take profit (presuming it's a long trade), does the platform know which one has been hit first, and if so, how?

what ?
market moves either toward TP or SL. are you considering price gaps between two bars while trade is open?
a picture describing your question helps a lot

 
koranged:

There have been similar topics discussed on here but I haven't seen one where this specific question has been fully answered.

When using the open prices only method in the strategy tester, if a stop loss and take profit were set on the previous bar, and the market trades at or below the stop loss and at or above the take profit (presuming it's a long trade), does the platform know which one has been hit first, and if so, how?

For the very reason of that ambiguity, I would not recommend you use "Open Prices Only" if your S/L or T/P is within or very close to an Average Range of the candles. In fact I would not recommend "Open Prices" for any kind of back-testing, except for a quick analysis of code functionality.
 
Sorry fernando can you further explain his question to me?
seems like a tricky consideration for backtests. is it ? (if a strategy is gonna be a scalper, HTF)
 
Code2219 or probably 2319:
Sorry fernando can you further explain his question to me?
seems like a tricky consideration for backtests. is it ? (if a strategy is gonna be a scalper, HTF)

The OP is probably placing the T/P and/or S/L within the range of the bar's High and Low Prices.

For example, if on a D1 chart the Bar has a High to Low range of 100 pips (eg. 50 pips up from previous days' close and 50 pips down from previous days close) and the OP places a trade at the open with a 20 pip S/L and 20 pip T/P, then obviously the price action took place within the that single bar and using the "Open Prices Only" back-testing it will be an ambiguous case as we don't know which one got hit first, the S/L or T/P.


 
thanks
 

It is possible to do a decent backtest with open price only. As long as your ea accomodates the shortcommings /way-it-works of the tester like Fernando kindly explained.

1) Do not use the TP SL orders, but use virtual stops and take profit.

2) even more important, use M1 data for open prices for tester input, regardless of your operating timeframe (if any), make an inpute variable for timeframe of your logic. 

This way, even using TP SL orders, you levels will be checked for every single minute within the day for example while your logic runs on 1H.


Anyways, learn to understand how tester works, or you will not be able to interpret the report anyways.

Result being, nice backtest, real results are crap. Plenty of topics about this.

 
Fernando Carreiro:

The OP is probably placing the T/P and/or S/L within the range of the bar's High and Low Prices.

For example, if on a D1 chart the Bar has a High to Low range of 100 pips (eg. 50 pips up from previous days' close and 50 pips down from previous days close) and the OP places a trade at the open with a 20 pip S/L and 20 pip T/P, then obviously the price action took place within the that single bar and using the "Open Prices Only" back-testing it will be an ambiguous case as we don't know which one got hit first, the S/L or T/P.


This was purely a hypothetical question, but the situation you are describing is the exact one I am referring to. If a SL and TP were set on the previous bar, and then the 0 bar trades within the range of both orders (just like your picture shows), how is it possible for the platform to know which one was hit first? Like you say the outcome seems ambiguous.

 
koranged: This was purely a hypothetical question, but the situation you are describing is the exact one I am referring to. If a SL and TP were set on the previous bar, and then the 0 bar trades within the range of both orders (just like your picture shows), how is it possible for the platform to know which one was hit first? Like you say the outcome seems ambiguous.
It will not know and the results are undefined, hence my recommendations!
 
Enrique Dangeroux:

It is possible to do a decent backtest with open price only. As long as your ea accomodates the shortcommings /way-it-works of the tester like Fernando kindly explained.

1) Do not use the TP SL orders, but use virtual stops and take profit.

2) even more important, use M1 data for open prices for tester input, regardless of your operating timeframe (if any), make an inpute variable for timeframe of your logic. 

This way, even using TP SL orders, you levels will be checked for every single minute within the day for example while your logic runs on 1H.


Anyways, learn to understand how tester works, or you will not be able to interpret the report anyways.

Result being, nice backtest, real results are crap. Plenty of topics about this.

Can you explain what exactly you mean by a virtual SL/TP? 

I can use tick data for the testing, I was just curious about how this situation would play out if using open prices only. 

 
Fernando Carreiro:
It will not know and the results are undefined, hence my recommendations!

I agree with you, like I say it was just a hypothetical to throw out there, I can use tick data instead, it's just the open prices only method is obviously a lot faster, hence my curiosity :). 

Reason: