Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

be notified when a position is open

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

    be notified when a position is open

    Hi, I am trying to be notified when a position is opened (or closed) on an indicator.

    I have also been trying to do it with a strategy using OnPositionUpdate or OnOrderUpdate but both show that the current position is Flat. I also tried getting the ATM strategy and accessing the MarketPosition property but nothing. Your help is greatly appreciated.

    #2
    Unfortunately this cannot be done from an indicator.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I couldn't do it from a strategy either. OnPositionUpdate had its MarketPosition as flat.

      Comment


        #4
        aversano, can you please post the code you used to check market position? OnPositionUpdate() should give you the correct position.
        AustinNinjaTrader Customer Service

        Comment


          #5
          the MarketPosition is always flat. here is my code

          protected override void OnPositionUpdate(IPosition position)
          {
          if(position.MarketPosition != MarketPosition.Flat){*/
          drawIndicator = true;
          if(position.MarketPosition== MarketPosition.Long){
          isLong = true;
          }
          else{
          isLong = false;
          }
          }
          else{
          /*do something*/
          }
          }

          Comment


            #6
            aversano, just to double check, your strategy is actually taking trades right? If so, please try the bare minimums to make sure your installation is functioning correctly:
            Code:
            protected override void OnPositionUpdate(IPosition position)
            {
            Print(position.ToString());
            }
            AustinNinjaTrader Customer Service

            Comment


              #7
              No, the strategy isn't submitting the trades. I submit them manually using the dynamic super dom and utilize the strategy to plot things on the chart while in a trade (at least trying to)

              Comment


                #8
                aversano, strategies only know about what is going on with itself. Thus, it isn't possible for a strategy to know what is going on outside the strategy.

                Any trades submitted by the super DOM or anything else like that will not be seen by strategies.

                So, in short, what you're trying to do isn't possible.
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  Isn't there a way through an indicator, a strategy or something else to be notified when a position is opened/closed? There has to be a way... that's pretty trivial don't you think?

                  Comment


                    #10
                    Like I said, a strategy can easily keep track of positions opened by itself. Indicators are indicators; they don't trade so they shouldn't care what the position is. Other than that, there aren't many options.
                    AustinNinjaTrader Customer Service

                    Comment


                      #11
                      If there is an ATM strategy in place after opening a position(using the DOM) is there a way to access this ATM strategy and checking the position status?

                      Comment


                        #12
                        There is not a way to access an ATM strategy created via the DOM.
                        AustinNinjaTrader Customer Service

                        Comment


                          #13
                          Is there a way maybe to access ZenFire from the strategy and be notified when a position is opened?

                          Comment


                            #14
                            aversano, there are many ways to retrieve the position state but none would be easy or fast (or cheap) to code.

                            Since you mentioned Zen-Fire, you could go as far as obtaining the Zen-Fire API (completely different from NT) from the developers, creating your own application that utilizes said API, then this application could just sit and "listen" to changes on your account. All this would be separate from NT, of course. Then you'd have to integrate the results from your own program into your strategy via a bit of cross-application communication.

                            Another option would be to whip up a Python (or C#) script that continuously polls the ATI for order status. You'd have to create the proper methods and such that would create a "net position" from order fills (much harder than it sounds), but it sure is possible.
                            AustinNinjaTrader Customer Service

                            Comment


                              #15
                              How can I query the ATI from the strategy? I can create a thread that will do that or use the OnBarUpdate method

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              578 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              334 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              553 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              551 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X