Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to make strategy understand it's out of sync with the account when running live?

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

    How to make strategy understand it's out of sync with the account when running live?

    I want for my strategy to submit orders and manage stop/exits automatically.

    I also want to manually add additional orders live in the same direction, and move a stop/target order around to exit a strategy position.

    If that stop or target order is hit, I want my strategy to move to "out of sync behaviour" where it submits a virtual order to exit when strategy would normally which shows up on the chart like when the strategy is started after it would have entered (in wait till flat mode).

    But at no time, do I want an "exit" order from the strategy to execute live if the account position is flat.

    What's the best way to accomplish this? Currently after every exit manually, I have to stop strategy, and then reenable otherwise the strategy managing the virtual position will enter when it's thinking it should exit.

    Thanks,
    Joe

    #2
    Hello joejoeagogo,

    I also want to manually add additional orders live in the same direction, and move a stop/target order around to exit a strategy position.

    This specifically is not something a Strategy can handle. Strategies don't manage manual orders/positions.


    The strategies existing sync behaviors only work when it first starts, its part of the strategies start behavior. The start behavior is intended to manage existing strategy submitted orders/positions and not manual orders/positions.

    https://ninjatrader.com/support/help...ighlightsub=be have

    What's the best way to accomplish this? Currently after every exit manually, I have to stop strategy, and then reenable otherwise the strategy managing the virtual position will enter when it's thinking it should exit.


    The best way to accomplish working with manual orders or positions is to avoid using a strategy at all, strategies are not intended to work with manual changes. You could use an Indicator for that type of use case with the Addon framework. https://ninjatrader.com/support/help...ount_class.htm

    Comment


      #3
      How can a strategy check if it's not in sync with the account position?

      Comment


        #4
        Hello joejoeagogo,

        A strategy can use its start behavior for that but that only applies if the strategy created that position. Manual positions cant be resumed by a strategy, the strategy needs to have created that position originally.

        Comment


          #5
          Is there a way to determine the account position from within the strategy? Even if it's just Flat/Long/Short?
          Last edited by joejoeagogo; 12-16-2022, 04:46 PM.

          Comment


            #6
            Hello joejoeagogo,


            A strategy can observe the account position however that has no effect on making it be in sync or how the start behavior works. If the strategy needs to manage the position you would still have to have the strategy originally create that position. The PnL and other strategy properties won't be aware of a manually opened position so it won't display accurate results if its not creating the position its self.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            64 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            139 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            75 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            45 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            50 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X