• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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;
        
            
    EnterLong1"Signal_1" );
            
    EnterLong1"Signal_2" );
            
    EnterLong1"Signal_2" );

    How can I determine entries names ("Signal_1", "Signal_2", "Signal_3") from which the position is composed?

    #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.
    Chris L.NinjaTrader Customer Service

    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:
      https://ninjatrader.com/support/help...-us/?order.htm

      If we may be of any further assistance, please let us know.
      Chris L.NinjaTrader Customer Service

      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.

        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.
          https://ninjatrader.com/support/foru...jascript-strat
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by TazoTodua, Today, 06:00 AM
          0 responses
          7 views
          0 likes
          Last Post TazoTodua  
          Started by Thans1946, Today, 04:04 AM
          0 responses
          5 views
          0 likes
          Last Post Thans1946  
          Started by gbux11, Today, 02:36 AM
          0 responses
          8 views
          0 likes
          Last Post gbux11
          by gbux11
           
          Started by fx.practic, Today, 01:47 AM
          0 responses
          13 views
          0 likes
          Last Post fx.practic  
          Started by bneccv, Yesterday, 09:25 PM
          0 responses
          5 views
          0 likes
          Last Post bneccv
          by bneccv
           
          Working...
          X