Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Does a strategy remember its position after being disabled?

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

    Does a strategy remember its position after being disabled?

    Let's say for some reason I decide to manually close a long position that has been opened by automated strategy. I disable the strategy so it no longer has control over my position then I submit a sell order and close the position myself. Next time I enable the strategy will it still think I am in a long position since it never closed it? Or will it forget about the position since the strategy was disabled and re-enabled?

    #2
    Hello cory360,

    Thanks for writing in.

    Strategy options in NinjaTrader 7 can be configured to cancel entry orders and exit orders when a strategy gets disabled.

    Other strategy options allow your strategy to attempt to reclaim its positions in the event of a connection loss. These settings involve the On Connection Loss settings and the start behavior.

    The Start Behavior for NinjaScripts is very important to comprehend, so I will refer you to the documentation for in depth understanding. The default behavior is to 'Wait Until Flat' where the strategy will cancel any associated orders without trying to match them. 'Immediately Submit' will attempt to match orders and recover the position.

    All of these settings can be found in the Options window under the Strategies and NinjaScript tabs.

    Please see the documentation listed here as it covers important behavior for NinjaScript strategies.

    Strategies Tab - https://ninjatrader.com/support/help...tegies_tab.htm

    Syncing Account Positions - https://ninjatrader.com/support/help..._positions.htm

    Please let me know if you have any questions on the material.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply.

      I have come across both these documents before in search of my answer and it wasn't really clear to me, hopefully you can clarify.

      For my situation I mentioned earlier, where I might want to disable a strategy to manually close the position myself, without having the strategy think its still in a position upon re-enabling. It sounds like I would need the fourth account syncing settings: Immediately submit live working historical orders, Sync account position = true.

      Is this correct? Is there anything I should be concerned about in this situation?

      Comment


        #4
        Hello cory360,

        Thanks for writing back.

        The setting Immediately submit live working historical orders, Sync account position = true will prevent the strategy from cancelling orders in the event of a reconnect from connection loss.

        If you want to be able to disable a strategy manually without having it cancel the orders it submitted, you will want to have to make sure that the following settings are unchecked:

        Cancel entry orders when a strategy is disabled
        Enables or disables automatically cancelling of the NinjaScript strategy entry orders when a strategy is disabled.

        Cancel exit orders when a strategy is disabled
        Enables or disables automatically cancelling of the NinjaScript strategy exit orders when a strategy is disabled.

        Please let me know if you have any additional questions.
        JimNinjaTrader Customer Service

        Comment


          #5
          So are those account syncing settings right for my situation or would another one be more suited? I'm not too worried about whether or not entry/exit orders are cancelled upon the strategy being disabled.

          Comment


            #6
            Hello cory360,

            Thanks for the post.

            Yes. From what you have described, I believe these are the settings you want to use.

            As the input we give can only be educational, I cannot provide you a direct recommendation for your needs. You can verify these are the settings you want by performing simple tests using the Sim101 account and interrupting your internet connection to observe the behavior.

            If you have any addition questions on start behaviors, please don't hesitate to ask.
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by gemify, 11-11-2022, 11:52 AM
            6 responses
            803 views
            2 likes
            Last Post ultls
            by ultls
             
            Started by ScottWalsh, Today, 04:52 PM
            0 responses
            3 views
            0 likes
            Last Post ScottWalsh  
            Started by ScottWalsh, Today, 04:29 PM
            0 responses
            7 views
            0 likes
            Last Post ScottWalsh  
            Started by rtwave, 04-12-2024, 09:30 AM
            2 responses
            22 views
            0 likes
            Last Post rtwave
            by rtwave
             
            Started by tsantospinto, 04-12-2024, 07:04 PM
            5 responses
            70 views
            0 likes
            Last Post tsantospinto  
            Working...
            X