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

Confused: StopMarket Buy order 80 points above Close[0] is being ignored by strategy

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

    Confused: StopMarket Buy order 80 points above Close[0] is being ignored by strategy

    A stop buy above Close[0] and GetCurrentAsk() generates a output message "An order has been ignored".

    The daily bar for MES on 4/16/2020 has high,low of (2748,2699). Yet a stop buy at 2802.5 keeps being ignored by the strat.

    Output: (the market is MES)

    ==entry_SHORT filled. 4/16/2020 5:00:00 PM, Bar245

    stopLossBuy=2802.5, Close[0]=2727.5, GetCurrentAsk()=2727.5

    4/16/2020 5:00:00 PM Strategy 'aaAutoBREntryStrat/-1': Entered internal SubmitOrderUnmanaged() method at 4/16/2020 5:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=2802.50 SignalName='sl_SHORT8/7/2021 2:22:44 PM'

    Strategy 'aaAutoBREntryStrat/-1': An order has been ignored since the stop price ‘2802.5’ near the bar stamped ‘4/16/2020 5:00:00 PM’ is invalid based on the price range of the bar. This is an invalid order and subsequent orders may also be ignored.

    4/16/2020 5:00:00 PM Strategy 'aaAutoBREntryStrat/-1': Ignored SubmitOrderUnmanaged() method at 4/16/2020 5:00:00 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=2802.50 SignalName='sl_SHORT8/7/2021 2:22:44 PM' FromEntrySignal='' Reason='Invalid order price, please see log tab'

    Log tab:
    8/7/2021 2:22:44 PM Default Strategy 'aaAutoBREntryStrat/-1': An order has been ignored since the stop price ‘2802.5’ near the bar stamped ‘4/16/2020 5:00:00 PM’ is invalid based on the price range of the bar. This is an invalid order and subsequent orders may also be ignored.
    EDIT: The next day open is 2810.5. So it's being ignored because for that reason I suppose.

    Should I use "if (stopBuyPrice<=Open[-1]) {}" to check for this possibility? => I tried and you can't access future data with Open[-1].

    EDIT2: For now I am sticking with backtest with intraday tick charts, with 1 tick resolution. Backtest on daily bars with 1 min resolution seems wonky for above reason. I bet I am doing something wrong. Any ideas would be appreciated.

    EDIT3: This issue occurs on 7000tick chart with 1tick resolution too:

    ==en_SHORT filled.7/8/2021 12:31:58 PM206
    4319=slBuy,ask=4318.75,4318.75=close[0]

    7/8/2021 12:31:58 PM Strategy 'aaAutoBREntryStrat/-1': Entered internal SubmitOrderUnmanaged() method at 7/8/2021 12:31:58 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=4319.00 SignalName='sl_SHORT8/7/2021 3:43:09 PM'

    Strategy 'aaAutoBREntryStrat/-1': An order has been ignored since the stop price ‘4319’ near the bar stamped ‘7/8/2021 12:31:58 PM’ is invalid based on the price range of the bar. This is an invalid order and subsequent orders may also be ignored.

    7/8/2021 12:31:58 PM Strategy 'aaAutoBREntryStrat/-1': Ignored SubmitOrderUnmanaged() method at 7/8/2021 12:31:58 PM: BarsInProgress=0 Action=Buy OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=4319.00 SignalName='sl_SHORT8/7/2021 3:43:09 PM' FromEntrySignal='' Reason='Invalid order price, please see log tab'

    Can you comment on if this happens only with back test, or with real time automated trading too? Any help is appreciated.
    Last edited by xxzbill; 08-08-2021, 09:31 AM. Reason: Clarify "being ignored"

    #2
    Perhaps you're confused by what a Buy Stop Order is supposed to do.

    You submit this entry order above the market price, and it just sits there and
    waits for price to rise to the Stop price, and only then does it turn into a
    Market order -- when it fills you are in a long position.

    Comment


      #3
      Originally posted by bltdavid View Post
      Perhaps you're confused by what a Buy Stop Order is supposed to do.

      You submit this entry order above the market price, and it just sits there and
      waits for price to rise to the Stop price, and only then does it turn into a
      Market order -- when it fills you are in a long position.
      Thanks for the reply.

      The buy stop order mentiond is a stop loss for a short entry.

      The strategy is literally saying "this order is being ignored", as the output message suggests.

      The short entry ends up being filled with no stop loss order sent. And strategy analyzer will give a losing short position that just keep losing, with no exit on the highs.

      Comment


        #4
        Hello xxzbill,

        To start, I will assume this is historical.

        Does the script implement 1-tick granularity for accurate historical fills?


        May I also confirm you are using 8.0.24.3? (Help -> About)

        Can you create a test script with a market sell entry and just have this one condition and order method to demonstrate the issue?

        To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
        1. Click Tools -> Export -> NinjaScript...
        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 a unique name for the file 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.
        http://ninjatrader.com/support/helpG...-us/export.htm
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you for the reply.
          -It was historical.
          -I did not go through to implement 1-tick granularity. But I will try it next time.
          -I am using 8.0.24.2
          -I am working on another project now. When I get to work more on this issue I will definitely try out your suggestions.

          Thanks again

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by GLFX005, Today, 03:23 AM
          0 responses
          1 view
          0 likes
          Last Post GLFX005
          by GLFX005
           
          Started by XXtrader, Yesterday, 11:30 PM
          2 responses
          11 views
          0 likes
          Last Post XXtrader  
          Started by Waxavi, Today, 02:10 AM
          0 responses
          6 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Started by TradeForge, Today, 02:09 AM
          0 responses
          12 views
          0 likes
          Last Post TradeForge  
          Started by Waxavi, Today, 02:00 AM
          0 responses
          2 views
          0 likes
          Last Post Waxavi
          by Waxavi
           
          Working...
          X