Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sync position after restart Strategy

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

    Sync position after restart Strategy

    NT8 provides several following syncing methods but I still need more guidelines.
    https://ninjatrader.com/support/help...rtbehavior.htm

    Here is the scenario: if I have bought 100 shares of IBM stocks either using Strategy or manually, then for any reason, I restarted Strategy. How can I apply my Strategy to sell these 100 (sh) of IBM? Is it possible to use ExitLongLimit() anymore?

    If it is possible that Strategy can obtain this existing 200 share of IBM in my real account, can ExitLong() be used here to sell this 200 (sh) of IBM?
    Last edited by localappleseed; 09-17-2020, 09:58 AM.

    #2
    Hello localappleseed,

    Thank you for your post.

    This could be achieved by specifically programming the strategy to be able to adopt the account position.





    I'm attaching an example strategy made by one of my colleagues that will detect if there is an open position on the account for the instrument the strategy is applied to and submit stop loss/profit target orders to protect that position that should be helpful.

    Please let us know if we may be of further assistance to you.
    Attached Files

    Comment


      #3
      This is so cool! Thanks a lot.

      Comment


        #4
        Hi, Kate,

        I tried to test this sample code you provided while there is a pending buying order submitted through SuperDOM. It looks like it didn't catch this pending position, is there anything I may have missed?

        protected override void OnBarUpdate()
        {

        if(State ==State.Historical) return;
        Print(State.ToString()+PositionsAccoun t[0].Quantity.ToString());
        Print(PositionsAccount[0].MarketPosition.ToString());


        Here are the outputs:
        Positions in State.DataLoaded:
        Positions in State.DataLoaded:

        Comment


          #5
          Hello localappleseed,

          Thank you for your reply.

          It would not be expected that an unfilled order would be recognized using Adopt Account Position - in fact, if you try to enable the strategy with a pending buy order you should see an error message pop up telling you that it cannot enable the strategy as "Adopt Account Position" requires that there are no working/pending orders on the strategies' instruments in that account.

          Please let us know if we may be of further assistance to you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          50 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          126 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          69 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          42 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X