Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to determine signal names of open position?

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

    How to determine signal names of open position?

    Hello.

    Say, I have position, opened by 3 orders with different names:

    PHP Code:
    
    protected override void OnStateChange()
    {
        if (State == State.SetDefaults)
        {
            Calculate                = Calculate.OnBarClose;
            IsUmanaged             = false;
            EntriesPerDirection        = 10;
            EntryHandling            = EntryHandling.AllEntries;
        }
    }
    
    protected override void OnBarUpdate()
    {            
        if( State != State.Realtime ) return;
        
            EnterLong( 1, "Signal_1" );
            EnterLong( 1, "Signal_2" );
            EnterLong( 1, "Signal_2" );
    } 
    
    How can I determine entries names ("Signal_1", "Signal_2", "Signal_3") from which the position is composed?
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Hello fx.practic,

    Thank you for the post.

    I am reviewing your inquiry and will be back with a reply shortly.

    I look forward to assisting further.

    Comment


      #3
      Hello fx.practic,

      Thank you for your patience.

      To find a signal name, you will need to save your entries as an Order object. The order object has two properties: Name and FromEntrySignal.

      You would access you signal names like so:

      Order anOrder = EnterLong( 1, "Signal_1" );

      Print(anOrder.Name);

      Print(anorder.FromEntrySignal);

      More on the Order object here:


      If we may be of any further assistance, please let us know.

      Comment


        #4
        Thank You.

        I think about this way, but hope it can be done using Position object.

        More logic, more places for great bugs.

        While internally NT still know signals names of opened position.
        fx.practic
        NinjaTrader Ecosystem Vendor - fx.practic

        Comment


          #5
          Hello fx.practic,

          Unfortunately, NinjaTrader does not provide the orders that have contributed to the current position.

          This would need to be stored yourself in a custom coded object such as an array, list, dictionary, etc.
          You would need to add the Order object from OnOrderUpdate() when the order fills, and remove the object when an opposing order using the same fromEntrySignal fills.

          I will submit a feature request on your behalf for the NinjaTrader Development to consider providing a collection of orders that have contributed to the Position.
          Once I have a tracking ID for this request I will post in this thread for future reference.


          antrux,

          I am moving your inquiry to a new thread, as this is unrelated to the current topic.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            NinjaTrader does not provide the orders that have contributed to the current position.

            Can any signal entry name that form the current position be called so that I can just flat that position due to that signal initiated position??

            Comment


              #7
              Hello stantenlee,

              If the entries making up a position have different signal names, each exit order using the from entry signal would only exit the quantity of the entry with that signal name.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                how about if i set two ways to flat my position either by trailingstop or by indicator --exit position, i always found that the position get reverse which meansit get flat and one more position(when i long at start, it hit the stop by indicator and trailstop at same time so that i got one long position flattened and one short position created

                Comment


                  #9
                  Hello stantenlee,

                  I'm not sure I'm understanding your inquiry.

                  However, if you are using multiple exit orders for the same entry order, this could result in both orders filling causing an overfill.


                  Trying to call an exit order and an entry order at the same time will also result in an overfill.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Mindset, 04-21-2026, 06:46 AM
                  0 responses
                  90 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by M4ndoo, 04-20-2026, 05:21 PM
                  0 responses
                  137 views
                  0 likes
                  Last Post M4ndoo
                  by M4ndoo
                   
                  Started by M4ndoo, 04-19-2026, 05:54 PM
                  0 responses
                  68 views
                  0 likes
                  Last Post M4ndoo
                  by M4ndoo
                   
                  Started by cmoran13, 04-16-2026, 01:02 PM
                  0 responses
                  120 views
                  0 likes
                  Last Post cmoran13  
                  Started by PaulMohn, 04-10-2026, 11:11 AM
                  0 responses
                  72 views
                  0 likes
                  Last Post PaulMohn  
                  Working...
                  X