Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order Lists

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

    Order Lists

    Code:
    protected override void OnOrderUpdate(Order order ...)
    		{
    			if (order.Name.StartsWith("LimOrd"))
    			{
    				if (order.OrderState == OrderState.Accepted)
    				{
    					//add order to list
    				}
    				else if (order.OrderState == OrderState.Cancelled)
    		  		{
    					//how do I find which order to remove from the list?
    				}
    			}
    		}

    #2
    Hello delTik,

    Thank you for your post.

    So we may provide assistance on this matter please clarify what you are referring to as the order list and how you add objects to that list.

    Comment


      #3
      apologies

      public List<Order> orderList = new List<Order>();

      perhaps I could use FromEntrySignal and remove it using a predicate? but not sure how?

      does this look ok?

      orderList.RemoveAll(Order => Order.FromEntrySignal == execution.Order.FromEntrySignal);
      Last edited by delTik; 05-12-2016, 07:43 AM.

      Comment


        #4
        Hello,

        If you are trying to remove elements from a list like this you certainly can, you could check that the order object is equal to the execution.order object or check if the signal name is the same.

        You can use standard C# items in NinjaScript as it is just C#.

        The best way to determine if this works is to just try it and ensure it both compiles and completes the expected action.

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        45 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        30 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        99 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        177 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        170 views
        0 likes
        Last Post CarlTrading  
        Working...
        X