Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This Pine Scriptâ„¢ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © x77x
- //@version=6
- indicator("ATH",overlay = true)
- //ATH
- // Variables to track the all-time high
- var float all_time_high = na
- var line all_time_high_line = na
- var label all_time_high_label = na
- // Check if the current high exceeds the all-time high
- if na(all_time_high) or high > all_time_high
- all_time_high := high // Update the all-time high if a new high is made
- // Delete previous line and label
- if not na(all_time_high_line)
- line.delete(all_time_high_line)
- if not na(all_time_high_label)
- label.delete(all_time_high_label)
- // Create new line and label
- all_time_high_line := line.new(x1=bar_index, y1=all_time_high, x2=bar_index + 1, y2=all_time_high, color=#03ac0a, width=1, extend=extend.right)
- all_time_high_label := label.new(x=bar_index, y=all_time_high, text="ATH:" + str.tostring(all_time_high, format.mintick), style=label.style_label_down, color=#03ac0a, textcolor=#0d0d0d)
Advertisement
Add Comment
Please, Sign In to add comment