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 DayTradingDEMON, Yesterday, 08:54 AM
12 responses
36 views
0 likes
Last Post NinjaTrader_Gaby  
Started by reekotubbs, Today, 01:09 PM
0 responses
8 views
0 likes
Last Post reekotubbs  
Started by aligator, 06-05-2018, 01:25 AM
60 responses
5,917 views
10 likes
Last Post aligator  
Started by tony_28217, 06-15-2024, 12:55 PM
7 responses
53 views
1 like
Last Post svikari
by svikari
 
Started by pvtrader, 07-01-2024, 09:02 AM
4 responses
84 views
0 likes
Last Post Sparkyboy  
Working...
X