ATR (Average True Range) By TimeWhat is ATR By Time?
This premium indicator was inspired by my RVOL By Time indicator . It works on Stocks, Forex, Crypto and most Futures markets. Instead of calculating the ATR by recent price data, it calculates an ATR value for each candle based on that candle’s time of day.
For example, if you set the Lookback setting on this indicator to 14, then instead of calculating the ATR based on the past 14 candles, it will calculate an ATR value based on the past 14 trading sessions for each candle.
This is extremely useful for day traders in particular as it allows you to gauge the average range of candles during certain times of day instead of only by the most recent price action.
It also draws a regular ATR (optional) – so this is essentially an enhanced ATR script that gives you multiple readings on price volatility.
If you are interested, you can purchase access to the script or register for a free trial on my website: ATR By Time Feature Page .
Why Does It Cost Money?
The reason why this is a premium script that requires payment to access is because it took a lot of time, research and development in order to create. The other advantage of charging for it is that it retains exclusivity to only a select few dedicated traders.
By paying the yearly fee you get access to ALL of my premium indicators including lifetime updates and technical support.
If you don’t want to pay for this script then I completely understand and I have plenty of other free indicators and scripts that you might be interested in!
Free Trial
I am a trader myself and so I know how skeptical you might be that this indicator is worth your time and money. That is why I am offering a free trial of this indicator.
All you need to do to initiate your trial is Join My Mailing List/ on my website: zenandtheartoftrading.com
How It Works
This script uses a complex formula to calculate ATR values across distant historical bars.
Depending on the timeframe you select it will skip through historical bars to find previous bars from the same time of day. It collects these values then applies the traditional ATR formula to them.
The ATR value is determined by the maximum result of the following three calculations:
- Current high minus the current low
- The absolute value of the current high minus the previous close
- The absolute value of the current low minus the previous close
- Whichever of these three calculations comes out highest, that is your ATR for the given candle.
Once this value is calculated for historical bars the ATR indicator’s reading is typically determined by a 14-period moving average of these individual ATR values. So the ATR reading you see on your screen is an average of the past 14 ATR values.
This means that as markets expand and contract this volatility reading will adapt to the change in candle price ranges.
The difference with the ATR By Time indicator’s calculation formula is that rather than referencing recent bars it references bars based on their time of day.
For example, if you are on the 1-Hour chart and you check the ATR By Time value at 9:00AM with a Lookback period of 14, then the value you see will be the result of the ATR calculation of every 9:00AM 1-Hour candle over the past 14 trading sessions.
You can also choose to enable the ATR moving average in the settings menu if you wish. This will give you a smoothed ATR reading by averaging the current session’s ATR value with previous sessions.
This versatility gives you a sophisticated reading on price volatility which is particularly helpful for day trade setups based around market opens or market closes when volatility tends to spike.
The regular ATR indicator will not account for this on the lower timeframes, but this indicator will!
Examples
Stocks - Heatmap Scheme with regular ATR
Stocks - Price Scheme - No ATR
Stocks - Traffic Scheme - Session Average Line RMA
Stocks - Trigger Scheme - 10 sessions
Forex - RMA
Forex - No RMA
Forex - Normal ATR Stop
Forex - Session ATR Stop
Relative Volatility Index (RVI)
Volume+ (RVOL By Time of Day)This script is an enhanced volume indicator.
It calculates relative volume (RVOL) based on the average volume at that time of day (rather than using a moving average).
For example, using this indicator you can see today’s volume during the first 5-minute candle of the market open compared to the previous day’s volume at the market open. Or you can see today’s volume at the market close during the last 15-minute candle compared to the average of the past 20 days of volume at the market close.
Due to the different quantity of candlesticks in a session between Stocks and Forex/Crypto, I separated those markets into separate settings, making this an all-in-one volume indicator that works on all markets.
Settings:
Stocks
If you set the lookback period to 1 on the 5-minute chart and look at the 9:30am candle for a stock, then the current volume bar will show you what today’s volume is compared to yesterday’s 9:30am 5-minute candle.
If you set the lookback period to 15, then the current volume bar will show you what today’s volume is compared to the average of the last 15 days of 9:30am 5-minute candles.
Max Lookback: 64 Sessions
Stocks
This setting is for traders who want to use this indicator on a timeframe lower than the 5-minute chart.
Due to limitations in how many historical bars PineScript can reference, referencing 1-minute and 3-minute bars requires a lot more historical data so I separated the two to allow the 5-minute+ timeframes to have a longer lookback period.
Max Lookback: 12 Sessions
Forex/Crypto
When you set the script to Forex/Crypto, it does the same thing for stocks but calculates based on a 24-hour period.
So if you set the lookback period to 1 on the 1-hour chart and look at the 11:00am candle for a currency pair, then the current volume bar will show you what today’s volume is compared to yesterday’s 11:00am 1-hour candle.
If you set the lookback period to 10, then the current volume bar will show you what today’s volume is compared to the average of the last 10 days of 11:00am 1-hour candles.
Max Lookback: 17 Sessions
What Doesn’t It Work On?
Because I had to manually calculate how many volume candles to look back per timeframe to get the previous session’s candle, I had to hard-code the math in this script.
That means that this indicator will only work on 1m, 3m, 5m, 15m, 30m, 45m, 1h, 2h, 3h, 4h, Daily and Weekly timeframes. If you try to use it on any other timeframe it will revert to a regular volume indicator.
Why Is It Useful?
Similar to volume profile by price, this gives you a volume profile by time in a way that the default volume indicator does not.
For example, you can use this to determine when a stock has a particularly strong opening drive, or when a currency pair has a weak fake-out leading up to the London open, or for general confirmation on trading signals with time-specific volume information to work with.
Colors
The purple line and the faint gray bar is the RVOL value.
The blue number is the percentage of the current volume bar relative to RVOL.
There are four different bar color settings:
Heatmap – Changes color to be brighter based on higher RVOL
Price – Changes color based on price action (like the default TradingView volume indicator)
Traffic – Changes color based on RVOL percentages (for fast visual cues)
Trigger – Changes color only when the specified alert conditions are met
Heatmap:
Traffic:
Trigger:
Price:
Heatmap:
Turns very bright green at 2.0 RVOL
Turns light green at 1.0 RVOL
Turns normal green at 0.75 RVOL
Turns medium green at 0.5 RVOL
Turns very dark green at 0.25 RVOL
Is gray otherwise.
Price:
Turns red if the price action candle closed bearish.
Turns green if the price action candle closed bullish.
Traffic:
Turns red if RVOL is between 1.0 and 1.5.
Turns orange if RVOL is between 1.5 and 2.0.
Turns dark green if RVOL is between 2.0 and 3.0.
Turns bright green if RVOL is above 3.0.
Is gray otherwise.
Trigger:
Turns teal if any of the given alert conditions in the user settings are met.
Alerts
Alerts are optional. You have to set them like any other indicator, by creating a new alert and selecting this indicator.
If you leave the "Alert At RVOL %" setting at 0, then alerts will only be triggered if the current candle exceeds the 1.0 (100%) RVOL level.
If you change the "Alert At RVOL %" setting then alerts will be triggered if the RVOL percentage (blue number) exceeds your given value. The blue number is a percentage of the average, so if it’s at 0.5, then it’s 50% of the average.
Notes
- This indicator only works with regular time bars. It will not work with range, tick, renko etc.
- This script has lookback limitations due to restrictions on how many historical bars PineScript can reference. The lookback limit varies based on the market type you choose. The more bars required for calculation the lower the lookback limit.
- If you use it on the Daily timeframe the lookback period will count as 1 week. If you use it on the Weekly timeframe the lookback period will count as 1 month. So a Lookback of 3 on the Daily would be 3 weeks of averages, a Lookback of 5 on the Weekly would be 5 months of averages (for that Day of Week or Week number).
- Big thanks to @tb12345 for the idea and for helping to field-testing the indicator!
Dorsey InertiaThis indicator was originally developed by Donald Dorsey (Stocks & Commodities, V.13:9 (September, 1995): "Refining the Relative Volatility Index").
Inertia is based on Relative Volatility Index (RVI) smoothed using linear regression.
In physics, inertia is the tendency of an object to resist to acceleration. Dorsey chose this name because he believes that trend and inertia are related and that it takes more effort and energy to reverse the direction of a stock or market than to keep it in the same direction. He argues that the volatility is the simplest and most accurate measure of inertia.
When the indicator is below 50, it signals bearish market sentiment and when the indicator is above 50 it signals a bullish trend.
Good luck!
Relative Volatility IndexCorrected Relative Volatility Index. This indicator was originally developed by Donald Dorsey (Stocks & Commodities V.11:6 (253-256): The Relative Volatility Index).
The indicator was revised by Dorsey in 1995 (Stocks & Commodities V.13:09 (388-391): Refining the Relative Volatility Index).
I suggest the refined RVI with optional settings. If you disabled Wilder's Smoothing and Refined RVI you will get the original version of RVI (1993, as built-in).
Also, you can choose an algorithm for calculating Standard Deviation.
RSI & RVI OB/OS Alert ArrowThe script shows arrows on bars that are in overbought or oversold, based on the set parameters of Relative Strength Index ( RSI ) and Relative Volatility Index (RVI).
Also there is a universal allert, which includes both conditions - overbought and oversold.
You can change the period of RSI and RVI, as well as the upper and lower boundaries of these indicators.