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 NullPointStrategies, Today, 05:17 AM
                  0 responses
                  50 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  126 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  69 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  42 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  46 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X