Backtesting stop loss of short position triggered at bid price

Created at 27 Mar 2022, 02:30
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
douglascvas's avatar

douglascvas

Joined 02.01.2018

Backtesting stop loss of short position triggered at bid price
27 Mar 2022, 02:30


I was reviewing the position opens versus the tick data and noticed that ctrader seems to always use the bid price for stop loss and take profit calculation, regardless of the direction of the position. Shoudn't a stop loss for a SELL position be calculated at ASK price?

For instance:

EURUSD SELL position (pipsize = 0.0001)
Current ASK: 1.13749
Current BID: 1.13747
Stop Loss Pips: 10
Take Profit Pips: 10

Expected Stop Loss price: 1.13749 + (10 * 0.0001) = 1.13849

Actual Stop Loss price by ctrader: 1.13747


@douglascvas
Replies

amusleh
28 Mar 2022, 09:34

Hi,

Which type of data you were using for your back test? Tick data or m1 bars open prices?


@amusleh

douglascvas
28 Mar 2022, 10:51

RE:

amusleh said:

Hi,

Which type of data you were using for your back test? Tick data or m1 bars open prices?

I'm using Tick data


@douglascvas

PanagiotisCharalampous
28 Mar 2022, 10:57

Hi douglascvas,

For Buy positions stop loss is calculated from the ask price and for Sell positions from the bid price. What you see is correct.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

douglascvas
28 Mar 2022, 13:38

RE:

PanagiotisCharalampous said:

Hi douglascvas,

For Buy positions stop loss is calculated from the ask price and for Sell positions from the bid price. What you see is correct.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Hi Panagiotis. Are you sure? Does that make sense?

I mean, If a sell position is triggered on BID and closes on ASK, doesn't it make more sense that the stop loss is calculated on ASK as well? Otherwise it risks setting the stop loss inside of the spread, which means the position would either be immediatelly closed if the stop loss pips is lower than the spread or it simply won't have a SL. 


@douglascvas

Shares4us
31 Jul 2023, 07:19

RE: RE:

Hi Panagiotis. Are you sure? Does that make sense?

I mean, If a sell position is triggered on BID and closes on ASK, doesn't it make more sense that the stop loss is calculated on ASK as well? Otherwise it risks setting the stop loss inside of the spread, which means the position would either be immediatelly closed if the stop loss pips is lower than the spread or it simply won't have a SL. 

I think it doesn't make sense.
Maybe spotware should add another prop called StoplossFixed that includes the spread when evaluating.
We now try to overcome this by setting the cTrader SL for shorts inclusive an ‘expected spread’ (for double safety ;-)) and checking it realtime(ontick) in the program.
I know it's not beautifull but it helps a bit.


@Shares4us