Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

StopLoss/ProfitTarget causing 'orders can't be placed above the market' Error

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

    StopLoss/ProfitTarget causing 'orders can't be placed above the market' Error


    Hi

    I'm using Strategy Builder to create a strategy that I'm running on Renko charts and am using playback for testing. I am entering using market orders, which appears to work fine. However, I keep intermittently getting the error about order being rejected because stop or limit orders can't be placed below the market, when my stop loss or profit target are hit and can't seem to find a way to handle these neatly to prevent them from happening.

    When using a profit target (ticks), I get errors like

    The OCO ID ‘477586e8473f4c099a8898e5578b0e76’ cannot be reused. Please use a new OCO ID. affected Order: BuyToCover 1 Limit @ 20382.25,
    ​Order rejected' Native error='Buy stop or buy stop limit orders can't be placed below the market.

    or with a stop loss

    Order,Playback101 Sell stop or sell stop limit orders can't be placed above the market. affected Order: Sell 1 StopMarket @ 20338,
    Order='94c1d518d2c343e5a3ed33c245d4 88fa/Playback101' Name='Stop loss' New state='Rejected' Instrument='MNQ SEP24' Action='Sell' Limit price=0 Stop price=20338 Quantity=1 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='Order rejected' Native error='Sell stop or sell stop limit orders can't be placed above the market.',
    Order='94c1d518d2c343e5a3ed33c245d4 88fa/Playback101' Name='Stop loss' New state='Submitted' Instrument='MNQ SEP24' Action='Sell' Limit price=0 Stop price=20338 Quantity=1 Type='Stop Market' Time in force=GTC Oco='' Filled=0 Fill price=0 Error='No error' Native error=''

    I'm running the strategy with high order resolution, set to Tick. Is there anything else I should be doing, to prevent this error from occurring?

    Thanks
    Dan​




    #2
    Hello Dan,

    As this script is created with the Strategy Builder, may I confirm that you are using Calculation mode set to Ticks, Currency, or Percent with the Stop losses?

    May I have a screenshot of the stop loss you have setup?

    Typically I would only expect this behavior when attempting to use a Calculation mode Price.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      Thanks for coming back to me. Here is a screenshot, I'm only using Ticks for the calculation mode, although I am using an input variable for the value.

      Click image for larger version

Name:	2024-07-18_18-33-37.png
Views:	85
Size:	69.6 KB
ID:	1311143

      Regards
      Dan

      Comment


        #4
        Hello Dan,

        What value is the StopLoss variable assigned?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          For this test, the value was set to 32

          Comment


            #6
            Hello Dan,

            Hmm that doesn't sound like it would can an issue.

            Would you be ok with posting the script so I can test on my end?

            To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
            1. Click Tools -> Export -> NinjaScript Add-on...
            2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
            3. Click the 'Export' button
            4. Enter the script name in the value for 'File name:'
            5. Choose a save location -> click Save
            6. Click OK to clear the export location message
            By default your exported file will be in the following location:
            • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
            Below is a link to the help guide on Exporting NinjaScripts.


            Once exported, please attach the file as an attachment to your reply.​
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea

              From having done a bit more testing this morning, I think the problem was happening if the strategy was triggered by a large price movement during a news event. The price moves so quickly that it passes the stop loss, before it's set.

              I presume that there's no much I can do about this, other than disabling the strategy during news events?

              Regards
              Dan

              Comment


                #8
                Hello Dan,

                You can choose to not trade during new events.

                Or you could use a much greater tick distance.

                Or you could unlock the script and add logic to ensure the sell stop price is below the bid.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Today, 05:17 AM
                0 responses
                44 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                124 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                65 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