Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

"“Sell stop or sell stop limit orders can’t be placed above the market" error

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

    "“Sell stop or sell stop limit orders can’t be placed above the market" error


    Folks, I'd like to better understand the resolution for this error:

    “Sell stop or sell stop limit orders can’t be placed above the market. Strategy submitted an order that generated the following error - order rejected....”

    I've seen this issue discussed frequently on the forum. You provide quality responses, which I appreciate. For my code, testing in Playback, I was able to eliminate this error by changing the code from:

    EnterShort()

    to

    EnterShortStopMarket(GetCurrentBid())

    I'm happy to have this fixed, but it still leaves me wondering why this error happens in the first place? Since EnterShort places an order at the market price, then how can the price be submitted above the market price? Thanks,



    #2
    Hello timmbbo,

    Thanks for your post.

    Sell stop and sell stop limit orders must be placed below the current bid price. If they end up being submitted above the market, this error will occur.

    Note if this is due to market volatility then there isn't really a way to 100% avoid this occurring, as in volatile markets the market could move so far and fast that this would occur.

    I would recommend you add prints to the strategy to determine why the stop order error is occurring. One line above where the stop order is placed, print the GetCurrentBid() and print the price being submitted to the order method.

    Below is a link to a forum post that demonstrates using prints to understand behavior.
    https://ninjatrader.com/support/foru...121#post791121

    Something you could consider is using GetCurrentBid() to offset orders so that they are more likely to land on the correct side of the market.

    Or, you could place your stop order further from the current price.

    See the help guide documentation below for more information.

    GetCurrentBid(): https://ninjatrader.com/support/help...currentbid.htm​​
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Dear All from NT8 Support,
      i have the same issue by trying to handle the NFP on 2. August 2024 with my Sim account just for furhter validation and so on. (high vola at the beginning)
      For Long and Short direction i have as follows in my strategy
      right now:
      EnterLong(Convert.ToInt32(DefaultQuantity), @"GetLong" + CurrentBar);
      EnterShort(Convert.ToInt32(DefaultQuantity), @"GetShort" + CurrentBar);

      Then i tried to correct this in both directions according the idea fm timmbbo (EnterShortStopMarket(GetCurrentBid())​)
      in my strategy like this one:
      EnterLongStopMarket(GetCurrentAsk(DefaultQuantity) , @"GetLong" + CurrentBar);
      EnterShortStopMarket(GetCurrentBid(DefaultQuantity ), @"GetShort" + CurrentBar);

      I could this compile but then the strategy did not run or do any trade.
      I know the programming is wrong but im not been able to find the correct one for the programm language here.
      --> Can anybody fm support tell me this or give some hints in the right direction? I just handle 1 contract in every direction.
      Thank you in every case for your help and support!
      BR Gunter

      Comment


        #4
        I think if you enter an order for a Short below the current price, it has to be a Market Stop entry. Opposite for Long order entry above the current price. If you are trying to enter on an extremely fast move, like the ones that happen on important news, I am not sure how close you can get to your designated price for a real trade. A market entry will be placed as close as possible, but not necessarily at the designated price.

        think traders with code that resides on the server can get good (or better) fills for market stop orders. I see the Nasdaq futures move about 100 points in less than one or two seconds, like at 8:30 am ET on Thursday, when important news drops. Such moves must happen with automated trades that process within nanoseconds of the news release. Even then the gyrations can be extreme, in both directions, within a few short seconds.

        Comment


          #5
          Hello Gunter,

          Thank you for your post.

          To understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

          In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition that places an order.

          The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

          The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.

          Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

          Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.

          After enabling TraceOrders remove the instance of the strategy from the Configured list in the Strategies window and add a new instance of the strategy from the Available list.

          I am happy to assist you with analyzing the output from the output window.

          Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

          Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.

          https://support.ninjatrader.com/s/ar...nd-TraceOrders

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          53 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          130 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          70 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          44 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          49 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X