DailyATR levels on 1 min chart starting from open price

warrenmac

New member
VIP
Plus
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)...
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?

I posted this in answer to another question. One of the indicators shows daily ATR levels in real time.

https://usethinkscript.com/threads/atr-risk-control-indicator-for-thinkorswim.6765/post-143424

Regards,
Bob
 
Hi Guys,

What I am really wanting is just the daily ATR to appear on my chart as 2 lines that adjust as day goes based on the Open price not the previous day close. so if the daily ATR for last 14 days is 5.50 id like that to display on any timeframe from opening price and adjust. I see some similar things but not this. Does anyone have a script for this? Thank you!
 
Hi Guys,

What I am really wanting is just the daily ATR to appear on my chart as 2 lines that adjust as day goes based on the Open price not the previous day close. so if the daily ATR for last 14 days is 5.50 id like that to display on any timeframe from opening price and adjust. I see some similar things but not this. Does anyone have a script for this? Thank you!
OK...how about this. Shows 3 min chart of NVDA with open, 14 day period of atr above and below open, and vwap. And here is the link to the chart: http://tos.mx/!l0MAhNx0

Regards,
Bob
NVDA.jpg
 
Hi Guys,

What I am really wanting is just the daily ATR to appear on my chart as 2 lines that adjust as day goes based on the Open price not the previous day close. so if the daily ATR for last 14 days is 5.50 id like that to display on any timeframe from opening price and adjust. I see some similar things but not this. Does anyone have a script for this? Thank you!
please elaborate, your request is incomplete.
atr is 1 number, much smaller than price. how are line(s) supposed to be drawn to represent it?
 
Hi Guys,

What I am really wanting is just the daily ATR to appear on my chart as 2 lines that adjust as day goes based on the Open price not the previous day close. so if the daily ATR for last 14 days is 5.50 id like that to display on any timeframe from opening price and adjust. I see some similar things but not this. Does anyone have a script for this? Thank you!

you stated "
based on the Open price not the previous day close

you are missing quite a bit of information, but if i had to take a wild guess you want the 2 lines, one line showing atr added to the open and another line showing subtracted from the open? you are going to have to explain a bit more

assuming my assumption is what you want... then that brings me to my next question?
you want the opening price of the last bar on any intraday chart? (since you didnt specify what bar/time )
 
please elaborate, your request is incomplete.
So if the Daily ATR is 5.00 wherever the days price opens is where the 5 dollar spread starts and the lines adjust and maintain a 5.00 spread between until the price actually does get to a 5.00 gap in which case the lines stay there for rest of day because ATR was fulfilled. If price opened at 100.00 the 2 lines would be 102.50 and 97.50. From there the lines based on the high or low swing intraday. Like if it went up to 104 and is now going downtown the max bottom line would be 99.
 
I probably can't explain it right. I adjust it myself with lines as the day goes to see where max high or low might make that 5.00 spread true from difference between high and low. I guess I actually start 105 and 95 until market finds direction then I moves lines as prices goes . Sorry for the confusion I'm sure I'll never explain it right lol
 
if you cant explain it, no one can code it. you still never answered my question as to what you mean by opening bar. which opening bar? every bar has a open.
 
@warrenmac

This may be what you are looking for: 14 period Atr, with todays open, and yesterdays ATR so that you can see whether todays price action is reaching yesterdays atr. Other wise, I give up.

PS: Yesterdays ATR is going to slightly different than Todays (at the end of the day) as you rotate in another day on a 14 period atr. I use a larger number of days as it gives me a more "averaged" result and less prone to dramatic changes based on one day alone.

Regards,
Bob

Code:
#ATR Lines##############################
def AP = AggregationPeriod.DAY;
plot D_Open = open(period = AP);
D_Open.SetDefaultColor(CreateColor(209, 255, 3));
D_Open.SetPaintingStrategy(PaintingStrategy.POINTS);
D_Open.SetLineWeight(2);
D_Open.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];

plot D_atru = open(period = AP)+ atr;
D_atru.SetDefaultColor(CreateColor(209, 255, 3));
D_atru.SetPaintingStrategy(PaintingStrategy.DASHES);
D_atru.SetLineWeight(3);
D_atru.HideTitle();

plot D_atrd = open(period = AP)- atr;
D_atrd.SetDefaultColor(CreateColor(209, 255, 3));
D_atrd.SetPaintingStrategy(PaintingStrategy.DASHES);
D_atrd.SetLineWeight(3);
D_atrd.HideTitle();

