- ago
I feel like this has been asked before, so forgive me in advance
but in backtesting - how should we handle scenarios where my entry and stop happen on the same bar ?
Am I correct in saying that WL8 cannot execute an intra-bar stop order?

CODE:
if (barsSinceEntry == 0) { // Bar 0 (Entry Bar): Initial stop at Midline + 1.0 ATR stopPrice = midline + currentATR; ClosePosition(pos, OrderType.Stop, stopPrice, "Short Initial Stop"); }


below you can see an up bar in grey:

1= short position initiated
2=yellow dot stop loss (breached on the same bar)
3=actual exit showing at the open of next bar





0
24
1 Replies

Reply

Bookmark

Sort
- ago
#1
Check AssignAutoStopTargetPrices method.
Or you can just create a sample block strategy, for stop exit, select "Same Bar" check box, and check the C# code it generates.
0

Reply

Bookmark

Sort