Say I am running a strategy in a playback conncetion, I want the strategy to determine what the last closed position market type is. Of course after a position is closed.
I can do this on a live feed with this function, no problem. But how do I accomplish this in a replay connection??
/Function returns last trade type OP_BUY=Long, OP_SELL=Short, -1=NoSignal //OP_BUY/OP_SELL are already defined as const int int lastClosedPositionType() { if (SystemPerformance.AllTrades.Count > 1) { Trade lastTrade = SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1]; return((lastTrade.Entry.MarketPosition==MarketPosition.Long?OP_BUY:OP_SELL)); } return(-1); }
Jess
Comment