Backtesting
Signal Stats
A study you add to a chart. Ready-made charts are in the chartbook shop.
Description
Signal Stats backtests a buy signal and a sell signal on the bars already loaded on the chart. A signal is a subgraph on the same chart that changes from 0 to 1. The trade fills at the next bar's open, and a stop, a target, or an opposite signal can close it. The results recalculate as soon as a signal source, a stop, or a target is changed, so a full replay is not required to test the idea.
Once the signals are set, the stop and target are ordinary inputs. Each is a tick distance from the entry, and either one can be turned off with 0. Switching a 20-tick stop and a 40-tick target, or turning the target off and exiting on the opposite signal, is a settings change. The table updates from the same bars.
The table is the portfolio result of the closed trades. It shows the final balance, net profit and loss, win and loss totals, win ratio, average win and average loss, the number of entry signals, maximum drawdown in dollars and percent, Kelly, the Sharpe ratio, and the Sortino ratio. Commission, position size, starting balance, and slippage are included.
Key Notes
- The study does not send orders. The arrows and the dashed stop and target lines are the hypothetical trades.
- A stop and a target inside the same bar counts as the stop. A gap through a level fills at the bar's open.
- Exit On Opposite Signal closes at the next bar's open. Reverse On Opposite Signal closes and enters the other side there.
- Algo Start Time equal to Algo End Time allows every bar. A start time after the end time spans midnight.
- A bar and study export includes each closed trade on its exit bar: profit and loss, portfolio balance, entry, exit, and direction.
Requirements
- Select a study on the same chart as the source for the Buy or Sell signal. The subgraph must go from 0 to 1 to mark that bar as a signal.
- A formula in Sierra Chart's Spreadsheet Formula study is a common source. Signal Stats is not a spreadsheet.
Important Inputs
| Input | What it does |
|---|---|
| Buy Entry Signal Study, Subgraph | The buy signal on the same chart. The subgraph chosen is the one that changes from 0 to 1, not only the study. |
| Sell Entry Signal Study, Subgraph | The sell signal, read the same way. |
| Stop Loss Type | Ticks. The distance is measured from the entry. |
| Stop Loss Value (0=Off) | The stop distance in ticks. It starts at 20. 0 leaves the stop off. |
| Target Type | Ticks. The distance is measured from the entry. |
| Target Value (0=Off) | The target distance in ticks. It starts at 40. 0 leaves the target off. |
| Exit On Opposite Signal | Closes an open trade when the other side signals. It starts off. |
| Reverse On Opposite Signal | Closes and enters the other side at the next bar's open. It starts off. Turning it on also exits on the opposite signal. |
| Position Size (Contracts) | Contracts per trade. It starts at 1. The range is 1 to 100000. |
| Commission Per Contract (Round Turn) | Round-turn commission taken out of each trade. It starts at 0. |
| Account Starting Balance | The hypothetical balance the table starts from. It starts at 10000. |
| Variable Slippage In Ticks | A random 0 to N ticks on entries, stops, and signal exits, usually against the trade. It starts at 0, which fills an entry exactly at the next bar's open. The range is 0 to 1000. |
| Bars To Load (0=All) | How many recent bars are tested. It starts at 0, which uses every loaded bar. |