Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.GetClose(0) or Close[0]

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

    Bars.GetClose(0) or Close[0]

    A little confused by this new way to get the same info.

    I'd like to know why this ? which one is more accurate, reliable and fast ?

    Under what conditions should I use or the other?

    Thanks

    #2
    Hello pstrusi,

    Close would take a bars ago value whereas Bars.GetClose takes an absolute barIndex.

    For example the following code in an indicator would print the first close on a chart, and would not change,

    Print(Bars.GetClose(0));

    While the following would print every close starting to from the left moving to the right.
    Print(Close[0]);

    If you were to pass the CurrentBar into GetClose, they would be the same. Please see the following explanation,


    Please let us know if you need further assistance.
    Last edited by NinjaTrader_AlanP; 09-10-2017, 04:31 PM.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_AlanP View Post
      Hello pstrusi,

      Close would take a bars ago value whereas Bars.GetClose takes an absolute barIndex.

      For example the following code in an indicator would print the first close on a chart, and would not change,

      Print(Bars.GetClose(0));

      While the following would print every close starting to from the left moving to the right.
      Print(Close[0]);

      If you were to pass the CurrentBar into GetClose, they would be the same. Please see the following explanation,


      Please let us know if you need further assistance.
      Thanks Allan, a very clear and complete answer.

      Regards!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by geddyisodin, Yesterday, 05:20 AM
      8 responses
      51 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      10 responses
      36 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by DayTradingDEMON, Today, 09:28 AM
      4 responses
      24 views
      0 likes
      Last Post DayTradingDEMON  
      Started by George21, Today, 10:07 AM
      1 response
      17 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by Stanfillirenfro, Today, 07:23 AM
      9 responses
      25 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X