Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Saving strategy "state"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • heech
    replied
    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.

    Leave a comment:


  • NinjaTrader_Ray
    replied
    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

    Leave a comment:


  • heech
    replied
    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?

    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).

    Leave a comment:


  • NinjaTrader_Ray
    replied
    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.

    Leave a comment:


  • heech
    replied
    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?

    Leave a comment:


  • NinjaTrader_Ray
    replied
    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.

    Leave a comment:


  • heech
    started a topic Saving strategy "state"

    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?

Latest Posts

Collapse

Topics Statistics Last Post
Started by IanS00, Today, 01:55 PM
1 response
6 views
0 likes
Last Post NinjaTrader_Jesse  
Started by Marble, Today, 05:00 AM
2 responses
19 views
0 likes
Last Post Marble
by Marble
 
Started by wallace15269, 01-16-2025, 12:05 PM
5 responses
98 views
0 likes
Last Post wallace15269  
Started by several, 03-18-2025, 03:53 AM
9 responses
123 views
1 like
Last Post ntwong
by ntwong
 
Started by lkuo.me, 04-09-2017, 09:47 AM
2 responses
1,911 views
0 likes
Last Post coppernob108  
Working...
X