I have this very basic tryout strategy using two IOrder objects LongEntry and ShortEntry:
OnBarUpdate:
-> if IOrders are != null, set them to = null.
-> if Close0 >= Open0 and LongEntry is null, LongEntry = EnterLong();
-> if Close0 < Open0 and ShortEntry is null, ShortEntry = EnterShort();
OnExecution:
-> if LongEntry != null and LongEntry.Token is execution.Order.Token, Print "Long"
-> if ShortEntry != null and ShortEntry.Token is execution.Order.Token, Print "Short".
Okay, what happens is: as long as the strategy keeps going long or short into the same direction, it all works fine. The position is increased and the Prints keep coming. Now: When the strategy "turns", meaning it changes a 5-long position into a 1-short position because of a red bar after 5 green bars, it crashes giving the "object reference not set to an instance of an object" error. It all works fine in 6.5, however.
(I'm using NT7b3 right now.)
Help would be greatly appreciated!
Thanks,
noincome

)
Comment