addlabel 52 Week high & low


Hello can you help me with the script

addLabel(1, “52 Low: ” + Lowest(low(period = “Day”), 252), color.white);
addLabel(1, “52 High: ” + Highest(high(period = “DAY”), 252), color.white);

This script addlabel that show 52 week high and low with background color white. What I need is when close if greater than 52 Week high I need background color to be red else white and when close is low then 52 week low need color green else white. Please let me know how I can do that .



Marked as spam
Posted by (Questions: 11, Answers: 6)
Asked on October 16, 2019 11:44 am
Private answer

Think about this for a minute. For any given candle the close can never be greater than the high or less than the low. It can be equal to either of those but it can never exceed them. Therefore, given your statement and the code you have provided, it is impossible to achieve.

Marked as spam
Posted by (Questions: 36, Answers: 2222)
Answered on October 16, 2019 4:18 pm