• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Prevent Stop or Stop Limit orders above the market

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

    Prevent Stop or Stop Limit orders above the market

    I have a strategy that runs pretty well, but at least once a day I get the error message "sell or stop limit order can't be placed above the market". When I get this message, it crashes the strategy and stops it. Is there a way to test against the bid ask, in the case of a stop to prevent placing this kind of order, or modify it before it is placed to prevent crashing the strategy?
    DaveN

    #2
    I'm also concerned about this.

    When I test my script against Market Data Recorded data with CalculateOnBarClose=true, I've noticed the same thing happens if I enter a Stop order correctly but there is coincidentally a gap in the market after that bar and the Stop is then above/below the market at the time the order attempts execution.

    When executing against a real datafeed/broker account, I would be highly surprised if NT would wait for the first tick of the next bar to check this situation. Surely the order is despatched immediately, and the broker would normally just treat it as a Market order if the price had, in the interim, gapped past the stop.

    Any comments?

    Peter

    Comment


      #3
      Hello,


      Yes, you could use a condition like this prior to placing the order to check if the bid/ask are above or below your order price:

      if(my_entry_price < GetCurrentBid())
      {
      //your entry here
      }

      You can also use GetCurrentAsk().
      These links will help:
      http://www.ninjatrader-support.com/H...urrentAsk.html
      http://www.ninjatrader-support.com/H...urrentBid.html
      DenNinjaTrader Customer Service

      Comment


        #4
        Hello together,

        I am working with StopLimitOrders and I use the condition from post #3. So far I get no failure message from NT anymore. But I still have some questions. Which of the following conditions would work probably using StopLimitOrders?

        1. stop_entry_price < GetCurrentBid() -> this works...
        2. stop_entry_price <= GetCurrentBid()
        3. limit_entry_price < GetCurrentBid()
        4. limit_entry_price <= GetCurrentBid()

        Thanks a lot for your help!
        Regards
        Michael

        Comment


          #5
          Michael,

          Those should all be fine.

          Depending on the market when trying to place the Stop order equal to the Bid, it might get rejected.
          This depends on how fast the market is moving up or down in that instance.
          Cal H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by timcjpfx, Today, 06:22 AM
          4 responses
          18 views
          0 likes
          Last Post timcjpfx  
          Started by welson, Today, 08:26 AM
          2 responses
          13 views
          0 likes
          Last Post NinjaTrader_PatrickG  
          Started by brucerobinson, Today, 08:27 AM
          3 responses
          11 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by Leeroy_Jenkins, Today, 07:45 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Started by 1001111, 02-22-2020, 09:10 AM
          5 responses
          41 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X