TradingView Backtesting

Rolling Returns for TradingView Strategies: Overlap and Window Choice

Rolling returns measure equity growth over a fixed span, then move that span through history. With no external cash flows, each return is ending equity / starting equity - 1. A 12-month window advanced monthly shares 11 months with its neighbor, so the observations are dependent. Report the window length, step, exact endpoints and worst complete window alongside the full-period result.

See the decision guide

Calculate a fixed-span return

For equity E at regularly spaced valuation points, the h-period return ending at t is R(t,h) = E(t) / E(t-h) - 1. Equivalently, multiply the h consecutive account-return growth factors and subtract one. This assumes positive starting equity, consistent valuations and no deposits or withdrawals. Individual trade percentages cannot usually replace account returns because position sizes and holding periods differ.

  • Choose a horizon such as 12 calendar months and an observation step such as one month. A 20-trade window has a variable calendar duration and answers a different question.
  • With N complete return periods and a one-period step, there are N - h + 1 complete windows when N >= h. This needs N + 1 equity observations, including the initial valuation.
  • Rolling identifies which periods are measured. Annualizing changes the units of each result. For a three-year window, the cumulative return is E(end) / E(start) - 1; its annualized equivalent is (E(end) / E(start))^(1/3) - 1. Label the chosen form.
  • If external money enters or leaves the account, use cash-flow-adjusted subperiod returns and link them. A deposit must not appear as trading profit.

A 12-month example with quarterly steps

This hypothetical strategy has quarter-end equity of $10,000 on December 31, 2023, then $11,000, $12,000, $9,000 and $10,500 through 2024, followed by $11,550, $10,800, $12,600 and $13,230 through 2025. Values include assumed trading costs and open-position valuations, with no external cash flows. Eight quarters produce five complete four-quarter windows; results below are cumulative 12-month returns.

  • The worst observed 12-month window runs from June 30, 2024 to June 30, 2025: $12,000 falls to $10,800, a 10% loss. Keep these dates with the minimum, rather than reporting only a percentage.
  • The median of these five windows is 5%; four of five are positive. The 80% positive-window share describes this overlapping historical sample. It is not an 80% probability of future profit.
  • The September-start window gains 40% partly because its opening valuation follows a large loss. Inspect the equity path and drawdown before interpreting a rebound as broad consistency.
Start valuationEnd valuationEquity calculationReturn
2023-12-312024-12-3110,500 / 10,000 - 15.00%
2024-03-312025-03-3111,550 / 11,000 - 15.00%
2024-06-302025-06-3010,800 / 12,000 - 1-10.00%
2024-09-302025-09-3012,600 / 9,000 - 140.00%
2024-12-312025-12-3113,230 / 10,500 - 126.00%

Compare rolling, calendar-year and full-period results

The same equity path supports several valid summaries. They answer different questions and should retain their dates. In this example both calendar years are positive, yet one complete 12-month window loses money.

  • The full-period growth factor is 1.05 × 1.26 = 1.323. Adding the calendar-year percentages gives 31%, which is not the compounded result.
  • Do not compound or sum the five overlapping rolling returns to reconstruct the two-year return. Doing so counts some quarters multiple times.
  • A rolling return is an endpoint holding result, not maximum drawdown. A strategy can recover before a window ends after suffering a much deeper interim decline.
ViewResult from the exampleWhat remains hidden
Calendar year 202410,500 / 10,000 - 1 = 5%Returns for starts other than the prior year-end.
Calendar year 202513,230 / 10,500 - 1 = 26%The losing June-to-June holding window.
Full two-year period13,230 / 10,000 - 1 = 32.30%Starting-date sensitivity and the path between endpoints.
Rolling 12 months, quarterly stepRange: -10% to 40%; median: 5%Intraperiod drawdowns and daily-start windows.

Overlap creates dependence without adding history

