When I use the EnterLong() / EnterShort() when an position is open, it closes the position and opens a new one.
Is there a simple way to achieve this, without the unmanaged approach?
I downloaded the example code for the unmanaged approach from: https://ninjatrader.com/support/foru...ry-orders-help
but I don't now how to use it, because when I code in the OnBarUpdate() method the following:
if(<condition>)
SubmitOrder(0, OrderAction.Sell, OrderType.Limit, 1, Close[0], 0, ocoString, "ShortPosition");
it doesn't work and a get a blank chart and no messages in the log. (see attached UnmanagedOCOBracketExample.cs)
I am attaching a strategy (ZL Cross.cs) to test the cancellation of the positions created with limits.
Thanks!
Comment