Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error "Buy stop or buy stop limit orders can't be placed below the market"

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

    Error "Buy stop or buy stop limit orders can't be placed below the market"

    Hi. I am developing simple strategy using built-in methods (SetStopLoss and EnterShortLimit) for OCO support and I faced the following issue:

    When I am testing my strategy via Market Replay on ES 12-20 Futures, timeframe is 5 min Heiken-Ashi, then 4.11.2020 the strategy always generates the error "Buy stop or buy stop limit orders can't be placed below the market". I included simplified script to reproduce the error.

    When I was debugging the script, I found that the Short entry got filled at price 3415 and the Stop Loss order should be being placed at 2416 but current bid & ask prices are 3416,75 and 3417,25 respectively.

    Seems that there is some data issue but the problem is in the platform behavior: the strategy stops but the main order stays active without stop loss and profit target. So I have two questions:
    1. How to fix this data issue?
    2. Can I somehow prevent strategy to be stopped (for example, to bypass the error or set the custom handler for this error to automatically close active position)?
    Attached Files

    #2
    Hello alvik48,

    Thanks for your post.

    For reference, what time zone are you in?

    Are you able to hit that error with more recent data using ES 06-21?

    You can use RealTimeErrorHandling to keep the strategy running and to trap rejected orders in OnBarUpdate(). Please see the example here: https://ninjatrader.com/support/help...orhandling.htm

    Comment


      #3
      My timezone is UTC+1. I didn't try to reproduce this issue on a more recent data but I think the problem is with the data (maybe, few lost ticks).

      Comment


        #4
        Hello alvik48,

        Thanks for your reply.

        We don't store market replay data beyond 90 days so I could not advise on the data from November 4, 2020.


        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        93 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        138 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        123 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        73 views
        0 likes
        Last Post PaulMohn  
        Working...
        X