I need help on this.
I'm not good with coding.
What am I trying to do is to create an indicator, if possible, a max range based on ATR over the last 30 days, not counting the current day.
This is what I came up so far, but getting some error message.
Anyone help me? Thanks!
declare upper;
input length = 30;
def AverageTrueRange = ATR(high(period = AggregationPeriod.HOUR), close(period = AggregationPeriod.HOUR), low(period = AggregationPeriod.HOUR), length);
def maxRange = Highest(AverageTrueRange, length);
plot MaxRangeIndicator = maxRange;
MaxRangeIndicator.SetDefaultColor(color.cyan);
MaxRangeIndicator.SetLineWeight(2);
# Exclude current trading day
def today = GetDay() == GetLastDay();
def excludedMaxRange = if today then maxRange[1] else maxRange;
I'm not good with coding.
What am I trying to do is to create an indicator, if possible, a max range based on ATR over the last 30 days, not counting the current day.
This is what I came up so far, but getting some error message.
Anyone help me? Thanks!
declare upper;
input length = 30;
def AverageTrueRange = ATR(high(period = AggregationPeriod.HOUR), close(period = AggregationPeriod.HOUR), low(period = AggregationPeriod.HOUR), length);
def maxRange = Highest(AverageTrueRange, length);
plot MaxRangeIndicator = maxRange;
MaxRangeIndicator.SetDefaultColor(color.cyan);
MaxRangeIndicator.SetLineWeight(2);
# Exclude current trading day
def today = GetDay() == GetLastDay();
def excludedMaxRange = if today then maxRange[1] else maxRange;