DailyATR levels on 1 min chart starting from open price

warrenmac

New member
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?
 
Solution
Thanks Bob, appreciate it. Hopefully someone will be able to do this for me. I'll make a post soon

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:
aapl.jpg
goog.jpg


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)...
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);
This is fantastic!!! This is what I needed and I thank you!
 
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?
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);
 
Last edited by a moderator:
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);

Away from the desk for a few days but would love to see how this looks on a chart, if possible. Thank you.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
164 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top