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 NullPointStrategies, Today, 05:17 AM
        0 responses
        50 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X