An indicator in a separate pane that calculates Sharpe and Sortino ratios from the chart symbol's periodic returns, using up to a chosen number of monthly or other periods.
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
198 lines of Pine Script v5 from edu_std/sharp_ratio.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
The comparison can be a fixed annual rate or the returns of a benchmark symbol, in which case an information ratio is used. Settings include the returns timeframe, period count, rate or benchmark symbol, and an optional info table with size, position and colours. It depends on available history.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Returns timeframe
timeframe
1M
tfInput
Max no. of periods used
int
60
numOfTFsInput
Benchmark return type
string
BM01
useFixedInput
Risk-free rate of return (%)
float
2
percentageInput
Benchmark symbol
symbol
AMEX:SPY
symbolInput
Show info table
bool
true
showInfoBoxInput
Size
string
normal
infoBoxSizeInput
↕
string
bottom
infoBoxYPosInput
↔
string
right
infoBoxXPosInput
infoBoxColorInput
color
GRAY30
infoBoxColorInput
infoBoxTxtColorInput
color
WHITE
infoBoxTxtColorInput
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 measures the chart symbol’s percentage change from the opening price at the start of each US presidential term and plots those values as histogram columns in a separate pane. Columns are offset so each administration appears separately, with a s
This indicator scans a pasted list of symbols for RSI directional momentum and shows matching long and short signals in a table in a separate pane. The user chooses continuous break, continuous retracement, flip break, flip retracement, divergence, or hidden d
This indicator builds a TradingView table in a separate pane and fills its cells with fixed placeholder text according to whether each row and column index is even or odd. Users set the table position, the number of rows and columns, and the background, frame,
Donald SPX - Options Trading is an indicator designed to assist SPX index option traders by tracking session benchmarks and multi-timeframe moving average data. It calculates a 200-period weighted moving average (WMA) and requests multi-timeframe bar data from
Calculates and plots a weighted histogram of constituent returns for major market indices (NDX, SPX, DJIA, and RUT) in a separate pane. Each histogram bin reflects the summed weights of members within that percentage return bracket. The script renders vertical
KamaFama is an indicator that translates a Freqtrade trading strategy into Pine Script for visualization. It combines Kaufman Adaptive Moving Average (KAMA), MAMA/FAMA calculations derived via Hilbert Transform, Williams %R, and correlation trend filters to ev