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

order rejected. above market

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

    order rejected. above market

    i got this message in my orders tab. i'm not sure what it means. i have an exit market order. should i have exit limit order that way its a set defined price. i had 28 ticks slippage in my favor on one trade for profit. but 100 ticks slippage for stop market order not in my favor.
    Attached Files

    #2
    Hello SteveReiza,

    Thank you for your post.

    This message means that the strategy attempted to change an order to the wrong side of the market. Sell stop market orders must be placed below the current Bid price.

    You can use GetCurrentBid() and GetCurrentAsk() to make sure that the price you are submitting or changing the order to is a valid price and on the correct side of the market.

    Help Guide: NinjaScript > Language Reference > Common > Analytical > GetCurrentBid()
    Help Guide: NinjaScript > Language Reference > Common > Analytical > GetCurrentAsk()

    For example, for a sell stop market order:

    Code:
    double stopPrice = Low[0];
    
    if (stopPrice >= GetCurrentBid())
    stopPrice = GetCurrentBid() - TickSize.
    
    EnterShortStopMarket(stopPrice);​
    ​
    This will ensure that your stopPrice is below the current Bid price, by checking is the stopPrice is above the current Bid and if so moving it below.

    Please note that if the error occurred due to market volatility, then there is no way to 100% avoid this occurring, as in volatile markets the market could move so far and fast that this would occur.

    If you are using Set methods, like SetStopLoss(), with CalculationMode.Price please note that these cannot be unset so they will continue to have the previous entry’s price so when a new entry is submitted. This can also cause this error.

    From the Help Guide on SetStopLoss():

    ”Should you call this method to dynamically change the stop loss price in the strategy OnBarUpdate() method, you should always reset the stop loss price / offset value when your strategy is flat otherwise, the last price/offset value set will be used to generate your stop loss order on your next open position.”

    Help Guide: NinjaScript > Language Reference > Strategy > Order Methods > Managed Approach > SetStopLoss()

    Set methods should always be set or reset before the entry is called with CalculationMode.Ticks before calling a new entry. They can then be adjusted to a specific price after the entry fills.

    Please let me know if you have any other questions.
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      thanks for the reply. okay sweet good to know about the bid. i'm dialed in on what i need to do so that doesn't happen again. appreciate the guidance!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by rhyminkevin, Today, 04:58 PM
      3 responses
      47 views
      0 likes
      Last Post Anfedport  
      Started by iceman2018, Today, 05:07 PM
      0 responses
      5 views
      0 likes
      Last Post iceman2018  
      Started by lightsun47, Today, 03:51 PM
      0 responses
      7 views
      0 likes
      Last Post lightsun47  
      Started by 00nevest, Today, 02:27 PM
      1 response
      14 views
      0 likes
      Last Post 00nevest  
      Started by futtrader, 04-21-2024, 01:50 AM
      4 responses
      50 views
      0 likes
      Last Post futtrader  
      Working...
      X