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 argusthome, 03-08-2026, 10:06 AM
    0 responses
    113 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    60 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    40 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    43 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    82 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X