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

'High' Order Fill Resolution is only available for signle-series strategies

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

    'High' Order Fill Resolution is only available for signle-series strategies

    I would like to get tick resolution with my fills... when I choose High, Tick, 1... I get the error message:

    'High' Order Fill Resolution is only available for signle-series strategies. For multi-series strategies, please programe directly into your strategy the more granular resolution you would like to simulate order fills with.

    On my strategy when run on a one minute chart I have also added a 7 minutes series:

    AddDataSeries(BarsPeriodType.Minute, 7);

    So at the moment, BarsInProgress 0 is a 1 minute bar and BarsInProgress 1 is a 7 minute bar

    In another post it said to simply add a series with the granularity that you would like to fill with. So I added:

    AddDataSeries(BarsPeriodType.Tick, 1);

    Which makes BarsInProgress 2 a Tick series (bar?)

    I am still getting the error message.

    #2
    Hello BrianARice,

    Yes, by calling AddDataSeries() in the script, Order Fill Resolution can only be used as standard.

    You would then need to add a 1 tick series and use this for intra-bar granularity, and submit orders to the BarsInProgress of that added 1 tick series, and set Order Fill Resolution back to Standard.

    Yes, if you have already added a series, which would be BarsInProgress 1, the next added series would be BarsInProgress 2.

    Below is a link to a forum post on intra-bar granularity.


    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Ok... I am submitting my entry orders on the BarsInProgress == 2 (my tick series), However, when I handle the fill in OnExecutionUpdate the BarsInProgress is 0 not 2.

      So, my exit orders are then placed in the BarsInProgress = 0 state, rather than BarsInProgress = 2.

      Is there any way to get the OnExecutionUpdate to execute at the tick level (BarsInProgress == 2)?

      My print format is more or less "{CurrentBar}/{BarsInProgress} {Time[0]} {Action} ({order.Name}) {order.OrderAction} {order.Quantity} {orderType}@{stopOrLimitPrice}"

      OnBarUpdate:
      2849371/2 10/06 01:59:10.248 Submit Entry (Buy Rule2-2 @10/6 01:59) Buy 1 Limit@3389
      OnExecutionUpdate:
      610/0 10/06 02:13:00.000 Filled @3389 (Buy Rule2-2 @10/6 01:59) Buy 1 Limit@3389
      610/0 10/06 02:13:00.000 Submit ExitProfit (Exit Rule2-2 @10/6 01:59_profit) Sell 1 [email protected]
      610/0 10/06 02:13:00.000 Submit ExitLoss (Exit Rule2-2 @10/6 01:59_loss) Sell 1 [email protected]
      Last edited by BrianARice; 10-19-2020, 07:39 PM.

      Comment


        #4
        In this example, I don't believe the profit order is getting filled by exact tick prices, but by Ninja's estimate within the 7 minute bar (this is run on a 7 minute bar chart).

        OnBarUpdate:
        9746678/2 10/15 03:09:01.257 Submit Entry (Buy Rule4-1 @10/15 03:09) Buy 2 [email protected]

        OnExecutionUpdate:
        2197/0 10/15 03:30:00.000 Filled @3447.25 (Buy Rule4-1 @10/15 03:09) Buy 2 [email protected]

        2197/0 10/15 03:30:00.000 Submit ExitProfit (Exit Rule4-1 @10/15 03:09_profit) Sell 2 [email protected]
        2197/0 10/15 03:30:00.000 Submit ExitLoss (Exit Rule4-1 @10/15 03:09_loss) Sell 2 Stop@3440
        2197/0 10/15 03:30:00.000 Filled @3452.5 (Exit Rule4-1 @10/15 03:09_profit) Sell 2 [email protected]

        And... what happened here is I did a 30 second chart and looked from 3:30 - 3:37 and it did hit both prices (3452.50 and 3447.25)... but 3452.50 was hit early on and once it hit at 3447.25 it never got back up to 3452.50... suggesting that the profit fill was estimated from the 7 minute bar and not from the ticks.

        Note: this is run against ES ##-##.
        Last edited by BrianARice; 10-19-2020, 08:24 PM.

        Comment


          #5
          Hello BrianARice,

          OnExecutionUpdate() is not a data driven method. It is an order driven method in the order processing thread and not the data processing thread. So, no, there would not be a way to have OnExecutionUpdate() run specifically when data is processing in OnBarUpdate() instead of when the order execution is processing.

          Orders submitted to a 1 tick series, will be filled historically with prices from that one 1 tick series.

          Time[0] refers to the time of the bar. In a non-data-driven method, this would just be the last bar that updated in OnBarUpdate().

          The <order>.Time, or <execution>.Time would be the time of the order instead of the most recently updated bar from OnBarUpdate().
          https://ninjatrader.com/support/help.../nt8/order.htm
          https://ninjatrader.com/support/help.../execution.htm


          Are you certain that you are using the correct BarsInProgress index with the order submission method?

          EnterLong(int barsInProgressIndex, int quantity, string signalName)
          https://ninjatrader.com/support/help.../enterlong.htm

          (edit, also adding SubmitOrderUnmanaged)
          SubmitOrderUnmanaged(int selectedBarsInProgress, OrderAction orderAction, OrderType orderType, int quantity)


          Have you tested the reference sample that demonstrates intra-bar granularity?
          Last edited by NinjaTrader_ChelseaB; 10-20-2020, 10:07 AM.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Note: this is all being done with Unmanaged Orders.

            The entry order is being done when BarsInProgress is 2... you can tell because the beginning of the message is 9746678/2 (CurrentBar/BarsInProgress)

            But when I add the exit orders they are done in the OnExecutionUpdate which at that point BarsInProgress is 0.

            So do I need to wait until the next OnBarUpdate where BarsInProgress is 2 to actually submit the exit orders?

            Comment


              #7
              Hello BrianARice,

              OnExecutionUpdate() is still run from the order management thread in unmanaged strategies and not from the data management thread.
              The strategy being unmanaged does not change how NinjaScript Strategy methods work.

              No matter what series is processing, you still need to be submitting the order using the BarsInProgress index in the order method call as demonstrated in the reference sample I have linked you.
              May I confirm you are doing this?
              Have you taken a look at the intra-bar granularity reference sample?
              May I see the code of your order method to confirm you are submitting the correct index to the method call?

              BarsInProgress does not have meaning in OnExecutionUpdate(), this is not a data driven thread. This is an order driven thread.

              No, you do not need to wait until BarsInProgress 2 is updating to submit the order. You will need to use the proper BarsInProgress index in the method call as directed in post #5.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Ahh... somehow I forgot abut the selectedBarsInProgress parameter of the SubmitOrderUnmanaged function call and was thinking I had to submit these in the OnBarUpdate when BarsInProgress was equal to 2... much easier this way.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by adeelshahzad, Today, 03:54 AM
                1 response
                13 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by RookieTrader, Today, 07:41 AM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by kujista, Today, 05:44 AM
                1 response
                9 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by elderan, Yesterday, 08:03 PM
                1 response
                12 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by samish18, Yesterday, 08:57 AM
                8 responses
                25 views
                0 likes
                Last Post samish18  
                Working...
                X