This is my attempt to bring an open source Seasonality indicator to TradingView. There are still outstanding issues I couldn't figure out, so I am hoping some more seasoned Pine Script coders can take the lead from here.
The indicator plots the avg % change per bar for all complete years, up to 20 years back.
It will only show in the daily resolution.
For charts with more data, you need to scroll back a bit to get the line to display.
Use Offset Adjust in the menu for charts that do not align perfectly to the start of the year.
Use Smoothing in the menu to apply an EMA to the line.
The panel shows YTD % gain, 5-day rolling seasonality, and 20-day rolling seasonality.
Known Issues
Does not work for tickers with over 10,000 bars of data.
Some tickers do not align correctly.
Only works with tickers that have ~252 bars a year.
Areas for Improvement
Figure out a way to use barssince() to get the precise amount of bars for each year. This will make the seasonality calculation and automatic offset more accurate.
Have an option for calendar week, month, and year seasonality.
릴리즈 노트
Cleaned up the script.
릴리즈 노트
Cleaned up the code some more so it is easier to read.
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.