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

Understanding Bars

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

    Understanding Bars

    Hello,
    Only just started using NinjaTrader today and trying to confirm with someone my understanding of how the Bars object works in real time when setting the switch to operate tick by tick (forget what the property is called now).

    My understanding is as follows:

    Each bar stores High Low Open CLose and Volume.
    While a bar is still being "constructed" because the time allocated to it has not yet elapsed, the Open is set to the 1st tick in the bar, and the High Low are dynamically changing tick by tick as new highs and lows are set. Does the Close level of this "live" bar contain the last tick then?

    Thanks so much

    #2
    Hi The Kid,

    Thanks for your post.

    This depends on the CalculateOnBarClose setting.

    With this set to false, your described behavior is correct and you can access this data whenever you want. Of course the Close price of the 'Live' bar will contain the correct last tick that happens to fall in this bars time range (considering NinjaTrader is using the closing bars time).

    However, with the CalculateOnBarClose set to 'True' you can only access each completed bar.



    Originally posted by The Kid View Post
    Hello,
    Only just started using NinjaTrader today and trying to confirm with someone my understanding of how the Bars object works in real time when setting the switch to operate tick by tick (forget what the property is called now).

    My understanding is as follows:

    Each bar stores High Low Open CLose and Volume.
    While a bar is still being "constructed" because the time allocated to it has not yet elapsed, the Open is set to the 1st tick in the bar, and the High Low are dynamically changing tick by tick as new highs and lows are set. Does the Close level of this "live" bar contain the last tick then?

    Thanks so much
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Hi The Kid,

      Thanks for your post.

      This depends on the CalculateOnBarClose setting.

      With this set to false, your described behavior is correct and you can access this data whenever you want. Of course the Close price of the 'Live' bar will contain the correct last tick that happens to fall in this bars time range (considering NinjaTrader is using the closing bars time).

      However, with the CalculateOnBarClose set to 'True' you can only access each completed bar.
      On a related subject, I was wondering what happens (in the backtest and in realtime) if you have two time frames, let's say 5 minutes and 1 minute, and you get a crossover buy signal on the 5 minute time frame.
      Gives this then the 1 minute time frame a "green light" for the next 5 minutes (i.e. until there is new 5 minute bar and the crossover isn't valid anymore), or does the 1 minute only gets a "green light" if they are both closed at the same time?

      For example:
      5 minute bar of 11.35 closes, and the indicator has an crossover, giving a buy order.
      Is the buy order only valid for the 1 minute bar which also closes at 11.35 (in this that would give a buy order at the open of the 11.36 o' clock bar).
      OR
      Is the buy order valid until there is a new 5 minute bar closed at 11.40, at which point there is no crossover of the indicator anymore. In this case, the 1 minute graph is then "positive" from 11.35 (close first 5min bar) until 11.40 (when the next 5 minute bar closes).

      I've read the Help section on multiple time frames ( http://www.ninjatrader-support.com/H...ameInstruments ), and if I understand it correctly, with the option "CalculateOnBarClose == true" there is a 5 minute window to open the trade on the 1 minute time frame. With the option set to false, there is only a minute to also get a positive signal on the 1 minute time frame?

      Can someone shed some light on this?

      Comment


        #4
        Hi J_o_s,
        Thanks for your post.

        For backtesting please review this reference sample - http://www.ninjatrader-support2.com/...ead.php?t=6652

        Basically you want to add symbols from the slowest to the fastest timeframes (i.e. 5min before the 1min timeframe). This is important because events from the OnBarUpdate() methods of the different timeframes are processed in that order. So if your 9:05 5 min bar gives you an entry signal, it will be processed 9:06 on the 1 min chart on the next bar.

        For realtime trading, it will process whichever events happens to occur first, because NinjaTrader is a truly event driven environment.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks for your reaction Bertrand. I think have a good understanding of it now.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by TheMarlin801, 10-13-2020, 01:40 AM
          20 responses
          3,914 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by timmbbo, 07-05-2023, 10:21 PM
          3 responses
          150 views
          0 likes
          Last Post grayfrog  
          Started by Lumbeezl, 01-11-2022, 06:50 PM
          30 responses
          806 views
          1 like
          Last Post grayfrog  
          Started by xiinteractive, 04-09-2024, 08:08 AM
          3 responses
          11 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Johnny Santiago, 10-11-2019, 09:21 AM
          95 responses
          6,194 views
          0 likes
          Last Post xiinteractive  
          Working...
          X