• 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 Vincere, Yesterday, 11:20 PM
          0 responses
          5 views
          0 likes
          Last Post Vincere
          by Vincere
           
          Started by lMagi, 05-18-2019, 09:34 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_ChrisSch  
          Started by uday12, Yesterday, 10:26 PM
          0 responses
          3 views
          0 likes
          Last Post uday12
          by uday12
           
          Started by uday12, Yesterday, 10:07 PM
          0 responses
          0 views
          0 likes
          Last Post uday12
          by uday12
           
          Started by Nabil, Yesterday, 07:46 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X