Running & simulation rules
How fills, stops, targets and gaps are simulated, the console, problems and errors.
Run backtest plays your strategy through every bar of every pair and records its trades. Knowing exactly how fills, stops and targets are simulated is what lets you trust the result.
Running a backtest
Click Run backtest or press Ctrl + Enter (⌘ + Enter on Mac) anywhere in Talios. The button shows the progress ("Loading EUR/USD (1H)", "Running on EUR/USD (1/2)") and turns into Stop. Results, Data feed and Prop firm show a progress screen while it runs. One backtest runs at a time.
When the button rests, hovering it tells you why: the project has no strategy yet, there are errors to fix first, the agent is working, the run would be too large, or you already have the latest version (nothing changed since the last run, so there is nothing new to learn).
How trades are simulated
- Decisions at the close.
on_barruns at each bar's close; a market order fills at the next bar's open. - Exits come first. Stops and targets are checked on every bar after the fill, before
on_baris called on that bar. On a market order's fill bar, both are checked; on the fill bar of an order filled inside the bar, only the stop. - Worst case on a wide bar. When a bar reaches both the stop and the target, the stop counts.
- Gaps. A bar opening past the stop closes the trade at the stop: a stopped trade loses its planned risk, never more. A bar opening past the target closes at that open.
- R. (exit − entry) / |entry − initial stop|, negated for a short, minus
cost_r. Moving the stop never changes what 1R is. - Open at the end. A position still open on the last bar is closed there and marked open: it shows in the Trades tab with an open badge, but stays out of the stats, Results, Prop firm and the Data feed.
- No costs unless you set them. Spread and commission are zero unless your class sets
cost_r. - Worst point. How far each trade went against you is measured, so the Prop firm view breaches on a trade's worst point, not only its close.
The 2m and 3m timeframes are built from 1-minute candles. Only closed bars are used.
The bottom panel
| Tab | What it shows |
|---|---|
| Console | The run's story: the pairs, bars and period loaded, how many economic releases were found, everything your strategy print()s, the engine's notes (a refused order, a cancelled fill), a summary per pair, then ✓ N closed trades and the time it took. On a failure: the error, a traceback trimmed to your files, and where it stopped (pair, bar and time). |
| Problems | Every syntax error (blocks the run) and warning (doesn't), with its file and line. Click to jump there. |
| Trades | Every trade of the last run, newest first: pair, side, entry and exit times (UTC), entry, stop and target prices, result in R, and why it closed (stop, target, exit or end). |
Common messages
| Message | What to do |
|---|---|
| No Strategy found | Define a class deriving from talios.Strategy, e.g. in strategy.py. |
| enter(Long) refused: the stop … isn't below the entry | Your stop is on the wrong side: for a long, below the entry; for a short, above. |
| … crypto isn't covered by the price feed | Use forex, metals, indices or energies. |
| This backtest is too large | Shorten the period, use fewer pairs or a higher timeframe. |
| Stopped after 5 minutes | The strategy never finished: look for an endless loop. |
| The economic calendar couldn't be loaded | That run went on without news: news() and near_news() saw no releases. Run again. |
| No module named 'numpy' | Talios runs the Python standard library only: write the calculation with lists. |
No trade at all?
Add aprint() in on_bar on the condition you expect to fire, run, and read the Console. Nine times out of ten an indicator is still None, or a filter never lets a bar through.