NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 03-17-2009, 02:57 AM   #1
mdm72
Junior Member
 
Join Date: Feb 2009
Posts: 27
Thanks: 0
Thanked 0 times in 0 posts
Default stop and start strategy

Hello, I have a question on the workings of stop/start strategy from the strategies tab: if I start a strategy after using RightClick-> New Strategy I undestand the Initialize() is executed, and the OnBarUpdate() is ready to be triggered and being executed.

Now what happens if I stop a running strategy and start it again by pressing the start button? Is the Initialize() member function executed?

In other terms, if I stop and start the strategy, do I get a new instance of the object, or is it still the same, and therefore Initialize() is not executed?

Thanks
mdm72 is offline  
Reply With Quote
Old 03-17-2009, 08:12 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

You get a new instance.
NinjaTrader_Josh is offline  
Reply With Quote
Old 03-17-2009, 09:35 AM   #3
mdm72
Junior Member
 
Join Date: Feb 2009
Posts: 27
Thanks: 0
Thanked 0 times in 0 posts
Default

Do you mean that when pressing start (after stopping) Initialize() is executed and the variables are reinitialized?
mdm72 is offline  
Reply With Quote
Old 03-17-2009, 09:42 AM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

No. You can see when Initialize() is called by adding a print command into it. You should not be placing variable initializes in there. You should do that in the Variables section of the code.
NinjaTrader_Josh is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop-Start trend Automated Trading 1 03-12-2009 09:35 AM
Start/Stop strategy event zer0balance Strategy Development 6 12-29-2008 09:29 AM
start strategy again max-td Strategy Development 5 04-24-2008 04:32 AM
How to set session start/stop time in NS? henry.omd Strategy Development 1 01-11-2008 02:31 PM
Strategy Start/Stop Event Json Strategy Development 1 05-01-2007 03:55 AM


All times are GMT -6. The time now is 06:39 AM.