I'm trying to define current price as a percentile of the last 30 day's highest high and lowest low as a label on daily, hourly and 15 min charts, but this doesn't calculate correctly.
def aggregationPeriod = AggregationPeriod.day;
def pct = 100 * (close - Lowest(low,30)) / (Highest(high,30) - Lowest(low,30));
def value = Round(pct, 2);
addlabel(yes,value + "%");
def aggregationPeriod = AggregationPeriod.day;
def pct = 100 * (close - Lowest(low,30)) / (Highest(high,30) - Lowest(low,30));
def value = Round(pct, 2);
addlabel(yes,value + "%");