Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsArray[0].GetHigh(0) and High[0] values different?

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

  • bltdavid
    replied
    Originally posted by waltS View Post
    What am I missing?
    GetHigh() is using an array index, where '0' is the first
    bar as seen on the far left of the chart.

    High[] is using a series index, where '0' is adjusted to
    always mean the most recently closed bar, on the far
    right of the chart. A series index has a special name,
    it's called a BarsAgo index.

    When a new bar is closed, it's high value is accessible
    via GetHigh(CurrentBar) or High[0].

    The high value of the very first bar on the far left is always
    accessible via GetHigh(0) or High[CurrentBar].

    -=o=-

    Careful ...
    High[CurrentBar] reads like a misnomer -- so you must
    first understand what the BarsAgo index means, and
    then you'll understand why the series syntax is most often
    used to 'look back' at historical bars.

    (Hint: The 'why' is probably due to ease of programming.)

    Good reading here, here, and here.
    Last edited by bltdavid; 06-02-2022, 09:37 AM.

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello waltS,

    Yes that would be expected, those methods are not alike. One takes a BarsAgo and one takes a Index, BarsAgo and Index are not the same concept. 0 index is the first bar on the chart, 0 BarsAgo relates to where you are in processing right now.





    Leave a comment:


  • BarsArray[0].GetHigh(0) and High[0] values different?

    I am coding a pivot with a source of a series.

    When I assign the series values using:

    Code:
    tradeH[0] = BarsArray[0].GetHigh(0);
    I have very different results by assigning the the values using:

    Code:
     tradeH[0] = High[0];
    I would expect that "BarsArray[0].GetHigh(0)" would return the same value as "High[0]"

    What am I missing?

Latest Posts

Collapse

Topics Statistics Last Post
Started by jtrade, 02-05-2009, 03:14 AM
6 responses
5,471 views
0 likes
Last Post Cocchu
by Cocchu
 
Started by XanderT, Today, 01:12 AM
0 responses
6 views
0 likes
Last Post XanderT
by XanderT
 
Started by willheenahj, Today, 12:56 AM
0 responses
3 views
0 likes
Last Post willheenahj  
Started by termitikicloud, 01-11-2025, 05:27 PM
15 responses
93 views
0 likes
Last Post backtester831  
Started by FAQtrader, 04-25-2024, 12:00 PM
64 responses
1,422 views
0 likes
Last Post blkbird
by blkbird
 
Working...
X