Greetings Pete,
If you have time I’d appreciate your feedback on my code. I hope it’s correct. Maybe there is a better way to write it.
I created a label that looks at the Ichimoku Chikou, and the closing price (26 days ago), and displays a gray label with the percent difference of the two. I’d like to have the label turn green when Chikou is above the close, and red if the close is above the Chikou, but I get an error so I definitely can’t get that right. Maybe you can help. Thanks for all you do.
# Percentage Distance Chikou/Close (26 days ago)
declare upper;
def price = close[26];
def chikou = Ichimoku().”Chikou”[26];
def pctPriceAbove = (price/chikou) – 1;
def pctChikouAbove = (chikou/price) – 1;
AddLabel(yes, “Chikou/Close %: ” + if chikou > price then AsPercent(pctChikouAbove) else AsPercent(-pctPriceAbove),color.GRAY);
Like this:
Like Loading...