I'm implementing a strategy via Ninjascript in NT8, which trades within OnBarUpdate function (EnterLong/Short, ExitLongShort). On closing of every trade I try to highlight the background of the closing bar according to the result of the trade (win or loss).
Basically I need a callback if the MarketPosition goes flat - but I need access to last enter/exit price, net profit and so on.
Don't really understand the concept behind OnPositionUpdate, OnOrderUpdate and OnExecutionUpdate. OnPositionUpdate reflects the current market position (long, short or flat) - but in flat case, the Position attributes are empty.
OnExecutionUpdate seems to be only called if entering the market, but not exiting via ExitLong/Short calls.
Could you please provide an example, where an ExitLong/Short call trigger a callback where the last position/trade stats can be accessed to set BackBrushAll.
Thanks, Frank
Comment