A Pine v4 indicator in a separate pane that computes a rolling Sharpe-style ratio over a 200-bar window and compares it with a benchmark symbol, SPY by default.
1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
74 lines of Pine Script v4 from TradingView_old/Sharpe_Mansfield.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
An optional reference interest rate series can be subtracted, a Hull moving average smooths the output, and a moving average of the result can be displayed. Settings cover the window, benchmark, smoothing and average period. Input labels are in Spanish.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Fuente:
source
close
src
Length:
int
200
len
¿Usar tasa libre de riesgo?
bool
false
use_rf
Tasa libre de riesgo:
string
DTB3
Tasa libre de riesgo:
Benchmark:
string
SPY
Benchmark:
Suavizado:
int
5
smoothness
¿Mostrar media móvil?
bool
true
mostrar_sma
Media Móvil:
int
200
sma_period
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.
This indicator calculates the distribution of close-to-close percentage changes using rate of change on closing prices. It bins percentage changes into intervals of 0.25 percent increments from negative to positive values and plots a normalized cumulative hist
This indicator plots a Supertrend-based trend-following setup in a separate pane and skips conditions it treats as a sideways market. A volatility range is built from an ATR value, with RMA, SMA, EMA, or WMA smoothing, or from a fixed point distance. Optional
This indicator plots candle range and open-to-close movement as percentages in a separate pane. Range is the high-low difference divided by the low, and change is the close-open difference divided by the open. Both series draw as columns. Teal columns show ran
The Mojito v3 Strategy indicator evaluates volatility term structure by calculating the ratio between front-month and second-month VIX futures contracts. It smooths this ratio using a configurable median filter and compares the result against user-defined uppe
Calculates dynamic modeling values by applying a mathematical logistic differential equation to price change over a specified lookback length. It measures price momentum relative to the recent high-low price range. The script plots positive and negative logist
MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes us