Rearview Join the waitlist

Getting started

Rearview tests trading rules on a whole portfolio of stocks and ETFs. A strategy is a short script; a run plays it day by day over your data, using only what was known at each day's close, and keeps everything it did in a folder you can check, compare and rerun.

This page walks through a first session on the sample project, then shows how to bring your own data. In the app, Your First Session, at the top of Help, lists the same steps with a Show Me button for each, and ticks them off as you go.

The sample project

In the welcome window, choose Create Sample Project, or File ▸ Create Sample Project at any time. It makes a project folder holding every example script, running on ten years of synthetic prices for 500 stocks and a market ETF.

  • The index label is SYN500 and the market ETF is SYNSPY, so the examples read members("SYN500") and close("SYNSPY").
  • The data has splits, dividends, delistings and ticker changes, as real data does, and a few planted problems for the quality report to find. None of it is real money or a real market.
  • The data goes into the Data Library as Sample, and later sample projects reuse it.

The project window

The window is laid out as Xcode is:

  • The navigator, on the left: the project's scripts and portfolios, its runs, any issues, and its data. View ▸ Project, View ▸ Runs, View ▸ Issues and View ▸ Data switch between them (⌃⌘1 to ⌃⌘4).
  • The editor, in the middle, with the results of the selected run under it.
  • The inspector, on the right: Run Settings (what to run, and the costs and account it runs with), Run Info, the Inspection Range, The Day’s Choices and Holdings (⌥⌘1 to ⌥⌘5).

A project is a plain folder. Scripts are .rvw text files, and every run is a subfolder of runs/, so a project works with git and any text editor.

A first run

Select rsi2_pullback and press ⌘R (Run ▸ Run). It buys stocks in a long-term uptrend after a sharp two-day dip, while the market ETF is above its 200-day average, and sells on the bounce.

  • Beside the editor, each line shows what it did: how many stocks the universe held, how often each condition was true, how many signals there were. See What each line did.
  • Under the editor, the Summary shows growth per year, the deepest fall, Sharpe and the rest, beside the market ETF. Reading a run explains every figure.
  • Change rsi_entry in Run Settings and run again: the Summary compares the two runs.
  • While you edit, completion offers what fits as you type, and resting the pointer on a word, or ⌥-clicking it, shows Quick Help: what a function computes and how much history it needs. See In the editor.

Your 30-day trial starts with this first run.

A trade

Choose Trades (⌘4) and click a trade. Its chart shows where it entered and left; ↑ and ↓ move to the next trade. MAE/MFE shows how far each trade went against you and for you while it was open.

Show on Chart, beside the trade's title, opens the Chart (⌘5): the trade's security over the whole run with the script's lines and conditions day by day, so you can see why it entered when it did, and why it didn't on other days. Hover over a day an entry was possible to see how it fared among the day's candidates.

A scan

Select oversold_above_trend, the sample's scan, and press ⌘R. It lists the stocks in an uptrend after a sharp two-day drop on the data's last day, most oversold first, with every value the script computed. Step back a day, sort by a column, or choose Run ▸ Scan Candidates on rsi2_pullback to see what it would rank tomorrow. See Scans.

Check it reproduces

In the Runs navigator (⌃⌘2), Control-click a run and choose Check It Reproduces…. Rearview runs it again from its own folder, on the same data and settings, and compares every file it wrote. A run made today reproduces byte for byte in later versions too, or the change that alters it is listed under Golden replays, with its reason.

Is this result luck?

down_days_overtuned was tuned too far on purpose. Select it, choose Optimize in Run Settings and press ⌥⌘R (Run ▸ Optimize). It tries all 50 settings of its two params in a few seconds.

The verdict is Probably luck. The setting that looked best on one half of the history ranked below the median on the other half most of the time: its edge came from fitting this history, not from the rule. A strategy you tune on your own data can do the same, and the verdict is there to tell you. Is this result luck? explains how it's judged.

The lockbox

Before you tune your own ideas, hold back the most recent data. Open the project's data (⌃⌘4), set Hold back from in the Lockbox section, and choose Seal Lockbox. Runs, searches and walk-forwards then stop short of that day, with a gap before it so no indicator can reach across. When your research is done, reveal it once and test on data the strategy has never seen. Runs made before you sealed it saw the held-back days, so Check It Reproduces… reports that the lockbox has changed rather than compare them.

Your own data

Rearview reads data you bring, in a documented CSV format: Window ▸ Data Library (⇧⌘L), then Import.

  • CSV Folder in the Rearview Format… reads the import format: securities, tickers over time, as-traded bars, corporate actions and, optionally, index membership. See Importing your data.
  • Per-Symbol Files… converts a folder of one OHLCV file per ticker, as most charting tools and free sources export them. Such files can't say which stocks were delisted or which were in an index on a past date, and the import report says so.

Data can hold coins beside stocks: list their tickers under Coins when you import. Coins trade every day, long only; see Coins in the import guide. Futures come as chains with their rolls: convert your vendor's contract files with Import ▸ Futures Contracts…; see Futures. Stocks of another exchange, such as the ASX, come with its Exchange and Currency in the same sheet, and forex pairs under Forex pairs; an account in your own currency is then one choice in Run settings. See Exchanges and their days and Currencies.

Data can also hold bars shorter than a day, for stocks and ETFs on one exchange: see Intraday bars in the import guide and in the language reference. A script then steps through every bar and can use time, daily(x), vwap and flat at close.

A new project runs on the first data in the library; the Data menu in the project's data view switches it.

Most data vendors license their data for personal use only. Check your vendor's terms before you import.

The trial and your licence

The trial lasts 30 days from your first backtest, scan or check, and includes everything. Opening Rearview, importing data and writing scripts don't start it. When it ends, Rearview is read-only: saved runs still open and export, but it makes no new ones. The same goes for rvw in Terminal.

To enter a licence, choose Rearview ▸ Licence… and paste the whole block from your receipt, from -----BEGIN REARVIEW LICENCE----- to its last line. Rearview checks it on your Mac and never contacts a server.

Getting help

  • Help ▸ Rearview Help (⌘?) has this guide, the language reference and a search over both.
  • If a result looks wrong, select the run and choose Help ▸ Report a Wrong Result…. It bundles the script, settings, the run's figures and the securities it traded, the engine version and a fingerprint of your data, but none of your data's bars, into an email to support.
  • For a problem with your data, choose Export Diagnostics… in the Data Library and attach the file.
  • If Rearview or its engine quits unexpectedly, the welcome window offers a crash report the next time you open it. It holds macOS's crash report, the end of the engine's log and the versions, and goes nowhere unless you email or save it. macOS's report can include file paths, such as your project folder's name.
  • Write to support@rearview.page with anything else.
  • Help ▸ Copy Command-Line Tool Path copies the path of rvw, the engine the app runs, for use in Terminal. rvw help lists its commands.