I was replicating Multicharts strategy in backtrader.
I have an issue with Breakeven stop loss.
When I disable Breakeven stop loss I get perfect match.
I can't replicate a trade that closes using Breakeven stop loss at 8th of February 2017 11:00:00.
To close at 11:00, strategy places orders at previous bar - 10:00
As I understand stop order is replaced every bar.
In my replication last time Breakeven gets activated is at 09:00
At 10:00 Breakeven don't get activated and standard stop loss order is placed instead.
But in StrategyQuant trade is closed at Breakeven, I don't get how it can happen.
Probably a bug in StrategyQuant.
Here is the data I have:
PriceLevel = 3.8 * SQ_ATR(74)[1]
2017-02-08 09:00
SQ_ATR(74)[0] = 5.464436991639985
PriceLevel = 20.861913452728277
Entryprice = 1037.0
Close = 1065.9
Close - PriceLevel = 1045.0380865472719
Entryprice <= Close - PriceLevel = True
Breakeven got activated
2017-02-08 10:00
SQ_ATR(74)[0] = 5.564917572834041
PriceLevel = 20.764860568231942
Entryprice = 1037.0
Close = 1055.1
Close - PriceLevel = 1034.3351394317679
Entryprice <= Close - PriceLevel = False
Breakeven didn't get activated