Calculating Sharpe and Sortino Ratios from Periodic Returns
Summary
This indicator calculates Sharpe and Sortino ratios from sampled returns for the chart instrument. Users select a return timeframe and maximum sample length, then choose either a fixed annual benchmark rate or the returns of a comparison instrument. In the instrument-comparison mode, it aligns chart and benchmark prices to calculate comparable periodic returns. It displays sampled returns and reports average returns alongside both ratios.
The script requires the chosen return timeframe to be at least as large as the chart timeframe, and it uses monthly periods as its calculation base. When higher-timeframe data is requested, the implementation offsets historical requests to limit lookahead bias. The document describes the calculation and display choices, but gives no example outputs or validation against other implementations. Ratio values depend on the selected benchmark, sample window, and return frequency, so they should be interpreted in that context rather than as standalone measures of future performance.
Key ideas
- The indicator computes Sharpe and Sortino ratios from a bounded series of periodic returns.
- The benchmark can be a fixed annual rate or the returns of a selected instrument.
- Instrument comparisons use time-aligned prices to derive comparable returns.
- The requested return timeframe must be equal to or higher than the chart timeframe.
- Ratio values depend on the benchmark, sampling interval, and amount of history used.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.