Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Limit Orders

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

    Stop Limit Orders

    I am using the EnterLongStopLimit order above the market, which works fine all of the time when the order is entered.

    However, sometimes after the order has been successfully entered, I get the message "buy stop limit orders can't be placed above the market". My strategy always puts the order in above the market, but it looks like if the spread is large and the price jumps past my limit price that the error occurs. How do I prevent that?

    thanks

    #2
    Hello,

    Thanks for the note.

    The only way really to prevent that is to detect the large spread and submit the order higher unfortunately based on the bid or ask price depending on which direction you are going long or short. This error would be a rare case where the broker does not submit the order unless its higher then current price and your strategy would mean you need to submit it higher then the current price.

    The only way to ensure this happens or lessen the chances of this error is to submit the order with a larger gap, usually padding an extra tick to the order submit price will do the trick here from the ask or bit depending on what direction your placing orders.

    The other thing you can do is code in some advanced error handling to detect the error and take some action to resubmit the order however this would be advanced programming. Let me know if you would like me to send you the information on this.

    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Hi Brett,
      Thanks for the explanation. Could you please send me the code for the advanced error handling.

      Comment


        #4
        astrolobe, to catch the rejection in your code you would need to work with disabled RealtimeErrorHandling:

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          astrolobe, to catch the rejection in your code you would need to work with disabled RealtimeErrorHandling:

          http://www.ninjatrader.com/support/h...orhandling.htm
          The example includes this line:

          "if (stopLossOrder != null && stopLossOrder.Token == order.Token)"

          I thought I read somewhere that we're not supposed to compare the Tokens anymore which would make the correct code something like this:

          "if (stopLossOrder != null && stopLossOrder == order)"

          Is that right?

          Comment


            #6
            Thanks for the spot, KBJ. We will correct this in the next version.
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            649 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            370 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            109 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            574 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            576 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X