The documentation definitely needs updated as the code is referencing NT7 shtako and no longer relevant as when you are inside OnPositionUpdate () position.MarketPosition is old when a StopLoss triggers.
p.s. I think there's an issue here.
protected override void OnPositionUpdate(Position position, double averagePrice, int quantity, MarketPosition marketPosition ) { Print ( "1a marketPosition=" + marketPosition.ToString() ); Print ( "1b position.MarketPosition=" + position.MarketPosition.ToString() );
1a marketPosition=Long
1b position.MarketPosition=Long
Output on StopLoss triggered IN OnPositionUpdate:
1a marketPosition=Flat
1b position.MarketPosition=Long
Leave a comment: