OPEN-SOURCE SCRIPT

Performance Summary and Shading (Offset Version)

Modified "Recession and Crisis Shading" Indicator by haribotagada (Original Link: tradingview.com/v/ueWc5CGd/)

The updated indicator accepts a days offset (positive or negative) to calculate performance between the offset date and the input date.

Potential uses include identifying performance one week after company earnings or an FOMC meeting.

This feature simplifies input by enabling standardized offset dates, while still allowing flexibility to adjust ranges by overriding inputs as needed.

Summary of added features and indicator notes:
  • Inputs both positive and negative offset.
  • By default, the script calculates performance from the close of the input date to the close of the date at (input date + offset) for positive offsets, and from the close of (input date - offset) to the close of the input date for negative offsets. For example, with an input date of November 1, 2024, an offset of 7 calculates performance from the close on November 1 to the close on November 8, while an offset of -7 calculates from the close on October 25 to the close on November 1.
  • Allows user to perform the calculation using the open price on the input date instead of close price
  • The input format has been modified to allow overrides for the default duration, while retaining the original capabilities of the indicator.
  • The calculation shows both the average change and the average annualized change. For bar-wise calculations, annualization assumes 252 trading days per year. For date-wise calculations, it assumes 365 days for annualization.


Carries over all previous inputs to retain functionality of the previous script. Changes a few small settings:
  • Calculates start to end date performance by default instead of peak to trough performance.
  • Updates visuals of label text to make it easier to read and less transparent.
  • Changed stat box color scheme to make the text easier to read
  • Updated default input data to new format of input with offsets
  • Changed default duration statistic to number of days instead of number of bars with an option to select number of bars.


Potential Features to Add:
  • Import dataset from CSV files or by plugging into TradingView calendar


Example Input Datasets:
Recessions:
2020-02-01,COVID-19,59
2007-12-01,Subprime mortgages,547
2001-03-01,Dot-com,243
1990-07-01,Oil shock,243
1981-07-01,US unemployment,788
1980-01-01,Volker,182
1973-11-01,OPEC,485


Japan Revolving Door Elections
2006-09-26, Shinzo Abe
2007-09-26, Yasuo Fukuda
2008-09-24, Taro Aso
2009-09-16, Yukio Hatoyama
2010-07-08, Naoto Kan
2011-09-02, Yoshihiko Noda


Hope you find the modified indicator useful and let me know if you would like any features to be added!
multitimeframestatistics

オープンソーススクリプト

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

チャートでこのスクリプトを利用したいですか?


Full Disclaimer - linktr.ee/mintfinance
他のメディア:

免責事項