Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting Volumetric data for previous bars

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

    Getting Volumetric data for previous bars

    This code below grabs the max/min delta of the current bar along with the prices.

    Code:
    double maxprice;
    double minprice;
    double maxdelta = maxprice = double.MinValue;
    double mindelta = minprice = double.MaxValue;
    for (double p = High[0]; p >= Low[0]; p -= TickSize)
    {
    if (barsType.Volumes[CurrentBar].GetDeltaForPrice(p) > maxdelta)
    {
    maxdelta = barsType.Volumes[CurrentBar].GetDeltaForPrice(p);
    maxprice = p;
    }
    
    if (barsType.Volumes[CurrentBar].GetDeltaForPrice(p) < mindelta)
    {
    mindelta = barsType.Volumes[CurrentBar].GetDeltaForPrice(p);
    minprice = p;
    }
    }
    What I'm trying to get is the previous bar data as well. I changed
    Code:
    [CurrentBar]
    to
    Code:
    [CurrentBar-1]
    but that didnt work.
    Any help?

    Thanks!

    #2
    Hello Ousher,

    The volumetric data uses the CurrentBar for the index instead of a BarsAgo, if you wanted previous data you need to use CurrentBar - 1 for the previous bar.

    Are you sure the values for the given prices were different?

    I can see different values printing the CurrentBar and CurrentBar -1 for the other Volumetric values.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    93 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    138 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    123 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    73 views
    0 likes
    Last Post PaulMohn  
    Working...
    X