Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

No signalName prints on chart when multiple order.Name ==

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

    No signalName prints on chart when multiple order.Name ==

    The 3 orders below execute but no signalName gets printed on the chart.

    What's way to get the Signal Names printed on the chart?

    Code:
    protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time, ErrorCode error, string nativeError)
    {​
    
                    if ( order.Name == @"ENTRYLONG #1/5"
                        || order.Name == @"ENTRYLONG #1/4"
                        || order.Name == @"ENTRYLONG #1/3"
                        || order.Name == @"ENTRYLONG #1/2"
                        || order.Name == @"ENTRYLONG #1/1"
                        )
                    {    
                        entryLgOrder1 = order;
    
    
                        // Reset the entryLgOrder object to null if order was cancelled without any fill
                        if (order.OrderState == OrderState.Cancelled && order.Filled == 0)
                        {
                            entryLgOrder1 = null;
                                        
                        }
                    }
                    if ( order.Name == @"ENTRYLONG #2/5"
                        || order.Name == @"ENTRYLONG #2/4"
                        || order.Name == @"ENTRYLONG #2/3"
                        || order.Name == @"ENTRYLONG #2/2"
                        || order.Name == @"ENTRYLONG #2/1"
                        )
                    {    
                        entryLgOrder2 = order;
    
    
                        // Reset the entryLgOrder object to null if order was cancelled without any fill
                        if (order.OrderState == OrderState.Cancelled && order.Filled == 0)
                        {
                            entryLgOrder2 = null;
                                        
                        }
                    }
                    if ( order.Name == @"ENTRYLONG #3/5"
                        || order.Name == @"ENTRYLONG #3/4"
                        || order.Name == @"ENTRYLONG #3/3"
                        || order.Name == @"ENTRYLONG #3/2"
                        || order.Name == @"ENTRYLONG #3/1"
                        )
                    {    
                        entryLgOrder3 = order;
    
    
                        // Reset the entryLgOrder object to null if order was cancelled without any fill
                        if (order.OrderState == OrderState.Cancelled && order.Filled == 0)
                        {
                            entryLgOrder3 = null;
                                        
                        }
                    }​
    }
    }​
    Code:
            protected override void OnExecutionUpdate(Cbi.Execution execution, string executionId, double price, int quantity,
                Cbi.MarketPosition marketPosition, string orderId, DateTime time)
            {
                if (entryLgOrder1 != null && entryLgOrder1 == execution.Order)
                {
                    if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
                    {
                        Entry_Lg_Prices.Add(execution.Order.AverageFillPrice);
                    }
                }
                if (entryLgOrder2 != null && entryLgOrder2 == execution.Order)
                {
                    if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
                    {
                        Entry_Lg_Prices.Add(execution.Order.AverageFillPrice);
                    }
                }
                if (entryLgOrder3 != null && entryLgOrder3 == execution.Order)
                {
                    if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
                    {
                        Entry_Lg_Prices.Add(execution.Order.AverageFillPrice);
                    }
                }​
    Code:
    protected override void OnBarUpdate()
    {​
    if ( Cond1 )
    {
    EnterLong(Convert.ToInt32(Qty1), @"ENTRYLONG #1/3");
    EnterLong(Convert.ToInt32(Qty2), @"ENTRYLONG #2/3");
    EnterLong(Convert.ToInt32(Qty3), @"ENTRYLONG #3/3");
    }​
    }

    #2
    Seems fixed.
    The ExitLong() method needs to have the same SignalName as the EnterLong() method for the SignalName to plot on the chart.
    If distinct it doesn't plot on the chart:

    This does not plot:

    EnterLong(Convert.ToInt32(Qty1), @"ENTRYLONG #1/3");
    EnterLong(Convert.ToInt32(Qty2), @"ENTRYLONG #2/3");
    EnterLong(Convert.ToInt32(Qty3), @"ENTRYLONG #3/3");​

    ...


    if ( ExitLong1stCondition )
    {
    ExitLong(Convert.ToInt32(Qty1),"EXITLONG #1/5", "ENTRYLONG #1/5");
    }
    if ( ExitLong2ndCondition )
    {
    ExitLong(Convert.ToInt32(Qty2),"EXITLONG #2/5", "ENTRYLONG #2/5");
    }
    if ( ExitLong3rdCondition )
    {
    ExitLong(Convert.ToInt32(Qty3),"EXITLONG #3/5", "ENTRYLONG #3/5");
    }​



    Fix:

    EnterLong(Convert.ToInt32(Qty1), @"ENTRYLONG #1/3");
    EnterLong(Convert.ToInt32(Qty2), @"ENTRYLONG #2/3");
    EnterLong(Convert.ToInt32(Qty3), @"ENTRYLONG #3/3");​

    ...


    if ( ExitLong1stCondition )
    {
    ExitLong(Convert.ToInt32(Qty1),"EXITLONG #1/5", "ENTRYLONG #1/3");
    }
    if ( ExitLong2ndCondition )
    {
    ExitLong(Convert.ToInt32(Qty2),"EXITLONG #2/5", "ENTRYLONG #2/3");
    }
    if ( ExitLong3rdCondition )
    {
    ExitLong(Convert.ToInt32(Qty3),"EXITLONG #3/5", "ENTRYLONG #3/3");
    }​​

    Comment


      #3
      Hello PaulMohn,

      This is correct, the From entry signal of an exit order must match the Signal name of the entry. If the exit order From entry signal does not match the Signal name of any entries the order will not be submitted.
      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