Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

No suitable method found to override (OnOrderUpdate)

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

    No suitable method found to override (OnOrderUpdate)

    Hi NT Team,

    I have a strategy with 2 entries. When entry 1 closes, I want entry 2 to move to breakeven. I am getting the referenced error when compiling. Hoping you can point out something obvious I am doing wrong.

    Thank you!

    Code:
    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;
    
    if (CurrentBars[0] < 1)
    return;
    
    // Check if L1 position is closed
    if (Position.MarketPosition != MarketPosition.Long && L1Closed == false && entryPriceL1 > 0)
    {
    L1Closed = true;
    // Move L2 to breakeven
    ExitLongStopMarket(1, entryPriceL1, "Move to BE", "L2");
    }
    
    // Set 1
    if (CrossBelow(Low, SamriMathRTIntradayV21.Minus18, 1))
    {
    EnterLong(1, @"L1");
    entryPriceL1 = Close[0];
    L1Closed = false;
    }
    
    // Set 2
    if (entryPriceL1 > 0 && Close[0] <= entryPriceL1 - 80 * TickSize)
    {
    EnterLong(1, @"L2");
    }
    }
    
    protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time)
    {
    if (orderState == OrderState.Filled && order.Name == "L1" && order.OrderAction == OrderAction.Sell)
    {
    // When L1 closes, move L2 to breakeven
    if (Position.MarketPosition == MarketPosition.Long && Position.Quantity == 1)
    {
    ExitLongStopMarket(1, entryPriceL1, "Move to BE", "L2");
    }
    }
    }

    #2
    Hello quicksandatl,

    The code you have for the OnOrderUpdate method is not correct, the method is missing some parameters. You need to use override methods with all of the parameters they require, you can see an example in the following page of the correct syntax.




    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    87 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    128 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    65 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    117 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X