Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing Fill to Current Bar

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

    #31
    I apply a market order to be filled at cross, but I am getting order filled on the next bar open ?

    Comment


      #32
      Do you have anything set to "Update on Bar Close?"
      JessicaNinjaTrader Customer Service

      Comment


        #33
        No. The only place where you can do it is in the first window. I set to real time

        Comment


          #34
          Are the indicaors in your strategy updating on barts close?

          If the trades are always being entered on the open of the next bar then you are using this setting somewhere in the strategy or test.
          JessicaNinjaTrader Customer Service

          Comment


            #35
            sausaulius,

            This is the nature of backtesting. You do not know that the cross happened till after you signal bar has closed. Because that signal bar is closed you cannot possibly trade on that bar so the next possible bar to trade on is the open of the next bar.
            Josh P.NinjaTrader Customer Service

            Comment


              #36
              Sorry, I don't know what are you talking about.I create strategy using wizard and was not able to find where it could be setted (calculate on bar close) Also in the backtesting window.. The Only place is As I said earlier is in the first window.
              Could you say where it is ?

              Comment


                #37
                sausaulius,

                Backtesting is ALWAYS done with CalculateOnBarClose = false. That setting is only relevant when running live.
                Josh P.NinjaTrader Customer Service

                Comment


                  #38
                  The price crosses intrabar, not on close.

                  Comment


                    #39
                    In the Strategy Wizard on the first screen where you name your strategy the is a box for Calculate on Bar Close. Please make sure this is unchecked.
                    JessicaNinjaTrader Customer Service

                    Comment


                      #40
                      You do not know this in a backtest. In backtesting you already know the bars Close. You are given OHLC the whole time. This means there is no way you can act inside the bar. If you act inside the bar you are "cheating". Sure you can say the condition happened some time inside that bar, but then I pose to you the question how do you know what happened after that condition. Did the price go up or down within that bar? There is no way to know and so there is no possible fill price that can be chosen from within that bar.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #41
                        Thank you.
                        Three of you said that it is possible....at first.
                        I suppose my fomulation was bad.

                        Comment


                          #42
                          Sorry for the confusion. We were thinking about different things, but from my understanding of what you are trying to do with your NinjaScript Strategy inside the Strategy Analyzer. My previous response is the proper answer.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #43
                            yes, it is uncheced. Read previous post, and especialy from Josh.

                            Comment


                              #44
                              Sometimes, being able to enter with a market order using the open of the current bar is important. If you are calculating your moving average based on the open values of the bars, then the entry can be taken on the open of the bar for a moving average cross.

                              I love Ninja Trader, but this is probably the only thing causing trouble for me.. orders being filled on the next bar instead of the current bar. My systems are designed to know the values of the entry criteria at the open of the bar, so entries can be taken definitively on the open. Not being able to back-test this properly makes the development process much longer. To be fair, there might be a way around this that I am just not aware of.

                              I could calculate things on a tick-by-tick basis, but that uses an ENORMOUS amount of system resources and takes a long to run back-tests on if the strategies true time frame is (for example) 90 minutes and requires 100 days worth of data.

                              Comment


                                #45
                                naifwonder,

                                There is no way to fill within your signal bar. You already know the close so the bar is already closed. Lets say you are using a CrossAbove condition to enter trades. How do you know when the CrossAbove happened within that bar? As far as anyone can discern from just OHLC the cross could have happened at the very last tick (the close). Even when you think about running it real-time. Your CrossAbove condition can switch between true and false many times within a bar. There is no way a simple OHLC can be used to deduce an even remotely realistic intrabar fill. This is why we use the open of the next bar. I understand your anxiety with this, but it is about choosing the lesser of the two evils. This is just the nature of backtesting in general which is why it is highly recommended you forward test your strategy too.
                                Josh P.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by NullPointStrategies, Today, 05:17 AM
                                0 responses
                                51 views
                                0 likes
                                Last Post NullPointStrategies  
                                Started by argusthome, 03-08-2026, 10:06 AM
                                0 responses
                                127 views
                                0 likes
                                Last Post argusthome  
                                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                                0 responses
                                69 views
                                0 likes
                                Last Post NabilKhattabi  
                                Started by Deep42, 03-06-2026, 12:28 AM
                                0 responses
                                42 views
                                0 likes
                                Last Post Deep42
                                by Deep42
                                 
                                Started by TheRealMorford, 03-05-2026, 06:15 PM
                                0 responses
                                46 views
                                0 likes
                                Last Post TheRealMorford  
                                Working...
                                X