OPEN-SOURCE SCRIPT

Valuation Tool V2

Explanation:
Inputs:

equitySymbol: The symbol for the equity index (default is "SPY" for the S&P 500 ETF).
bondSymbol: The symbol for the bond market (default is "TLT" for the 20+ Year Treasury Bond ETF).
Fetch Data:

equityClose and bondClose retrieve the daily closing prices for the specified equity and bond symbols.
Relative Spread Calculation:

The relative spread is calculated by dividing the equity index's closing price by the bond market's closing price.
Thresholds:

The 50-period Simple Moving Average (SMA) of the relative spread is calculated.
Overvalued and undervalued thresholds are set at 10% above and below the SMA, respectively.
Normalized Spread:

The normalized spread is calculated to normalize the relative spread around its SMA, which helps in visualizing it as an oscillator.
Plotting:

The normalized spread is plotted as a blue line in the oscillator panel.
Overvalued and undervalued thresholds are plotted as dotted lines at 0.1 and -0.1, respectively.
The zero line is plotted as a solid orange line.
Background colors indicate overvalued (red) and undervalued (green) regions.
Signals:

Buy signals are plotted when the normalized spread crosses above the undervalued threshold (-0.1).

Sell signals are plotted when the normalized spread crosses below the overvalued threshold (0.1).

This script plots the relative spread as an oscillator, allowing you to see overvalued and undervalued conditions in a separate panel. You can further customize the look and feel based on your preferences and trading strategy.
educationalforecastingFundamental Analysis

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항