I just noticed the below code gives me the opposite results:
I am counting long trades and short trades under OnPositionUpdate.
The count for long trades equals short trades and the count for short trades equals long trades in the actual execution.
protected override void OnPositionUpdate(Position position, double averagePrice, int quantity, MarketPosition marketPosition) { if (position.MarketPosition == MarketPosition.Flat) { ++strategy_trade_counts; Trade a = SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1]; tradename1 = a.Exit.Name; instrument_name = a.Exit.Instrument.MasterInstrument.Name; if(a.Exit.Instrument.MasterInstrument.Name == "AUDUSD" && a.Exit.MarketPosition ==MarketPosition.Long) { ++aud_long_count; } }
long trades = 15; Short trades = 12
however, the above code gives me:
long trades = 12; short trades = 15
can you confirm if you're seeing the same on your end?
thanks
Comment