Kaschko's Seasonal Trend

Kaschko アップデート済   
This script calculates the average price moves (using each bar's close minus the previous bar's close) for the trading days, weeks or months (depending on the timeframe it is applied to) of a number of past calendar years (up to 30) to construct a seasonal trend which is then drawn as a seasonal chart (overlay) onto the price chart. Supported are the 1D,1W,1M timeframes.

The seasonal chart is adjusted to the price chart (so that both occupy the same height on the overall chart) and it is also de-trended, which means that the seasonal chart's starting value is the same in each year and the progression during the year is adjusted so that no abrupt gap occurs between years and the highs and lows of consecutive years of the seasonal chart (if projected over more than one year) are also at the same level. Of course, this also means that the absolute value of the seasonal chart has no meaning at all.

You can configure the number of bars the seasonal chart is drawn into the future. This projection shows how price could move in the future if the market shows the same seasonal tendencies like in the past. On the daily chart, the trading week of year (TWOY), trading day of month (TDOM) and trading day of year (TDOY) are shown in the status line.

Caution is advised as seasonality is based on the past. It is not a reliable prediction of the future. But it can still be used as an additional confirmation or contradiction of an otherwise recognized possible impending trend.

I have used a virtually identical indicator for a long time in a commercial software package popular among futures traders, but have not found anything comparable here. Therefore I implemented it myself. I hope you find it useful.

1. minor bug fixed in the scaling algorithm
2. instead of always using fixed 252 trading days on the daily timeframe, the script now offers the option to use a variable number of trading days. The default is still fixed 252 trading days. When using a variable number of trading days, the actual number used results from the number of trading days within the years of the lookback period. You can choose to use the minimum, the maximum or the average number of trading days for all years. For crude oil futures (CL1!), the script will still use between 251 and 253 trading days. However, for Bitcoin (BTCUSD) it will actually use between 362 and 365 (or even 366) trading days. The actual number used is written to Pine Log.

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。