View Full Version : Populating strategy variables after restarting NT7
08-22-2010, 06:27 AM
I have coded up a strategy using the stop placement techniques detailed in this thread ( http://www.ninjatrader.com/support/forum/showthread.php?t=7499 ).
Throughout the code I am referring to the IOrder variables to manage the orders. Now I am concerned that these variables won't be repopulated if NT7 is shut down and restarted for whatever reason and hence my strategy won't work. Is this true?
I can't seem to find any examples of people who have tackled this in the forum.
08-22-2010, 10:58 AM
zeeee, I am not exactly sure what you are asking, although if your strategy works fine as is, it will work fine after restarting NinjaTrader. You are correct though that unless you've wrote specific code to persist the variables, the variables will be reset upon a restart, but that shouldn't make your strategy non-functional.
08-22-2010, 02:32 PM
Well if I am referring to the IOrder in something like this:
if(NewCalculatedStop > stopOrder.StopPrice) MoveStop();
Then stopOrder would be null and the strategy wouldn't function correctly (by my definition!)
Do you suggest that I loop through the OrderCollection and pick out the order upon startup?
08-22-2010, 09:06 PM
zeeee, I will have someone respond to you tomorrow.
08-23-2010, 02:53 AM
zeeee, when you restart the strategy will recalculate the on it's historical part before continuing to run in realtime, this will include IOrder objects, however the state of those which you for example encountered on the last realtime run is not persisted.
08-23-2010, 03:04 AM
Great, thanks for your help Austin and Bertrand!