ATH Label/Bubble

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #243921 quote
    gp38super
    Participant
    New

    Anyone know how to code a bubble or label that plots on price at ATH and updates live? Should ideally only visible on chart where ATH is within range/sight/scope. One that prints high of day and/or ATH would be killer also. I attached a TOS image of similar.

    Thanks!

    #243939 quote
    Iván González
    Moderator
    Master

    Hi. Here an example to calculate the ATH.

    DEFPARAM DRAWONLASTBARONLY = TRUE  // Ensures that the drawing is only updated on the last bar
    
    // Calculation of the All-Time High (ATH)
    ONCE highestATH = 0  // Variable to store the highest recorded price
    IF high > highestATH THEN  
        highestATH = high  // Update the highest ATH if a new high is reached
    ENDIF
    
    // Draws the ATH label if it is within the visible range
    IF islastbarupdate THEN  
        DRAWTEXT("ATH:  #highestATH#", -100, -100, Dialog, Bold, 12) COLOURED(255,0,0,255) ANCHOR(TOPRIGHT, xshift, yshift)  
        DRAWHLINE(highestATH) STYLE(DOTTEDLINE3) COLOURED("RED")  // Draws a horizontal dotted line at ATH level
    ENDIF
    
    RETURN 
    gp38super thanked this post
    #243948 quote
    gp38super
    Participant
    New

    Great! Thank you! I will also try on my own, as I’m trying to learn more coding everyday, but I’m pretty sure it’s possible to anchor text to the high candle, correct? I just think that with my still very limited knowledge, it would continue to repeat a new label rather than just move with the new high, but I will try to figure that out as well. I won’t be upset if you beat me to it. Ha! Thanks again.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

ATH Label/Bubble


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
gp38super @gp38super Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by gp38super
11 months, 3 weeks ago.

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