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

Market Orders used during Backtesting

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

    #31
    Chelsea,

    No, it is not. I am trying to not create tons of threads with questions, since my issues are all seemingly related to some core functionality or APIs. I am starting to get the impression this forum isn't meant to be used as a development forum. What I mean by this is I am trying to pose questions on my understanding of how the NT8 API should function and when things dont seem to line up, why is it functioning that way. I still havent received an answer on whether what I am trying to implement is feasible. If I am misusing the API and that is why I am getting odd behavior this is what I need support on.

    Last edited by BraisedInBlue; 01-14-2021, 09:17 AM.

    Comment


      #32
      Hello BraisedInBlue,

      What is the specific issue you would like assistance with?

      Is an order not being submitted at a time you expect?

      Is an order being submitted when you do not expect?

      Is the order fill price unexpected?
      Chelsea B.NinjaTrader Customer Service

      Comment


        #33
        The market order is filling at a non-feasible price. Using the last set of examples you can see that order always fills at the bar's open price even though the condition doesnt occur at open. it occurs intra-bar.

        Comment


          #34
          Hello BraisedInBlue,

          So it looks like the order is being placed to BarsInProgress 0 and not BarsInProgress 1.
          1/5/2021 7:07:00 AM Strategy 'Prediction Engine/221444164': Entered internal SubmitOrderManaged() method at 1/5/2021 7:07:00 AM: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='testSell' FromEntrySignal=''

          If the order is using BarsInProgress 0 then the order will fill when the primary bar opens.

          May I have you copy the entry order call with your reply? (Not the entire script, just the line for EnterLong() with 'testSell'. We need to confirm this is being submitted with a 1 as the bars index.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #35
            Again, I am not using multiple time series. I am only using one time series, and the problem I am running into is that even though I can see intra-bar using OnMarketData and TickReplay, the order is being submitted at the primary bar open, (but after it actually opened). In the last example, I am submitting an exit order in Bar 2168 (it is submitted intra-bar via OnMarketData), but the order is processed as if it was the open of Bar 2168. Not Bar 2169.

            My understanding is that the order should fill at open of Bar 2169, if the order occured in Bar 2168. But I can clearly show submitting an order IN bar 2168 and it filling in 2168.

            So is my understanding incorrect? Or is submitting the order in OnMarketData somehow to blame for this behavior?
            Last edited by BraisedInBlue; 01-14-2021, 09:49 AM.

            Comment


              #36
              Hello BraisedInBlue,

              TickReplay cannot be used for order fill prices. This is noted in the forum post that linked in post #2 about intra-bar granularity. You must use 1 tick intra-bar granularity if you want order fills intra-bar while using TickReplay. Please review this post once more.

              Orders will be filled at the open of the bar if the orders are not submitted to a 1 tick added series. This is expected behavior.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #37
                But is it supposed to be filled within the current bar or the next bar?

                Again if I submit an order in Bar 2168, it will fill at the open of 2169, Correct? What I am currently seeing is I submit the order (entry or exit) and it is filling in same bar it was submitted.
                Last edited by BraisedInBlue; 01-14-2021, 10:04 AM.

                Comment


                  #38
                  Hello BraisedInBlue,

                  I'm expecting if the submission time is before the close time of the bar it would use the close price of the current bar. If submitted after the primary bar close it would fill with the open of the next bar.

                  If you want fills on the same bar or intra-bar you will need to place orders to a 1 tick series as directed.

                  Basically, add the 1 tick series, place the orders to the 1 tick series and you should get expected behavior.
                  Last edited by NinjaTrader_ChelseaB; 01-14-2021, 10:11 AM.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #39
                    Okay, so then this is my problem. The order IS NOT FILLING on the next bar open. I submit an order within Bar 2168, and it is FILLING in Bar 2168. This is my cause for confusion/frustration, and the core of my question.

                    Edit: The order is always filling at the Open price of the bar it was submitted within.

                    You are saying it should fill at the open of the next bar, but I can clearly show it fills in the same bar. Even with your edit, that is still not the behavior I am seeing. It will always fill at the opening price of the bar it is submitted within.
                    Last edited by BraisedInBlue; 01-14-2021, 10:22 AM.

                    Comment


                      #40
                      Hello BraisedInBlue,

                      It is based on the time stamps of the bar close and the time of the submission. The order is filled with the open, high, low, close information of the bar with the first timestamp greater than the submission time.




                      Place the order after the bar closes and this would fill on the open of the next bar as the time stamp of the current bar would be less than the submission time.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #41
                        Thank you for this, this explains why this is occurring the current incomplete bar will have a time of the close of the bar, where as when I am in OnMarketData I have intraBar time granularity. (And its < then the primary series currentBar)

                        Thank you!

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by pechtri, 06-22-2023, 02:31 AM
                        10 responses
                        124 views
                        0 likes
                        Last Post Leeroy_Jenkins  
                        Started by judysamnt7, 03-13-2023, 09:11 AM
                        4 responses
                        59 views
                        0 likes
                        Last Post DynamicTest  
                        Started by ScottWalsh, Yesterday, 06:52 PM
                        4 responses
                        36 views
                        0 likes
                        Last Post ScottWalsh  
                        Started by olisav57, Yesterday, 07:39 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post olisav57  
                        Started by trilliantrader, Yesterday, 03:01 PM
                        2 responses
                        22 views
                        0 likes
                        Last Post helpwanted  
                        Working...
                        X