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

Next Bar Open

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

    Next Bar Open

    How do obtain the next bars open? I am unable to use the opening of the market in my calculation because the program calculates the signals on the close.

    #2
    You can't get next bar's open since NinjaTrader does not allow you to "peek" into future data as it's not yet know.

    If I misunderstand, please clarify.
    RayNinjaTrader Customer Service

    Comment


      #3
      You should lnow the open at the open. Why does it calculate it at the close. Why not the open? How would you then code this (next bar open + range ) or ( if next bar open < close)

      Comment


        #4
        Of course you know the open at the open. If that's what you want, see the CaclulateOnBarClose property so that you can run tick by tick.

        During a backtest, you know the OHLC of the final bar which is the close of the bar.

        We have no concept of "next bar open" since you can only evaluate your program logic at the point of evaluation which is at the close of a bar or on every tick. With NinjaTrader, you don't get access to future data.

        Therefore, if next bar open < close is not valid since you are comparing a future's bar open price to the current bar open price.

        Here is some documentation - http://www.ninjatrader-support.com/H...BarClose1.html
        RayNinjaTrader Customer Service

        Comment


          #5
          Then ninja trader can't code this - buy at the opeing + 7

          Comment


            #6
            If you run tick by tick, then yes, you would submit the order on the very first tick of the opening bar.
            RayNinjaTrader Customer Service

            Comment


              #7
              I forgot to add, in backtest, you are correct, NinjaTrader can not place an order using the next bar's open price.
              RayNinjaTrader Customer Service

              Comment


                #8
                how hard would it be to add this function?

                Comment


                  #9
                  Hi Brady,

                  Will add this request to our list for future consideration. You could use the current Close price as a subsitute for next open. In intraday, both values are more often than not, one tick within each other.
                  RayNinjaTrader Customer Service

                  Comment


                    #10
                    Not when using the pit open. When do you think this feature will be add and do you have anymore work arounds

                    Comment


                      #11
                      Hi Ray/Brady, Have you find the way to make it work?

                      I also need to have next bar open in backtest.
                      It seems that when running backtest, if I do enterlong(), the market price of it will be assumed to be the next bar open price. My strategy will need to limited price to the next bar open price such that it will have more guarantee performance in real time.

                      I hope NT7 already has this implemented or in any way of coding I can make it to work. (I am a programmer).

                      Comment


                        #12
                        pcijoin, there are unfortunately no changes here, we still do not allow peeking into the future - which exact order / signal are you trying to implement? In Market Replay you could work with CalculateOnBarClose = false and just submit a tick after the open then.
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          Hi Bertland, thanks for your reply!

                          Here is the detail problem I am having with NT Backtesting:

                          First of all, the NT backtesting of my strategy showed good performance.
                          During NT backtest as the attachment image shown, I assume NT run the stategy as:
                          When the bar closed, the next open price will be assumed to be the market price of enterlong() or entershort().

                          But during the real time, if the same strategy do enterlong() or short(), the price it filled may not be the next bar open price as the NT backtesting shows. Therefore, in order to make backtesting to be more similar to the real time running of this strategy that is already working good in backtesting, I am thinking to limit the price to the next bar open price. If it can't get the price of the next bar open, it should not enter the position.

                          I hope I explain well here, if not, please let me know.

                          Again, is there anyway I can implement this? Is my concept of NT backtesting is correct or not? Please guide and help! Thank you!

                          P.S. See attachment picture for detail



                          Originally posted by NinjaTrader_Bertrand View Post
                          pcijoin, there are unfortunately no changes here, we still do not allow peeking into the future - which exact order / signal are you trying to implement? In Market Replay you could work with CalculateOnBarClose = false and just submit a tick after the open then.
                          Attached Files

                          Comment


                            #14
                            Thanks for the detailed clarification - while you would unfortunately not have access to the future open price, you could add bid / ask series to your strategy and submit against those (NT7 only), which will give you a more realistic picture of your market order fills.

                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              Will this feature of NT backtesting be implemented? Is it in the list of development already? Many thanks!

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Mizzouman1, Today, 07:35 AM
                              4 responses
                              18 views
                              0 likes
                              Last Post Mizzouman1  
                              Started by philmg, Today, 01:17 PM
                              1 response
                              4 views
                              0 likes
                              Last Post NinjaTrader_ChristopherJ  
                              Started by cre8able, Today, 01:01 PM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by manitshah915, Today, 12:59 PM
                              1 response
                              3 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Started by ursavent, Today, 12:54 PM
                              1 response
                              4 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X