The script calculates the yield spread between long-term and short-term US Treasury yields (T10Y2Y or manual US10Y minus US02Y) and plots the spread line on a separate pane.
1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
Source Code
The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.
Overview
TN Yield Spread Sovereign v6 signals long entries on steepening beyond a user threshold in reversion mode or SMA crossover in momentum mode, then closes the position on the opposite condition. Main settings switch data sources, toggle between reversion and momentum regimes, adjust the inversion threshold, and set the SMA length. The strategy uses 100 percent equity position sizing with no stop loss and draws the spread in green above the threshold or red below it.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
數據獲取模式
enum
SpreadMode.Manual
mode
長期債券收益率
symbol
TVC:US10Y
longSym
短期債券收益率
symbol
TVC:US02Y
shortSym
FRED 直接利差代號
symbol
FRED:T10Y2Y
fredSym
訊號規訓路徑
enum
SignalRegime.Reversion
regime
倒掛閾值
float
0.0
thresh
動能 SMA 長度
int
20
smaLen
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
Buy The Dips - MA200 Optimised is a mean-reversion strategy that measures short-term percentage price changes alongside a simple moving average trend filter. It opens long positions when price experiences a steep drop exceeding three percent while remaining ab
This strategy combines Bollinger Bands, Bollinger Band Width, and the Relative Strength Index (RSI) for mean-reversion trades. It enters long when price crosses below the lower band with oversold RSI, or when band width contracts under low volatility. Short en
This strategy plots in a separate pane and tests a selected oscillator with one of six entry logics: moving average, moving-average crossover, zero cross, extremes, mean reversion, or take profit. Users scale and time-adjust one of three oscillators and can li
The oversold strategy identifies oversold conditions using the relative strength index with a 14 period. It applies an arithmetic linear moving average with a 20 period for trend filtering and requires the price to stay within 15 percent of this average. Stoch
This strategy calculates the WaveTrend oscillator using exponential moving averages of typical price and plots two signal lines alongside overbought and oversold thresholds in a separate pane. It enters long positions when the primary line crosses above the si
This mean-reversion strategy combines multi-timeframe exponential moving averages, Bollinger Bands, and the Relative Strength Index. It generates long and optional short trade signals when price interacts with the Bollinger Bands alongside RSI threshold confir