Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

my acct and start position drift

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

    my acct and start position drift

    I’m running a custom NinjaTrader 8 strategy on a combine propfirm account, and it frequently gets out of sync with the real account position.it is a renko chart i am using. Sometimes the account is flat, but the strategy still thinks it’s in a long or short, preventing new trades or causing incorrect exit signals. I’ve tried enabling “Sync Account Position,” but the mismatch persists. The only way to fix it so far is to disable and re-enable the strategy, which isn’t practical. Has anyone encountered a similar issue or found a reliable way to keep the strategy’s internal position tracking aligned with the actual account position? it works for 1 trade after i re enable it but falls out of sync after the first exit

    #2
    Hello ronniecorrigan,

    Are you running a single strategy? Also are you using the strategy based methods like EnterLong to submit orders? Was the exit done by the strategy?
    JesseNinjaTrader Customer Service

    Comment


      #3
      Yes, I am running a single strategy, and I am using the built-in strategy methods like EnterLong and ExitLong to submit orders. The exits are also handled by the strategy using ExitLong and ExitShort. However, the issue is that sometimes the strategy thinks it is in a position when the account is actually flat, or vice versa. This prevents new trades from being taken or causes incorrect exit signals. I have “Sync Account Position” enabled, but the issue persists. Do you have any recommendations on how to ensure the strategy stays in sync with the actual account position?

      Here is the relevant code for entries and exits:

      // Entry logic: Only enter if flat
      if (Position.MarketPosition == MarketPosition.Flat)
      {
      if (longCond)
      EnterLong(1, "Long");
      else if (shortCond)
      EnterShort(1, "Short");
      }

      // Exit logic: Send an exit order if conditions are no longer met
      if (Position.MarketPosition == MarketPosition.Long && !longCond)
      ExitLong("ExitLong", "Long");

      if (Position.MarketPosition == MarketPosition.Short && !shortCond)
      ExitShort("ExitShort", "Short");


      Given that I am using NinjaTrader’s built-in strategy execution methods (EnterLong, EnterShort, ExitLong, ExitShort), is there a known issue with position desynchronization in live trading​

      Last edited by ronniecorrigan; 03-18-2025, 02:17 AM.

      Comment


        #4
        Hello ronniecorrigan,

        In that case you would need to look at the executions to get a better idea of what is differing. The sync simply shows if the strategy position is the same as the accounts but you would only be able to tell how its falling out of sync by comparing the account executions vs the strategies.
        JesseNinjaTrader Customer Service

        Comment


          #5
          ​hi there so that is the chart when the exit was triggred as you can seee it just closes the posistion

          Comment


            #6
            then here are the corresponding logs, the top 2 are when i turned the strat on and off so it re syncs ​at this point the strat was flat but the posistion was showing short 1 even tho the account was flat
            Click image for larger version

Name:	image.png
Views:	20
Size:	44.1 KB
ID:	1338053

            Comment


              #7
              Hello ronniecorrigan,

              Looking at the chart won't really help, you would have to compare the strategy executions against the account executions. Do the strategies executions match the account executions?
              JesseNinjaTrader Customer Service

              Comment


                #8
                same thing happened again even here is the chart and the screen shot showing the posistion status even tho the account is in no trade with the logs
                Attached Files

                Comment


                  #9
                  hi sorry where would i find those 2 bits of infomation

                  Comment


                    #10
                    hi so in the excutions tab they match however it is in the stratergys tab where the strat window thinks the account is out of sync

                    Comment


                      #11
                      Hello ronniecorrigan,

                      You can look in the trade performance window to see the executions on the account which will include that strategies executions. You can then compare that to the strategies performance report by right clicking on the strategy in the strategies tab and viewing its report. For the account to be in sync the account needs to see the same executions that the strategy did for the period of time the strategy was running. For example if the strategy is enabled and is flat, the the account is flat they will be in sync. If the strategy is trading and any manual trades happen it will be out of sync.
                      JesseNinjaTrader Customer Service

                      Comment


                        #12
                        so the excicutions look to be the same however after the stratergy tab looks like this out of sync. so the logic is correct for exiting a trade and it works fine on sim however it loses sync on my combine account

                        Click image for larger version

Name:	image.png
Views:	20
Size:	15.3 KB
ID:	1338078Click image for larger version

Name:	image.png
Views:	20
Size:	7.8 KB
ID:	1338076Click image for larger version

Name:	image.png
Views:	20
Size:	12.0 KB
ID:	1338077​​​
                        Attached Files

                        Comment


                          #13
                          it seems to think we are still in the ornigal short

                          Comment


                            #14
                            Hello ronniecorrigan,

                            Did you check the strategies performance report specifically? You need to right click on the strategy -> strategy performance -> realtime to compare against the account performance tab. If the strategy has any different orders it will not be in sync.
                            JesseNinjaTrader Customer Service

                            Comment


                              #15
                              hi there i think its just a display error the orders seem to match up okay and run correctly

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by iantriestrading, Today, 11:55 AM
                              5 responses
                              12 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by rexsole, 04-21-2025, 01:46 PM
                              4 responses
                              47 views
                              0 likes
                              Last Post terminatorT1000  
                              Started by monpere, 06-20-2008, 03:11 PM
                              15 responses
                              2,219 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by dadarara, Today, 11:44 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post dadarara  
                              Started by g0sty, Today, 09:24 AM
                              7 responses
                              22 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Working...
                              X