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

Invalid Order price when using ExitShortStopMarket and ExitLongStopMarket

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

    Invalid Order price when using ExitShortStopMarket and ExitLongStopMarket

    Hi

    I want to understand the behavior of ExitShortStopMarket, ExitLongStopMarket

    ----
    1. Suppose the current market OHLC bar is 72.90, 73.59, 72.15, 72.73, and I am currently Long +5 contracts. If I issue an order using ExitLongStopMarket at a price of 72.88 for the next bar, my order is rejected. I did not try to open any Short position, but only to close the Long position.

    This is the error that is printed:

    7/11/2018 11:00:00 AM Strategy 'MyTestStrategy/165864626': Entered internal SubmitOrderManaged() method at 7/11/2018 11:00:00 AM: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=5 LimitPrice=0 StopPrice=72.88 SignalName='LongExit' FromEntrySignal='LongEntry'

    7/11/2018 11:00:00 AM Strategy 'MyTestStrategy/165864626': Ignored SubmitOrderManaged() method at 7/11/2018 11:00:00 AM: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=5 LimitPrice=0 StopPrice=72.88 SignalName='LongExit' FromEntrySignal='LongEntry' Reason='Invalid order price, please see log tab'

    The next Ohlc bar was : 72.72,72.73,71.80,71.89. So, normally I would expect I would expect since the next bar opened below my Stop Level (went through the stop), the order should get converted to a market order and get traded at the open of 72.72. Why was the order rejected with an "Invalid order price" ?

    ----

    2. Suppose the current market OHLC bar is 68.46, 68.99, 68.05, 68.94, and I am currently Short -5 contracts.If I issue an order using ExitShortStopMarket at a price of 68.64 for the next bar, my order gets rejected. I did not try to open any Long position, but only to close the Short position.

    This is the error that is printed:

    7/24/2018 10:00:00 AM Strategy 'MyTestStrategy/165864626': Entered internal SubmitOrderManaged() method at 7/24/2018 10:00:00 AM: BarsInProgress=0 Action=BuyToCover OrderType=StopMarket Quantity=5 LimitPrice=0 StopPrice=68.64 SignalName='ShortExit' FromEntrySignal='ShortEntry'

    7/24/2018 10:00:00 AM Strategy 'MyTestStrategy/165864626': Ignored SubmitOrderManaged() method at 7/24/2018 10:00:00 AM: BarsInProgress=0 Action=BuyToCover OrderType=StopMarket Quantity=5 LimitPrice=0 StopPrice=68.64 SignalName='ShortExit' FromEntrySignal='ShortEntry' Reason='Invalid order price, please see log tab'


    The next Ohlc bar was: 68.94,69.35,68.89,69.34. So, normally I was expect that since the next bar opened above my Stop Level (went through the stop), the order should get converted to a market order and get traded at the open of 68.94. Why was the order reject with an "Invalid order price" ?

    ----

    Log tab only says: "An Exit() method to submit an order enter at xxx has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide.

    Does the Stop Price level needs to be compulsorily below the last Close for ExitLongStopMarket, and above the last Close for ExitShortStopMarket ?
    Last edited by uday12; 04-19-2019, 11:37 AM.

    #2
    Hello uday12,

    Thank you for your post.

    ExitLongStopMarket orders must be below the current price at the time they are placed, and vice versa for ExitShortStopMarket or they will be ignored as you have seen. Since the order is not placed until the open of the next bar, by the time the order is placed it is already on the wrong side of the current price and is summarily ignored. I recommend placing your stops farther from the current price to avoid these scenarios should the market move quickly.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi Kate, thanks for the clarification.

      Another question: suppose the Open of the next bar is between the Close and the Stop Level , will the trade happen? For instance, if close is $93, and I place the stop order (to go short) at $92 and the open of the next bar is $91, where the market gapped on the open through my stop level - will the order get converted to a market order? (Assuming I am using ExitShortStopMarket and ExitLongStopMarket).

      Comment


        #4
        Hello uday12,

        Thank you for your reply.

        If the stop order is triggered on bar close of the bar that closed at $93, and it tries to place a sell stop at $92, but the next bar opens at $91, no, the stop order will be ignored as it hasn't been placed above the current market price. As I mentioned previously, sell stops must be below the current market price at the time they are placed, and buy stops must be above the current market price.

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sephichapdson, Today, 11:36 PM
        0 responses
        1 view
        0 likes
        Last Post sephichapdson  
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,612 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        9 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        19 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        6 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Working...
        X