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

MIT order not filling on range bars

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

    MIT order not filling on range bars

    I have a strategy which on a short places a EnterShortMIT order one tick below the previous closed bar. This works great 99% of the time but every now and then it drops below the previous bar and my MIT order is just sitting there waiting to get filled above the market. I'm currently running Calculate.OnbarClose so I figured this was the issue so I have tried to use Calculate.OnEachTick and Calculate.OnPriceChange but I have the same results. The same happens when using EnterLongMIT as well. I think I understand the issue just not how to fix it. With range bars its possible that the open of the next bar opens lower than the previous plus my 1 tick so the MIT order so it never get filled. Anyone have any suggestions? I should add I have also tried EnterShortStop orders and its gets an error quite a bit because the price rips below the stop price and it won't fill and stop the strategy from running. Again this is a result of the range bars I believe.

    Thanks
    Last edited by jeffom; 07-28-2022, 09:29 AM.

    #2
    Hello jeffom,

    Thanks for your post.

    Is the order not filling because it is being automatically canceled because the order's price was not reached?

    How is the MIT order being submitted? Are you using the order method syntax that allows you to set the isLiveUntilCancelled property to true or false?

    EnterLongMIT(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double stopPrice, string signalName)

    If you submit the order without setting the isLiveUntilCancelled property to true and the order is not re-submitted on the next bar, the order will automatically be canceled.

    To keep the order alive, you would need to use the order method syntax that allows you to specify the isLiveUntilCancelled property to true. Or, you could re-submit the order on each bar close.

    See this reference sample that demonstrates keeping orders alive: https://ninjatrader.com/support/help...ders_alive.htm

    Let me know if I may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply,. to answer your first question. The order is not executed because its unintentionally becomes a resting MITsell order that was entered above the market so it will just sits there waiting to filled it isn't getting canceled. The intention was for this order to fill when we break the low of the previous bar . I'm not using the syntax you suggested I'm doing this EnterShortMIT(Convert.ToInt32(DefaultQuantity), stopPrice, "Short"); I'm not looking to resubmit the order or even cancel it however. I just would like it to fill at my desired location 1 tick below the previous bar. Would fill resolution change this behavior ?
      Last edited by jeffom; 07-28-2022, 02:42 PM.

      Comment


        #4
        Hello jeffom,

        Thanks for your note.

        If the EnterShortMIT() method is submitted without setting the isLiveUntilCancelled property set to true, the order would be canceled after the bar that the order was submitted to closes.

        If you are resubmitting the order at a new price on each bar, the order could be moving.

        Have you added debugging prints to the script?

        Please add debugging print to the script that prints out the order object in the OnOrderUpdate() method and note the output of the prints for each tick update that occurs after the order becomes working. Prints will display in a New > NinjaScript Output window.

        You could observe the prints to see if the OrderState is TriggerPending or Accepted and compare the stop price to the current Ask price. You could also compare the last close price price with the working stop price

        Also, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.

        See this help guide page for more information about OnOrderUpdate(): https://ninjatrader.com/support/help...rderupdate.htm

        Below is a link to a forum post that demonstrates how to use prints to understand behavior.
        https://ninjatrader.com/support/foru...121#post791121

        Let me know if I may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Balage0922, Today, 07:38 AM
        0 responses
        5 views
        0 likes
        Last Post Balage0922  
        Started by JoMoon2024, Today, 06:56 AM
        0 responses
        6 views
        0 likes
        Last Post JoMoon2024  
        Started by Haiasi, 04-25-2024, 06:53 PM
        2 responses
        19 views
        0 likes
        Last Post Massinisa  
        Started by Creamers, Today, 05:32 AM
        0 responses
        6 views
        0 likes
        Last Post Creamers  
        Started by Segwin, 05-07-2018, 02:15 PM
        12 responses
        1,786 views
        0 likes
        Last Post Leafcutter  
        Working...
        X