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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      43 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      20 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      30 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      47 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      38 views
      0 likes
      Last Post CarlTrading  
      Working...
      X