Addlabel(yes,"ATR_Length: " + ATRLngth +  "  ATR: " + atr,color.yellow);
 
Last edited:
Ok i have a better way to explain. 14 day ATR before the open of the day is what figure to be used for the current day. lets say it is 5.00. whatever the HOD is subtract 5 bucks from it and that will be the line. whatever low of day is add 5 bucks to it and that will be the upper line. the lines will keep self adjusting until the ATR is hit (if it gets there) at which point the lines dont move anymore. Does this make more sense? Sorry
 
It's just whatever the 14 day ATR was before market open added to the low and subtracted from the high

Until the range is met at which point the lines don't adjust anymore
 
It's just whatever the 14 day ATR was before market open added to the low and subtracted from the high

Until the range is met at which point the lines don't adjust anymore
Sounds like you want to simply determine if the atr range has been met during the days action. You could do that simply by modifying the label so you can directly compare at a glance without referring to the chart whether todays range is equal to, less than, or greater and than the atr. Switch the following code for the one in the code above which would give you this visual comparison.

Addlabel(yes,"ATR_Length: " + ATRLngth + " ATR: " + atr + " TR: " + tr ,color.yellow);
 
Sounds like you want to simply determine if the atr range has been met during the days action. You could do that simply by modifying the label so you can directly compare at a glance without referring to the chart whether todays range is equal to, less than, or greater and than the atr. Switch the following code for the one in the code above which would give you this visual comparison.

Addlabel(yes,"ATR_Length: " + ATRLngth + " ATR: " + atr + " TR: " + tr ,color.yellow);
Well actually I like to see how much more room it has in the direction it's going if it were to keep trending intraday that direction. Also of course to see if atr has been hit already too. But off the days opening price not the previous days close. I've found it good to exclude the gap up or down and calculate the potential days range off high and low of day.
 
Well actually I like to see how much more room it has in the direction it's going if it were to keep trending intraday that direction. Also of course to see if atr has been hit already too. But off the days opening price not the previous days close. I've found it good to exclude the gap up or down and calculate the potential days range off high and low of day.
You are asking that the atr keep being added or subtracted from todays High or Low "as it develops". This doesn't make sense, since you are simply extending the atr artificially so that it is no longer representative of the atr. I believe what you mean is that the remainder of the atr as the price action evolves is either added to today's high or subtracted from today's low with the starting point being todays open, where they are both equidistant from the open. If price action continues to move toward the high, the atr line above the high would remain the same as the atr line below the low would move upward. When todays high reaches the atr line above, the calculations stop for both the higher atr line as well as the lower one.

If price moved upward from the open and never looked back, the lower atr line would actually stop around the open as the above atr line was reached by the high of the day.


I actually did this for the Average Daily Range for my intraday charts and did not find it useful as a trading tool, however that is just me. Some coders more proficient than myself could help code this more easily than I could and I am not oriented toward revisiting this indicator. If my restatement of what you mean coincides with what you want you could use that to seek assistance.

Regards,
Bob
 
You are asking that the atr keep being added or subtracted from todays High or Low "as it develops". This doesn't make sense, since you are simply extending the atr artificially so that it is no longer representative of the atr. I believe what you mean is that the remainder of the atr as the price action evolves is either added to today's high or subtracted from today's low with the starting point being todays open, where they are both equidistant from the open. If price action continues to move toward the high, the atr line above the high would remain the same as the atr line below the low would move upward. When todays high reaches the atr line above, the calculations stop for both the higher atr line as well as the lower one.

If price moved upward from the open and never looked back, the lower atr line would actually stop around the open as the above atr line was reached by the high of the day.


I actually did this for the Average Daily Range for my intraday charts and did not find it useful as a trading tool, however that is just me. Some coders more proficient than myself could help code this more easily than I could and I am not oriented toward revisiting this indicator. If my restatement of what you mean coincides with what you want you could use that to seek assistance.

Regards,
Bob
Hi. Yes! That's exactly what I'm wanting!
 
OK, good. Send this out as a request. Make sure you indicate the starting point is todays open, and the atr calc starts with the previous days trading range, NOT TODAY'S, plus the number of previous days you want so that the results are not skewed by todays minimal starting range (see my code for todays range).

Good luck

Bob
 
OK, good. Send this out as a request. Make sure you indicate the starting point is todays open, and the atr calc starts with the previous days trading range, NOT TODAY'S, plus the number of previous days you want so that the results are not skewed by todays minimal starting range (see my code for todays range).

Good luck

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

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
568 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