Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Detect flat market with OnExecutionUpdate or OnPositionUpdate

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

    Detect flat market with OnExecutionUpdate or OnPositionUpdate

    Hello

    I am using the Addons Framework to develop an Addons with which to copy operations from one account to another. I have enough advance but I need some help with something.

    I need to check when the account is flat with no trades. I am using the syntax in OnExecutionUpdate or OnPositionUpdate:
    Code:
    private void OnExecutionUpdate(object sender, ExecutionEventArgs e)
    {
         if (e.MarketPosition == MarketPosition.Flat)
         {
          marketflat == true;
         }
    }
    to store a variable that is updated depending on whether the market is flat or not. But I can't get this variable to change state as there is no event that calls my OnExecutionUpdate method.

    Please, could you help me to know how to automatically detect if an account is flat

    #2
    Doesn't OnPositionUpdate get notified when the Position is Flat?

    Comment


      #3
      Hi vltdavid

      Please, eliminate this post. I already saw how to work. Thank you.

      Comment


        #4
        Hello everyone

        I have not been able to use OnPositionUpdate to find out if the market is flat with some accounts. If I try with the data from Ninjatrader Continuum, it returns the Flat value when the position is canceled and enters the condition that I share below, but if I try to follow the same steps with the Uprofit account, the Market Flat value is not returned and does not enter the condition.
        Does anyone know what may be happening here?

        I am using the following code:
        Code:
        private void OnPositionUpdate(object sender, PositionEventArgs e)
        {
             totalposition = e.Position.Quantity;
        
             if (e.MarketPosition == MarketPosition.Flat) //Used to do something in OnOrderUpdate
             {
                  Dispatcher.InvokeAsync(() =>
                  {
                     bool slaveAccountFlat = true;
                     entryOrder = null; 
                     outputBox.AppendText(string.Format("{0}C. Esclava | 2. Flat | N° de Posiciones canceladas= {1}", Environment.NewLine, totalposition));
                      if (entryOrder == null)
                      {
                          outputBox.AppendText(string.Format("C. Esclava | 2. Variable 'entryOrder' Null."));
                      }
                  });
             }
        }

        Comment


          #5
          Hello jleira,

          Thanks for your post.

          There is an existing issue with Rithmic based connections where PositionUpdates were not properly reporting a flat position. This has been addressed in Release 24. I cannot offer an ETA on when the new build will be available, but it will be available soon. Ticket ID NTEIGHT-14707.

          The number for the ticket ID will be listed in the Release Notes page of the Help Guide when Release 24 becomes available.

          Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

          I also tested this earlier today and can share that Release 24 is identifying the flat position properly.

          We look forward to assisting.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          648 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          574 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X