Adjacent four-quarter windows in the example share three quarters. Adjacent 12-month windows advanced monthly share 11 monthly returns. A loss in one shared month can therefore affect many plotted points. A smooth rolling chart and a large count of positive points can both come from repeated use of the same market episodes.

  • Treat the window count as a descriptive count. Do not insert it into a confidence interval or significance test that assumes independent observations.
  • Non-overlapping windows remove shared return intervals but yield fewer observations and still may share market-regime dependence. They are a useful comparison, not proof of independence.
  • Choose the horizon and sampling step before comparing strategies. Selecting whichever window length produces the nicest chart is another form of historical selection.
  • Keep a later evaluation period separate from rule selection. Rolling analysis over development data does not make that data out of sample.

Make endpoints and missing history explicit

A 12-calendar-month window is not necessarily 252 trading sessions, 365 days or a fixed number of chart bars. Define the valuation calendar and timezone first. For month-end analysis, one reproducible convention is the last available session close on or before each calendar month-end. Apply it consistently and retain the actual timestamps.

  • Include the opening valuation before the first return period. A January-through-December series needs the preceding December endpoint to measure the full year.
  • A record beginning in July cannot provide a complete trailing year by December. Mark the first incomplete windows unavailable; do not substitute a six-month return under a 12-month label.
  • Distinguish a scheduled market closure from a missing observation. Use the declared session convention for closures; flag unexpected gaps rather than inventing zero-return days.
  • If an endpoint is absent, skip and count that window or recover the valuation from an appropriate source. Report valid and excluded counts and the affected dates. Missing intermediate data also blocks path-risk analysis even when two valid endpoints allow an endpoint return.
  • A zero starting equity makes the percentage undefined. Zero ending equity from a positive start is a 100% loss. Negative equity or insolvency needs separate funding and loss analysis, not a routine rolling percentage chart.

Use one continuous strategy history

Measuring rolling returns on a continuous equity curve preserves positions and indicator state across window boundaries. Restarting the strategy at every window start can change warm-up, position size and trades. Those are separate backtests, not necessarily the returns an investor would experience over slices of the same account history.

  • Record symbol, timeframe, session, strategy version, starting capital, commission, slippage and valuation method. Hold them fixed for comparisons.
  • Mark open positions to market at each endpoint when measuring account equity. Summing only trades that close inside a window omits unrealized P&L and can assign gains or losses to the wrong holding interval.
  • Do not force a liquidation at every rolling boundary unless that is the explicitly tested rule. Extra exits change costs and strategy behavior.
  • Record the worst window with both endpoints, capital values, return, trade activity and relevant drawdown. Keep the complete window table so the minimum can be reproduced.

Reconcile TradingView exports with Pineify

TradingView exports each Strategy Report tab separately; the List of Trades export supplies trade records. Pineify Backtest Deep Report accepts this CSV and calculates supported metrics such as net profit, closed-trade equity drawdown and CAGR. Its current rolling-statistics implementation uses trade-count windows for Sharpe, Sortino and win rate. Those outputs are not fixed-calendar rolling account returns.

  • Upload the List of Trades CSV and confirm parsed trades and initial capital before reviewing the report. Retain the TradingView settings and test dates with the file.
  • A closed-trade equity curve does not recover every historical open-position valuation. For the rolling calculation above, obtain consistent dated account-equity snapshots separately; do not treat the CSV alone as a complete mark-to-market time series.
  • Calculate fixed-calendar rolling returns in a separate worksheet from those valuations. Use the example formula, document missing windows and compare the full-period result against the source report.
  • If custom Pine output is needed, ask the Pine Script AI Coding Agent for explicit valuation timestamps and open-position treatment. Review the generated code and reconcile known endpoints before trusting the output.
Where Pineify fits

Backtest Deep Report

Import your TradingView trade CSV to review supported return and risk results. Keep fixed-calendar rolling returns as a separate calculation using the required equity valuations.

Also useful: Pine Script AI Coding Agent. Request custom equity observations with a defined calendar and valuation policy, then check the generated script against known endpoints.

Explore Backtest Deep Report

Frequently asked questions

Educational information, not investment advice. Numerical examples are hypothetical and do not represent measured strategy performance. Historical rolling returns do not predict future returns or limit future losses.

Sources and verification

Published by Pineify. Pineify is an independent product and is not affiliated with TradingView. Sources support the technical explanations; examples do not establish trading performance.