Session Volatility Calculator

Hey traders!

This script calculates the average volatility of trading sessions.

You specify a start date, an end date, and a session time (eg. market open, Asian session etc)

The script then scans through all the price action on your chart and calculates the average price movement during that specified period.

What Is It For?
I created this script for my own purposes when developing certain strategies and testing certain ideas.

The purpose of this script is to give you an idea of how much price tends to move during certain times of day for certain markets.

You could think of it as a "session's average true range".

In crypto and forex this might be how much price tends to move on certain pairs during the Australian/Asian session, or the European session, or the overnight U.S. session etc.

In stocks this might be how much a symbol tends to move during the first hour of the day or the last hour of the day.

The point of calculating this information is for better understanding how markets move during certain times of day.

It's not a perfect science obviously since some days can be wilder than others depending on what fundamental events are developing, but it's useful information to have for times when there are no expected volatility-inducing events.

This info can help with optimizing targets and stop loss placement for certain day-trading strategies, and just generally getting an idea of what kinds of moves you might reasonably expect out of overnight positions or certain times of day etc - or at least that's what I use it for.

Hover your mouse over the "i" symbol to get more information on the script's settings, but here's a brief description:

Start Date: The date to begin calculating from (set to 1000 by default so it scans the entire chart).
End Date: The date to stop calculating (set to 2099 by default so it scans the entire chart)
Time Session: This is the time session during the day that you want to analyze.
Color Background: If turned on, this setting changes the background color to highlight the session.

Indicator Values
The indicator outputs a handful of values onto your chart. This is what the colors correspond to:

Top-Right Box: The average price range during the given time of day over historical price action.

Green Number: The recent session's highest price.
Red Number: The recent session's lowest price.
Purple Number: The recent session's price range (high - low).
Orange Number: The recent session's range ÷ the average (outputs a relative % of the average).
릴리즈 노트: Removed some redundant code that I accidentally left in for testing purposes
오픈 소스 스크립트

진정한 TradingView의 정신에 따라, 이 스크립트의 작성자는 스크립트를 오픈소스로 게시했기에 거래자들이 이해하고 확인할 수 있습니다. 작가님께 건배! 스크립트를 무료로 사용할 수 있지만, 게시물에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 당신은 스크립트를 차트에 사용하기 위해 그것을 즐겨찾기 할 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?
My Resources Hub: https://theartoftrading.com
FREE YouTube Lessons: http://rebrand.ly/zyt
FREE Pine Script Basics Course: http://rebrand.ly/zpsbc
Pine Script MASTERY Course: http://rebrand.ly/zpsmc
My Indicators & Strategies: http://rebrand.ly/zmisc


nice job any way you can add market sessions? instead of specific time
+1 응답
@RobinhoodFX, Great idea man I'll give it a shot, sometimes that can be a bit tricky to hard-code due to Daylight Savings Time and whatnot but I'll look into adding some session presets :)
RobinhoodFX ZenAndTheArtOfTrading
@ZenAndTheArtOfTrading, yeah I have absolutely no idea what im talking about here coding scares me but their are a couple that I have to highlight specific trading times but they don't help with whats the avg pip move like yours. What's your twitter I have to set up my uphold account so I could send Bat but I would love to send you a tip for the help
+1 응답
@RobinhoodFX, haha I feel you! I appreciate that, I recently set up my own Uphold for doing the same thing.

My twitter is @TradeWisdom but don't feel obliged! Take care man and best of luck with your trading, I'll let you know if I manage to implement market sessions to this script :)
Hey, amazing work. tried loading this on lower timeframes and its not responding?

I applied it on the 12min chart and i only need the first two candles for tokyo 0 utc open. thanks
can u open the dm pls
naba_naif naba_naif
Nice Job as always!

I as wondering if you could use the analyze this in a form of a ATR but instead of taking the past 14 candles by default it could take a certain amount of time each day where it calculate the average candle range from this allows us to compare previous ATR around the same historical time to the recent ATR so we can see what he average movement around a specific time is and compare it to the recent ATR to see if the market is active around that time.

You can kind of do it with this scrip as well by reducing the 'Time session to analyze' to lets say 00:00 all the way to 23:00 (so you need to have 24X of this indicator on your cart) if you look at the 1H chart but doing it like that

But can you also make it display the Average ATR around the same time within a ATR indicator?