Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    Paul H.NinjaTrader Customer Service

    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.


        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by lorem, Today, 09:18 AM
        1 response
        4 views
        0 likes
        Last Post lorem
        by lorem
         
        Started by bmartz, Today, 09:30 AM
        0 responses
        3 views
        0 likes
        Last Post bmartz
        by bmartz
         
        Started by GussJ, 03-04-2020, 03:11 PM
        14 responses
        3,244 views
        0 likes
        Last Post GussJ
        by GussJ
         
        Started by ArkansasClint, Today, 09:28 AM
        0 responses
        0 views
        0 likes
        Last Post ArkansasClint  
        Started by hazylizard, Today, 08:38 AM
        4 responses
        12 views
        0 likes
        Last Post hazylizard  
        Working...
        X