SavingFace

All Time High Tracker

May 20th, 2025 (edited)
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | Cryptocurrency | 0 0
  1. // This Pine Scriptâ„¢ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © x77x
  3.  
  4. //@version=6
  5. indicator("ATH",overlay = true)
  6. //ATH
  7. // Variables to track the all-time high
  8. var float all_time_high = na
  9. var line all_time_high_line = na
  10. var label all_time_high_label = na
  11.  
  12. // Check if the current high exceeds the all-time high
  13. if na(all_time_high) or high > all_time_high
  14. all_time_high := high // Update the all-time high if a new high is made
  15. // Delete previous line and label
  16. if not na(all_time_high_line)
  17. line.delete(all_time_high_line)
  18. if not na(all_time_high_label)
  19. label.delete(all_time_high_label)
  20. // Create new line and label
  21. 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)
  22. 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)
  23.  
  24.  
Tags: btc All time high ath
Advertisement
Add Comment
Please, Sign In to add comment