Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Strategy Logic Disconnection / Market Close Questions

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

    Strategy Logic Disconnection / Market Close Questions

    I'm trading at Ninjatrader Brokerage and notice that my strategy disconnects after the market closes which i suspect is normal. Can someone point me to some documentation of what happens to the strategy logic in memory when this happens.

    Given the following scenario.

    The plan is to go long on the ES Futures Friday and carry this until Tuesday where I sell it. Since the strategy disconnects itself will it reconnect where it left off on Sunday. Will the Positions[0] object be accessible on Sunday when the market opens again. What if I created a custom global variable that I’m trying to monitor since the entry on Friday. Will this remain in memory? Is there a function/process that gets run when a strategy disables itself when market closes and when the markets reopen. Any help would be much appreciated.



    #2
    Hello bc24fl,

    Thank you for the post.

    I wanted to clarify, by disconnects do you mean that your connection is disconnected which in turn disabled the strategy?

    In any case if the strategy is being disabled while you have an existing position, the next time you re enable the strategy it would need to utilize its start behavior. Depending on the behavior used will determine if that position can be seen again or not.


    Since the strategy disconnects itself will it reconnect where it left off on Sunday.
    No, if it was disabled you would need to re enable it when you want it to run.

    Will the Positions[0] object be accessible on Sunday when the market opens again.
    Only if your strategy equates the same set of orders/position again as historical. When you start it back up it will now need to re process the bars as historical. So long as the orders and logic executes in the same way as it did before it was disabled, it could resume any orders or positions. This relates to what start behavior is selected, likely immediate submit sync account would be needed.
    What if I created a custom global variable that I’m trying to monitor since the entry on Friday. Will this remain in memory?
    If your strategy is being disabled, all the variable it holds would no longer be able to be referenced. When you re enable it you would need to utilize the start behavior to have it resume what it was doing.

    Is there a function/process that gets run when a strategy disables itself when market closes and when the markets reopen. Any help would be much appreciated.
    The only part which is run when the strategy is disabled would be OnStateChange and its Terminated state. When the market re opens, if the strategy was previously disabled you would now need to re enable it again otherwise nothing should happen and it will remain disabled. Upon starting the script its start behavior is run which can attempt to sync the position.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Sorry I did not mean I disabled the strategy. It makes sense if i disable it i will lose all in memory. My intention is to let the strategy run 24/7 however when the market closes on Friday will it continue to remain in memory on the closed hours of Sat and partial Sun?

      So as long as the strategy stays enabled (even on market closes) I should NOT need to sync account?

      Comment


        #4
        Hello bc24fl,

        Thank you for clarifying.

        Yes that is a different situation, if you are not disconnecting and your strategy is not being disabled, it is still running and is aware of the information it has already collected. The start behavior and the other information i provided would be in the situation where you are either disconnected which in turn also disabled the strategy or where you just disable it yourself. As long as it remains running, it could pick up again once you have market data in the next session.



        I look forward to being of further assistance.

        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Max238, Today, 01:28 AM
        1 response
        23 views
        0 likes
        Last Post CactusMan  
        Started by giulyko00, Yesterday, 12:03 PM
        2 responses
        10 views
        0 likes
        Last Post giulyko00  
        Started by r68cervera, Today, 05:29 AM
        0 responses
        4 views
        0 likes
        Last Post r68cervera  
        Started by geddyisodin, Today, 05:20 AM
        0 responses
        7 views
        0 likes
        Last Post geddyisodin  
        Started by JonesJoker, 04-22-2024, 12:23 PM
        6 responses
        38 views
        0 likes
        Last Post JonesJoker  
        Working...
        X