Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Any different between ChartBars.Bars.GetXYZ() and XYZ[0][0]?

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

    Any different between ChartBars.Bars.GetXYZ() and XYZ[0][0]?

    there are:
    Code:
    ChartBars.Bars.GetOpen()
    ChartBars.Bars.GetHigh()
    ChartBars.Bars.GetLow()
    ChartBars.Bars.GetClose()
    ChartBars.Bars.GetTime()
    ChartBars.Bars.Volume()
    and

    Code:
    Closes[0]
    Highs[0]
    Lows[0]
    Opens[0]
    Times[0]
    Volumes[0]
    Is there any difference (or can theorically raise in our scripts in some conditions) if we use one or another? or they are absolutely same/replacements and we can use one or another?

    for example, `ChartBars.Bars.GetClose(ChartBars.Bars.Count-1)` and `Closes[0][0]`

    #2
    Hello TazoTodua,

    Thank you for the post.

    Yes, in this case, there is a difference between the syntax you have shown. One is a method that uses a direct index to retrieve a value from the primary series. The second syntax is a variable for the series its self which you can then use the BarsAgo system with. The BarsAgo system and Index system are inverse meaning they represent traversing the data in opposite directions.

    You can use both in your scripts and they do generally serve the same purpose for retrieving data however the Get methods are specifically used in out of event-driven context such as OnRender where you cannot use the BarsAgo concepts. The BarsAgo is generally used inside of the event-driven context like OnBarUpdate where the relation to the current processing bar matters, I.E. 5 bars from right now in the past [5 BarsAgo].

    They are able to reach the same general values when using opposite inputs, but each serves its own specific purpose.

    I look forward to being of further assistance.




    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    572 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    331 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    549 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    550 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X