Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stuck historical positions

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

    #16
    Hello Steve R,
    The strategy positions on the historical bars are not appended on the database. The are hold locally withing the strategy and is used for calculating the strategy position.

    If you choose to "return" on the historical bars then you will lose the historical trades.
    JoydeepNinjaTrader Customer Service

    Comment


      #17
      Originally posted by NinjaTrader_Joydeep View Post
      Hello Steve R,
      The strategy positions on the historical bars are not appended on the database. The are hold locally withing the strategy and is used for calculating the strategy position.

      If you choose to "return" on the historical bars then you will lose the historical trades.
      yes, that's what i said - i lose my historical trades.

      what I want is to keep the historical trades, but clear the erroneous entry that is causing the strategy to not trade.

      That's the problem - how do we fix it without ignoring all the historical trades?

      Comment


        #18
        Hello Steve R,
        To assists you further may I know what "On starting a realtime strategy" you are using in Tools>Options>Strategies tab>NinjaScript tab

        If you try using "Immediately submit live working historical orders" then are you able to get it work correctly.
        JoydeepNinjaTrader Customer Service

        Comment


          #19
          I have the default "Wait until flat before executing live" radio button clicked.

          I did see this but was afraid to start clicking around too much and making things worse.

          So if I choose "Immediately submit live working historical orders".......... it will operate as if I am "Flat" when my Strategy starts?

          IE: If it thinks I am long (when I'm not) I don't want it to start to try and close a non-existent position...I want it to start "Clean/Flat".



          Originally posted by NinjaTrader_Joydeep View Post
          Hello Steve R,
          To assists you further may I know what "On starting a realtime strategy" you are using in Tools>Options>Strategies tab>NinjaScript tab

          If you try using "Immediately submit live working historical orders" then are you able to get it work correctly.

          Comment


            #20
            Hello Steve R,
            Your strategy will not be Flat and in such scnario please keep the option "Wait until flat before executing live" checked.

            You have to further custom code your strategy to flatten your strategy position. For example the below code will check the strategy position when you are live for once and flatten your strategy position.

            Code:
            //in variable
            bool checkPos = true;
            
            //in OnBarUpdate
            if (Historical == false && checkPos == true)
            {
                checkPos = false;
            
                if (Position.MarketPosition == MarketPosition.Long)
                ExitLong();
                else if (Position.MarketPosition == MarketPosition.Short)
                ExitShort();
            }
            JoydeepNinjaTrader Customer Service

            Comment


              #21
              Ahh! excellent.

              Very nice.

              Thanks!




              Originally posted by NinjaTrader_Joydeep View Post
              Hello Steve R,
              Your strategy will not be Flat and in such scnario please keep the option "Wait until flat before executing live" checked.

              You have to further custom code your strategy to flatten your strategy position. For example the below code will check the strategy position when you are live for once and flatten your strategy position.

              Code:
              //in variable
              bool checkPos = true;
              
              //in OnBarUpdate
              if (Historical == false && checkPos == true)
              {
                  checkPos = false;
              
                  if (Position.MarketPosition == MarketPosition.Long)
                  ExitLong();
                  else if (Position.MarketPosition == MarketPosition.Short)
                  ExitShort();
              }

              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