Recurring comparison of histogram bars

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #253084 quote
    Carburo
    Participant
    New

    I take my cue from the “ATR percentile rank” indicator created by Nicolas and published at

    ATR percentile rank

    In indicators represented graphically with a histogram, in which the value of a bar is compared with the data for the same bar from previous days, reading would be easier and more immediate if the bars useful for this comparison were highlighted compared to the other bars in the histogram.
    One possibility is to apply a different level of transparency to these bars than to all the others.
    An alternative could be to connect the upper ends of the relevant bars with a segment.
    The image, taken from another situation, shows both possibilities (ignoring the numerical data).
    https://i.postimg.cc/bJHnmknV/Istogramma.jpg

    Since some of my attempts to achieve this goal have not been successful, I would appreciate any suggestions or guidance on how to achieve this result.

    Thank you very much.

    #253087 quote
    robertogozzi
    Moderator
    Master

    What are the conditions to link any specific bar to another one?

    #253088 quote
    Carburo
    Participant
    New

    Assuming that the current bar (day 0) is the one at 4:15 p.m., the value of that bar must be compared with the bar at 4:15 p.m. yesterday (day 1), the bar at 4:15 p.m. the day before yesterday (day 2), and so on, up to the lookback period if possible.
    The comparison should work with any timeframe, ideally from one minute to one hour. On too short timeframes, the comparison makes sense when using an average. For example, with a 3-minute timeframe, the 5-period average would allow rolling calculations on bars that combined make up a 15-minute band, thus avoiding the problem of losing the meaning of a comparison of a single 3-minute bar with its counterparts from previous days.

    #253093 quote
    robertogozzi
    Moderator
    Master

    You have to set the number of bars in a day and compare the current close:

    ONCE N = 24*1     //24*1=1-hour TF,   24*60=1-min TF,   24*4=15-min TF, etc...
    Yester = close[N]
    Curr   = close
    RETURN Yester AS "Close Yesterday", Curr AS "Current Close"
    Iván González and Carburo thanked this post
    #253104 quote
    robertogozzi
    Moderator
    Master

    There will be issues on Monday, because on Friday there were less bars than usual due to the weekly closing of the markets.

    #253116 quote
    Carburo
    Participant
    New

    Is there a way to use the OpenMinute and OpenHour commands with reference to previous days? Something that produces a “synthetic” effect like OpenMinute[1] and OpenHour[1].
    This would allow for a consistent comparison (for Friday’s discussion and similar cases, the code could made such to call up the previous bar).
    I tried it, but got an error message. Maybe, however, with a trick… or could it be an interesting addition to the list of ProBuilder commands?
    Thank you very much for your support.

    #253121 quote
    robertogozzi
    Moderator
    Master

    Yes, in the example above replace CLOSE with other data you need:

    Yester = OpenMinute[N]
    Curr   = OpenMinute
    Carburo thanked this post
    #253122 quote
    JS
    Participant
    Senior

    Hi,

    Maybe this can help…?

    DefParam DrawOnLastBarOnly=True
    
    GTF=GetTimeFrame
    n=86400/GTF
    
    CurrentClose=Close
    PrevClose=Close[n]
    
    Diff=(CurrentClose/PrevClose-1)*100
    
    DrawSegment(BarIndex,Close,BarIndex-n,Close[n])
    DrawText("Diff=#Diff#%",BarIndex,Close+Range)
    
    Return
    robertogozzi thanked this post
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

Recurring comparison of histogram bars


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Carburo @carburo Participant
Summary

This topic contains 7 replies,
has 3 voices, and was last updated by JS
3 months, 1 week ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/27/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...