OPEN-SOURCE SCRIPT

Window Seasonality Indicator

122
This is a time window seasonal returns indicator. That is, it will provide the mean returns for a given time window based on a given number of lookbacks set by the user. The script finds matching time windows, e.g., 1st week of March going back 5 years or 9:00-10:00 window of every day going 50 days, and then calculates an average return for that window close price with respect to the close price in the immediately preceding time window, e.g. last week of February or 8:00-9:00 close price, respectively.

There are 4 input options:

1) Historical Periods to Average: Set the number of matching historical windows with which to calculate an average price. The max is 730 lookback windows. Note: for monthly or weekly windows, setting too large a number will cause the script to error out.
2) Use Open Price: calculates the seasonal returns using the open price rather than close price.
3) Show Bands: select from 1 Gaussian standard deviation or a nonparamateric ranked confidence interval. As a rough heuristic, the Gaussian band requires at least 30 lookback periods, and the ranked confidence interval requires 50 or more.
4) Upper Percentile: set the upper cutoff for ranked confidence interval.
5) Lower Percentile: set the lower cutoff for ranked confidence interval.

Please be aware, this indicator does not use rigorous statistical methodology and does not imply predictive power. You'll notice the range bands are very wide. Do not trade solely based on this indicator! Certain time windows, such as weekly and monthly, will make more sense applied to commodities, where annual cycles play a role in its supply and demand dynamics. Hourly windows are more useful in looking at equities markets. I like to look at equities with 1-hr windows to see if there is some pattern to overnight behavior or for market open and close.

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.