Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimization. An order has been ignored error

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

    Optimization. An order has been ignored error

    Hello. I developed strategy and I am in the middle of optimization. I see lots of errors like
    1/4/2025 4:14:38 PM Default Strategy 'X': An order has been ignored since the stop price ‘18576.75’ near the bar stamped ‘01/22/2024 07:05:00’ is invalid based on the price range of the bar. This is an invalid order and subsequent orders may also be ignored.


    I read lots of topics related to this issue on this forum. On Backtesting I resolved it by adding tick data
    HTML Code:
    AddDataSeries(Data.BarsPeriodType.Tick, 1);
    entering positions like this in OnBarUpdate
    HTML Code:
    entryOrder = EnterShortLimit(1, true, 1, 19000, "EntryShort");
    setting SL in OnExecutionUpdate:
    HTML Code:
    ExitLongStopMarket(1, true, execution.Order.Filled, finalTP, "EntryLongExit", execution.Order.Name);
    and TP:
    HTML Code:
    ExitLongLimit(1, true, execution.Order.Filled, finalSL, "EntryLongTP", execution.Order.Name);

    Now, I expect that finalSL and finalTP should be correct because I am calculating it with execution.Order.AverageFillPrice + TP or execution.Order.AverageFillPrice - SL

    When I am backtesting my strategy, error is gone, but during optimization I still see this error in Logs.

    How can I deal with this?


    Update:
    I have Data Series configured like this both for Backtesting and Optimization
    Price based on: Last
    Type: Minute
    Value: 1

    I can't choose another option because I am loading multiple timeframes in my strategy like 1m, 5m, 15m, 1h and it won't let me
    Last edited by dmaisuradze95; 01-04-2025, 04:04 PM.

    #2
    For those who has the similar issue, I also found this post and testing it now:

    Comment


      #3
      Update:
      As you can see in my original post, adding tick data didn't help in my case.
      Then I also added check that if Close[0] < SL (for longs) I just flatten my position. I know this has nothing to do with this error but it still helps to get better results

      But I still see errors during optimization, on backtesting errors are gone.

      Question:
      Is my data series configuration correct for optimization?
      Price based on: Last
      Type: Minute
      Value: 1​

      What else can I try?

      Comment


        #4
        Hello,

        Simply adding a 1-tick series to the script isn't adding intrabar granularity, for this you would need to actually submit the orders to the 1-tick series.



        You will also need to debug the script to understand why you are hitting this error.

        The message is letting you know that a stop order was ignored because the strategy submitted the order to an invalid price level. Buy stop orders must be placed above the current ask price. Sell stop orders must be placed below the current ask price.

        One line above where the stop order is placed, print the current price and print the price being submitted to the order method.​

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        548 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        323 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        99 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        543 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        545 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X