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 > Miscellaneous Support

Miscellaneous Support Miscellaneous support issues.

Reply
 
Thread Tools Display Modes
Old 11-19-2008, 02:57 PM   #1
heech
Senior Member
 
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
Default Saving strategy "state"

Hi there,

Apologies in advance for not having actually *tried* this yet... but I just wanted to ask the question before I got myself in too much trouble.

I'm planning to go live autotrading my (interday) strategy later this week. For redundancy purposes, I want to make sure I can export/save my strategy's parameters (as well as any other "state" about the current run... existing stop orders?), and restore the same strategy on a different computer.

How would I go about that?
heech is offline  
Reply With Quote
Old 11-19-2008, 03:34 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

If you are referring to a NinjaScript strategy, this is not possible between machines or on the same machine. Once a strategy is terminated, it will restart fresh, as if it never ran before.
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-19-2008, 03:54 PM   #3
heech
Senior Member
 
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
If you are referring to a NinjaScript strategy, this is not possible between machines or on the same machine. Once a strategy is terminated, it will restart fresh, as if it never ran before.
I'm not sure exactly how to interpret this.

Other platforms I've worked with (like Wealth Lab) are designed to run this way on every bar. Every new bar of data is essentially executed on a strategy as if there was no previous state; it builds up hypothetical positions based on the "start" date, and then goes from there. Is that also how NinjaScript strategies function?

Or are you saying that an intra-day strategy, once initiated, shouldn't be allowed to stop? And if it stops (overnight, while there are no bars)... the results will be different than if it hadn't been stopped?
heech is offline  
Reply With Quote
Old 11-19-2008, 03:59 PM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Maybe we are on not on the same page.

- You can export your strategy code and import it from one PC to another via File > Utilities

If you want to start a real-time strategy that is executing orders in a real-time brokerage account, then mid stream, stop this strategy on PC A, then go to PC B, start the strategy --> Then you can do this but on PC B, it will re-calculate the strategy state from a historical sense which may or may not match what the strategy was doing on PC A.
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-19-2008, 04:08 PM   #5
heech
Senior Member
 
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
Maybe we are on not on the same page.

- You can export your strategy code and import it from one PC to another via File > Utilities
I've been copying the .cs file from the Strategies folder back and forth (actually using Subversion CVS). Any downside to doing that?

Quote:
If you want to start a real-time strategy that is executing orders in a real-time brokerage account, then mid stream, stop this strategy on PC A, then go to PC B, start the strategy --> Then you can do this but on PC B, it will re-calculate the strategy state from a historical sense which may or may not match what the strategy was doing on PC A.
I would like to better understand this... what are the possible reasons that would cause it *not* to match what the strategy was doing on PC A?

I'm not doing anything tick based; I'm at worst on 5 minute bars, at best on 30 minute bars. I'm also using a single provider for all data (historical and live).
heech is offline  
Reply With Quote
Old 11-19-2008, 04:25 PM   #6
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

1) I don't think there would be a downside
2) There are many reasons, here are a few -

- The real-time bars built while the strategy was running does not match historical bars
- The orders execute in real-time are just different than what occurs in backtest, when you restart your strategy on PC B, even assuming the real-time and historical data is identical, orders re-calculated on historical data will fill differently than what actually happened in real-time and thus there is a mismatch
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-19-2008, 04:44 PM   #7
heech
Senior Member
 
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
1) I don't think there would be a downside
2) There are many reasons, here are a few -

- The real-time bars built while the strategy was running does not match historical bars
- The orders execute in real-time are just different than what occurs in backtest, when you restart your strategy on PC B, even assuming the real-time and historical data is identical, orders re-calculated on historical data will fill differently than what actually happened in real-time and thus there is a mismatch
Ray,

Understand the issue with bars being different.

On the order execution side... on PC A, you're saying NinjaTrader tracks positions (fill, avgPrice, etc) as they're executed through the broker. But if it's terminated, this information is subsequently lost? If so, that's definitely a form of "state" that I was referring to, and it'd be very useful if that information could be saved/exported/restored.

But for practical purposes, I think I'll be okay in any case, since my code shouldn't be so highly dependent on the details of how orders execute... I'm okay with being off a percentage point or two.
heech 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
Add to ATM Strategy "Trailing "Limit"" shawnj Suggestions And Feedback 2 10-10-2008 08:01 PM
Please add "Calmar" and "Sterling" ratios to Performance._Trades.TradesPerformance Elliott Wave Suggestions And Feedback 2 06-10-2008 09:57 PM
"'OrderRejected'. Strategy has sent cancel requests" & "There is no market data..." Elliott Wave Strategy Development 6 04-12-2008 12:03 AM
2 instances of strategy when clicking "apply" and "okay" dtf139 Historical NinjaTrader 6.5 Beta Threads 2 01-07-2008 11:25 PM
Workspace not saving "right side margin" MJT Historical NinjaTrader 6.5 Beta Threads 3 11-23-2007 01:43 PM


All times are GMT -6. The time now is 07:37 AM.