#Average Daily Range Levels
#By Vah for TOS, based on cristian.d CD_Average Daily Range Zones - highs and lows of the day
#The number of days you'd like average
input lenght = 5;
def dayHigh = DailyHighLow(AggregationPeriod.DAY).Dailyhigh;
def dayLow = DailyHighLow(AggregationPeriod.DAY).DailyLow;
def dayrange = dayHigh - dayLow;
def AvgRange = average(DayRange, lenght);
plot ADR_H = open(period = AggregationPeriod.DAY) + (AvgRange/2);
plot ADR_L = open(period = AggregationPeriod.DAY) - (AvgRange/2);
#Average Daily Range Levels
#By Vah for TOS, based on cristian.d CD_Average Daily Range Zones - highs and lows of the day
#The number of days you'd like average
input lenght = 21;
def dayHigh = DailyHighLow(AggregationPeriod.DAY).Dailyhigh;
def dayLow = DailyHighLow(AggregationPeriod.DAY).DailyLow;
def dayrange = dayHigh - dayLow;
def AvgRange = average(DayRange, lenght);
plot ADR_H = open(period = AggregationPeriod.DAY) + (AvgRange/2);
plot ADR_L = open(period = AggregationPeriod.DAY) - (AvgRange/2);
input lenght = 21;
input Range = .25;
def dayHigh = DailyHighLow(AggregationPeriod.DAY).Dailyhigh;
def dayLow = DailyHighLow(AggregationPeriod.DAY).DailyLow;
def dayrange = dayHigh - dayLow;
def AvgRange = average(DayRange, lenght);
def ADR_H = open(period = AggregationPeriod.DAY) + (AvgRange/2);
def ADR_L = open(period = AggregationPeriod.DAY) - (AvgRange/2);
def iRange = (ADR_H - ADR_L) * Range;
plot Result = close > ADR_H - iRange or
close < ADR_L + iRange;
Ruby:input lenght = 21; input Range = .25; def dayHigh = DailyHighLow(AggregationPeriod.DAY).Dailyhigh; def dayLow = DailyHighLow(AggregationPeriod.DAY).DailyLow; def dayrange = dayHigh - dayLow; def AvgRange = average(DayRange, lenght); def ADR_H = open(period = AggregationPeriod.DAY) + (AvgRange/2); def ADR_L = open(period = AggregationPeriod.DAY) - (AvgRange/2); def iRange = (ADR_H - ADR_L) * Range; plot Result = close > ADR_H - iRange or close < ADR_L + iRange;
I think that's what you mean, let me know if there are any issues.
input lenght = 21;
input Thresh = .001;
def dayHigh = DailyHighLow(AggregationPeriod.DAY).Dailyhigh;
def dayLow = DailyHighLow(AggregationPeriod.DAY).DailyLow;
def dayrange = dayHigh - dayLow;
def AvgRange = average(DayRange, lenght);
plot ADR_H = open(period = AggregationPeriod.DAY) + (AvgRange/2);
plot ADR_L = open(period = AggregationPeriod.DAY) - (AvgRange/2);
def iRange = (ADR_H - ADR_L) * Thresh;
plot HTT = ADR_H + iRange;
plot HTB = ADR_H - iRange;
plot LTT = ADR_L + iRange;
plot LTB = ADR_L - iRange;
plot Result = (close < HTT and close > HTB) or
(close < LTT and close > LTB);
Result.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
Result.setDefaultColor(COLOR.cyan);
Result.setlineWeight(5);
input lenght = 21;
input Thresh = .001;
def dayHigh = DailyHighLow(AggregationPeriod.DAY).Dailyhigh;
def dayLow = DailyHighLow(AggregationPeriod.DAY).DailyLow;
def dayrange = dayHigh - dayLow;
def AvgRange = average(DayRange, lenght);
def ADR_H = open(period = AggregationPeriod.DAY) + (AvgRange/2);
def ADR_L = open(period = AggregationPeriod.DAY) - (AvgRange/2);
def iRange = (ADR_H - ADR_L) * Thresh;
def HTT = ADR_H + iRange;
def HTB = ADR_H - iRange;
def LTT = ADR_L + iRange;
def LTB = ADR_L - iRange;
plot Result = (close < HTT and close > HTB) or
(close < LTT and close > LTB);
def iRange = ((ADR_H - ADR_L) * Thresh) / 2;
Scripts used in scans can not reference other aggregations, this particular script is hard coded to use the daily. I could possibly modify it to work independently of aggregation. This may sound crazy; but I have no idea what this does, or what it is for, or why you would use it. I only modified the code that was originally provided. I'll have to look into it. Though, I suppose you would just like it based off the high and low of the 15 minute bars, is this correct?hi I was looking for this!
But when I change the scanner to for example 15min timeframe I receive this: Secondary period not allowed: Day.
Any Idea? @Joshua
Ah ok! Will test it out tomorrow! Let you know!While the bar is live, the close is where the price is at in the moment.
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
L | A Volume Pressure Moving Average For ThinkOrSwim | Indicators | 15 | |
T | Mega Moving Average For ThinkOrSwim | Indicators | 26 | |
S | Moving Average Golden Cross - Death Cross For ThinkOrSwim | Indicators | 14 | |
D | Repaints MTF Moving Average Slope Histogram For ThinkOrSwim | Indicators | 20 | |
D | Average True Range (ATR) Implied Move for ThinkorSwim | Indicators | 5 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.