Jim posted some interesting code here.
I was using it but noticed an odd thing. When I use say buy bid button on a playback account the print statements correctly identify the price the quantity and the market position.
If I then close that order with a sell ask it incorrectly states that I am short??
It should say Flat.
I am interested in this code precisely because I want my position detailed within an indicator.
Thanks for any help.
Here is the offending code
private void OnExecutionUpdate(object sender, ExecutionEventArgs e)
{
NinjaTrader.Code.Output.Process("", PrintTo.OutputTab1);
NinjaTrader.Code.Output.Process("ExecutionUpdate", PrintTo.OutputTab1);
// Output the execution
NinjaTrader.Code.Output.Process(string.Format("Ins trument: {0} Quantity: {1} Price: {2}",
e.Execution.Instrument.FullName, e.Quantity, e.Price), PrintTo.OutputTab1);
}
private void OnPositionUpdate(object sender, PositionEventArgs e)
{
NinjaTrader.Code.Output.Process("", PrintTo.OutputTab1);
NinjaTrader.Code.Output.Process("PositionUpdate", PrintTo.OutputTab1);
// Output the order
NinjaTrader.Code.Output.Process(e.Position.ToStrin g(), PrintTo.OutputTab1);
}

Comment