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.
          JimNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bosajin, Today, 09:51 AM
          2 responses
          7 views
          0 likes
          Last Post bltdavid  
          Started by Newant, Today, 08:13 AM
          2 responses
          26 views
          0 likes
          Last Post Newant
          by Newant
           
          Started by alejandro888, Yesterday, 10:14 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by devro, Yesterday, 07:00 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by mr_trade, Today, 07:13 AM
          0 responses
          18 views
          0 likes
          Last Post mr_trade  
          Working...
          X