Thanks Bob, appreciate it. Hopefully someone will be able to do this for me. I'll make a post soon
#Day Lines##############################
def AP = AggregationPeriod.DAY;
plot D_Open = open(period = AP);
D_Open.SetDefaultColor(color.yellow);
D_Open.SetPaintingStrategy(PaintingStrategy.POINTS);
D_Open.SetLineWeight(2);
D_Open.HideTitle();
plot D_High = high(period = AP);
D_High.SetDefaultColor(color.green)...
This is fantastic!!! This is what I needed and I thank you!I had some time so I created what I presume you want. The caveat is that it is more logical to use the previous days close rather that the days open, since the atr takes that into account. In any event here is the code and 2 examples from todays trade for AAPL and GOOG on a 3 minute chart:View attachment 22285View attachment 22288
Code:#Day Lines############################## def AP = AggregationPeriod.DAY; plot D_Open = open(period = AP); D_Open.SetDefaultColor(color.yellow); D_Open.SetPaintingStrategy(PaintingStrategy.POINTS); D_Open.SetLineWeight(2); D_Open.HideTitle(); plot D_High = high(period = AP); D_High.SetDefaultColor(color.green); D_High.SetPaintingStrategy(PaintingStrategy.POINTS); D_High.SetLineWeight(2); D_High.HideTitle(); plot D_Low = low(period = AP); D_Low.SetDefaultColor(color.red); D_Low.SetPaintingStrategy(PaintingStrategy.POINTS); D_Low.SetLineWeight(2); D_Low.HideTitle(); input AtrLngth = 14; def tr = TrueRange (high(period = ap), close(period = ap), low(period = ap)); def AtrA = Round(ExpAverage(tr, AtrLngth), 2); def Atr = atra[1]; def uatr = high(period = AP)+ (atr-tr); def datr = low(period = AP)- (atr-tr); plot atru = (if uatr <= D_open then double.nan else uatr); atru.SetDefaultColor(color.yellow); atru.SetPaintingStrategy(PaintingStrategy.DASHES); atru.SetLineWeight(3); atru.HideTitle(); plot atrd = (if datr >= D_Open then double.nan else datr); atrd.SetDefaultColor(color.yellow); atrd.SetPaintingStrategy(PaintingStrategy.DASHES); atrd.SetLineWeight(3); atrd.HideTitle(); Addlabel(yes,"ATR_Length:" + ATRLngth + " ATR: " + atr + " TR: " + tr + " Remainder: " + round((atr-tr),2),color.yellow);
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
The reason I want to see the range from the open is because the stocks I look at that are trending strongly seem to still run close to ATR range after open regardless of the overnight gap up or down.This is fantastic!!! This is what I needed and I thank you!
Here is what you're looking for.Hi. Your indicators are AWESOME. I was wondering if there is an indicator that shows the Daily ATR levels as 2 lines but on all timeframes that adjust as the day goes? I havent been able to find this. But I only want the daily ATR levels. Is this possible?
#Follow ken on Twitter @KRose_TDA
#Ken Rose wrote the original script for market_Maker_Move to better enable traders
#to define trades
#
#Adapted by MBOX56 to use ATR instead of MMM along with other modifications:
#Added Hint code
#Added all ATR code
#Added a show_plot switch
#Added all Chart Bubble code
#
#
#HINT: Will find the ATR range and display a Label and a Plot with a Chart Bubble for the Input number of bars and the ATR Type and the ATR value. \nThe Label and Plot with Chart Bubble can each be individually turned On or Off. \n\nNote that you need to Set the Time Expansion to at least 5 in Chart Settings Setup to display the ATR Plot.
#Set ATR Type and lookback value and number of ATR's
input ATR_type = AverageType.wilders;
input num_bars = 14;
input ATR_times = 1.0;
#determines if we show the label
input show_label = yes;
#determines if we show the Plot and Chart Bubble
input show_plot = yes;
#Chart Bubble Offset
input bubble_offset_upper = 5;
input bubble_offset_lower = 5;
#Calculate the ATR value
def ATR_R = If BarNumber() >= num_bars Then
MovingAverage
(ATR_type, TrueRange(high, close, low),num_bars) * ATR_times
Else double.NaN;
def ATR = round(ATR_R,2);
#Display Label
AddLabel(show_label and BarNumber() >= num_bars, ATR_times + " X ATR: +/- " + if ATR > 0.0
then AsDollars(ATR) else "", GetColor(1));
#Only finds the last bar on chart
def bar = if IsNaN(close)
then bar[1]
else BarNumber();
def Highest_Bar = HighestAll(bar);
#Assigns Close + ATR if at last bar on chart
def barCount = if show_plot and bar == Highest_Bar
then (close + ATR)
else double.NaN;
#Plots the ATR Upper Line
plot upper = if show_plot and Highest_Bar == bar
then HighestAll(barCount)
else Double.NaN;
upper.SetDefaultColor(Color.GREEN);
upper.SetPaintingStrategy(PaintingStrategy.LINE);
upper.SetLineWeight(3);
#Adds a chart Bubble to ATR Upper Line
AddChartBubble(show_plot and (barnumber() - bubble_offset_upper) == highest_bar, upper, "+ " + ATR_times + " ATR", Color.GREEN, yes);
#Assigns Close - ATR if at last bar on chart
def barCount2 = if Highest_Bar == bar
then (close - ATR)
else Double.NaN;
#Plots the ATR Lower Line
plot lower = if show_plot and Highest_Bar == bar
then HighestAll(barCount2)
else Double.NaN;
lower.SetDefaultColor(Color.RED);
lower.SetPaintingStrategy(PaintingStrategy.LINE);
lower.SetLineWeight(3);
#Adds a chart Bubble to ATR Lower Line
AddChartBubble(show_plot and (barnumber() - bubble_offset_lower) == highest_bar, lower, "- " + ATR_times + " ATR", Color.RED, no);
Here is what you're looking for.
Code:#Follow ken on Twitter @KRose_TDA #Ken Rose wrote the original script for market_Maker_Move to better enable traders #to define trades # #Adapted by MBOX56 to use ATR instead of MMM along with other modifications: #Added Hint code #Added all ATR code #Added a show_plot switch #Added all Chart Bubble code # # #HINT: Will find the ATR range and display a Label and a Plot with a Chart Bubble for the Input number of bars and the ATR Type and the ATR value. \nThe Label and Plot with Chart Bubble can each be individually turned On or Off. \n\nNote that you need to Set the Time Expansion to at least 5 in Chart Settings Setup to display the ATR Plot. #Set ATR Type and lookback value and number of ATR's input ATR_type = AverageType.wilders; input num_bars = 14; input ATR_times = 1.0; #determines if we show the label input show_label = yes; #determines if we show the Plot and Chart Bubble input show_plot = yes; #Chart Bubble Offset input bubble_offset_upper = 5; input bubble_offset_lower = 5; #Calculate the ATR value def ATR_R = If BarNumber() >= num_bars Then MovingAverage (ATR_type, TrueRange(high, close, low),num_bars) * ATR_times Else double.NaN; def ATR = round(ATR_R,2); #Display Label AddLabel(show_label and BarNumber() >= num_bars, ATR_times + " X ATR: +/- " + if ATR > 0.0 then AsDollars(ATR) else "", GetColor(1)); #Only finds the last bar on chart def bar = if IsNaN(close) then bar[1] else BarNumber(); def Highest_Bar = HighestAll(bar); #Assigns Close + ATR if at last bar on chart def barCount = if show_plot and bar == Highest_Bar then (close + ATR) else double.NaN; #Plots the ATR Upper Line plot upper = if show_plot and Highest_Bar == bar then HighestAll(barCount) else Double.NaN; upper.SetDefaultColor(Color.GREEN); upper.SetPaintingStrategy(PaintingStrategy.LINE); upper.SetLineWeight(3); #Adds a chart Bubble to ATR Upper Line AddChartBubble(show_plot and (barnumber() - bubble_offset_upper) == highest_bar, upper, "+ " + ATR_times + " ATR", Color.GREEN, yes); #Assigns Close - ATR if at last bar on chart def barCount2 = if Highest_Bar == bar then (close - ATR) else Double.NaN; #Plots the ATR Lower Line plot lower = if show_plot and Highest_Bar == bar then HighestAll(barCount2) else Double.NaN; lower.SetDefaultColor(Color.RED); lower.SetPaintingStrategy(PaintingStrategy.LINE); lower.SetLineWeight(3); #Adds a chart Bubble to ATR Lower Line AddChartBubble(show_plot and (barnumber() - bubble_offset_lower) == highest_bar, lower, "- " + ATR_times + " ATR", Color.RED, no);
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
T | How to remove predicted levels on the right of indicator | Questions | 1 | |
R | Missing Keltner Levels | Questions | 2 | |
![]() |
Option Price Levels Indicator for TOS | Questions | 1 | |
D | Script for 4 hour candle high/low price levels | Questions | 1 | |
R | Plot Support & Resistance Levels based on inputs | Questions | 4 |
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.