> ## Documentation Index
> Fetch the complete documentation index at: https://docs.luxalgo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Backtest Viewer

<img src="https://mintcdn.com/luxalgo/VttZieg0SlRfIG4i/public/images/ai-backtesting/backtest-viewer/backtest-viewer-intro.png?fit=max&auto=format&n=VttZieg0SlRfIG4i&q=85&s=b483c5101b2c00ed2e7d7eef6a307c7c" alt="" width="1618" height="767" data-path="public/images/ai-backtesting/backtest-viewer/backtest-viewer-intro.png" />

Users have access to a wide variety of useful data and visualisations to evaluate a strategy trough the backtest viewer.

By default the backtest viewer will display backtest information from the most recent fetched strategy in the conversation.

<Tip>
  You can check backtest results from previously fetched strategies by simply clicking on the card holding the strategy
</Tip>

## Backtest Statistics

### Overview

* Historical Net Profit
* Net Profit
* Trades
* Win Rate
  * Winning Trades (left)
  * Losing Trades (right)
* Max Drawdown
  * Max Drawdown %

### Performance

<img src="https://mintcdn.com/luxalgo/VttZieg0SlRfIG4i/public/images/ai-backtesting/backtest-viewer/performance.png?fit=max&auto=format&n=VttZieg0SlRfIG4i&q=85&s=6773830ec5cfd8539c3bb9edc76f254c" alt="" width="1602" height="952" data-path="public/images/ai-backtesting/backtest-viewer/performance.png" />

The **Performance** section includes two visualisations:

* Net Daily PNL: Net daily trades result (profit + loss)
* Weekday Performance: Sum of the profit and losses made during a specific day of the week

#### Table

A performance table is included listing statistics for all trades, only longs, and only shorts. The following statistics are returned:

* <Tooltip headline="Net Profit" tip="Net result after combining all realized profits and losses.">Net Profit</Tooltip>
* <Tooltip headline="CAGR" tip="Annualized compounded return over the full backtest period.">CAGR (Compounded annualized growth rate)</Tooltip>
* <Tooltip headline="Gross Profit" tip="Sum of profits from all winning trades before losses.">Gross Profit</Tooltip>
* <Tooltip headline="Gross Loss" tip="Sum of losses from all losing trades before gains.">Gross Loss</Tooltip>
* <Tooltip headline="Profit Factor" tip="Gross profit divided by gross loss. Higher values indicate stronger profitability.">Profit Factor</Tooltip>
* <Tooltip headline="Average P&L per Day" tip="Average net profit or loss generated per trading day.">Average P\&L per Day</Tooltip>
* <Tooltip headline="Average P&L per Week" tip="Average net profit or loss generated per trading week.">Average P\&L per Week</Tooltip>
* <Tooltip headline="Drawdown" tip="Largest drop in equity from a peak to a later low.">Drawdown</Tooltip>
  * <Tooltip headline="Drawdown Percent" tip="Largest peak-to-low equity decline expressed as a percentage.">Drawdown Percent</Tooltip>

### Trades Analysis

<img src="https://mintcdn.com/luxalgo/VttZieg0SlRfIG4i/public/images/ai-backtesting/backtest-viewer/trades-analysis.png?fit=max&auto=format&n=VttZieg0SlRfIG4i&q=85&s=137827d86da634f206f26d5f9b33ab6d" alt="" width="1605" height="970" data-path="public/images/ai-backtesting/backtest-viewer/trades-analysis.png" />

The **Trades Analysis** section includes two visualisations:

* P\&L Distribution: Distribution of trade profit and losses
* Winrate: Shows winrate, winning trades and losing trades
* Duration vs P\&L: Scatter plot showing trade duration (in bars) against the trade result

#### Table

A trades analysis table is included listing statistics for all trades, only longs, and only shorts. The following statistics are returned:

* <Tooltip headline="Closed Trades" tip="Total number of trades that have been opened and closed.">Closed Trades</Tooltip>
* <Tooltip headline="Winning Trades" tip="Number of closed trades with a positive result.">Winning Trades</Tooltip>
* <Tooltip headline="Losing Trades" tip="Number of closed trades with a negative result.">Losing Trades</Tooltip>
* <Tooltip headline="Win Rate" tip="Winning trades divided by total closed trades.">Win Rate</Tooltip>
* <Tooltip headline="Avg P&L" tip="Average profit or loss across all closed trades.">Avg P\&L</Tooltip>
* <Tooltip headline="Avg Winning Trade" tip="Average profit across winning trades only.">Avg Winning Trade</Tooltip>
* <Tooltip headline="Avg Losing Trade" tip="Average loss across losing trades only.">Avg Losing Trade</Tooltip>
* <Tooltip headline="Largest Winning Trade" tip="Single closed trade with the highest profit.">Largest Winning Trade</Tooltip>
* <Tooltip headline="Largest Losing Trade" tip="Single closed trade with the largest loss.">Largest Losing Trade</Tooltip>

#### Duration

<img src="https://mintcdn.com/luxalgo/VttZieg0SlRfIG4i/public/images/ai-backtesting/backtest-viewer/duration.png?fit=max&auto=format&n=VttZieg0SlRfIG4i&q=85&s=0d3ad97024c7eea11cb2c37350d4c043" alt="" width="1562" height="947" data-path="public/images/ai-backtesting/backtest-viewer/duration.png" />

A duration table is included listing statistics for all trades, only longs, and only shorts. The following statistics are returned:

* <Tooltip headline="Avg Trade Duration (bars)" tip="Average number of bars a trade stays open.">Avg Trade Duration (bars)</Tooltip>
* <Tooltip headline="Avg Winning Trade Duration (bars)" tip="Average number of bars winning trades stay open.">Avg Winning Trade Duration (bars)</Tooltip>
* <Tooltip headline="Avg Losing Trade Duration (bars)" tip="Average number of bars losing trades stay open.">Avg Losing Trade Duration (bars)</Tooltip>
* <Tooltip headline="Avg Trades per Day" tip="Average number of closed trades per day.">Avg Trades per Day</Tooltip>
* <Tooltip headline="Avg Trades per Week" tip="Average number of closed trades per week.">Avg Trades per Week</Tooltip>
* <Tooltip headline="Longest Trade (bars)" tip="Greatest number of bars any single trade stayed open.">Longest Trade (bars)</Tooltip>
* <Tooltip headline="Shortest Trade (bars)" tip="Fewest number of bars any single trade stayed open.">Shortest Trade (bars)</Tooltip>
* <Tooltip headline="Longest Winning Streak (bars)" tip="Longest consecutive winning period, measured in bars.">Longest Winning Streak (bars)</Tooltip>
* <Tooltip headline="Longest Losing Streak (bars)" tip="Longest consecutive losing period, measured in bars.">Longest Losing Streak (bars)</Tooltip>

## Trades Log

<img src="https://mintcdn.com/luxalgo/VttZieg0SlRfIG4i/public/images/ai-backtesting/backtest-viewer/trades-log.png?fit=max&auto=format&n=VttZieg0SlRfIG4i&q=85&s=23aa46aa1415b3ee7ceb6a185b5aca01" alt="" width="1600" height="736" data-path="public/images/ai-backtesting/backtest-viewer/trades-log.png" />

A trades log table is included showing each closed trade in chronological order, including the trade number, trade side, entry, exit, net P\&L, and the running cumulative P\&L after each trade.

<Tip>
  Click on a column to sort it ascendingly or descendingly.
</Tip>

### Calendar View

<img src="https://mintcdn.com/luxalgo/VttZieg0SlRfIG4i/public/images/ai-backtesting/backtest-viewer/trades-calendar.png?fit=max&auto=format&n=VttZieg0SlRfIG4i&q=85&s=b3a755075106477ca5dbeb47bc0ddbeb" alt="" width="1596" height="957" data-path="public/images/ai-backtesting/backtest-viewer/trades-calendar.png" />

When the `View Mode` is switched to calendar view, trades are grouped by day in a monthly layout with month navigation at the top. Each day can show its net P\&L, number of trades, and win rate, while a summary below highlights the month net P\&L, best day, worst day, and average trades per day.

## Strategy Comparison View

When the Backtesting AI fetches multiple strategies at once, these will eb displayed in a comparison view, allowing for detailed comparisons.

### Comparison Table

<img src="https://mintcdn.com/luxalgo/VttZieg0SlRfIG4i/public/images/ai-backtesting/backtest-viewer/comparison-viewer.png?fit=max&auto=format&n=VttZieg0SlRfIG4i&q=85&s=2640fe578bdcb961046ff41c1957de96" alt="" width="1742" height="1068" data-path="public/images/ai-backtesting/backtest-viewer/comparison-viewer.png" />

The comparison table displays each strategy side by side, including the symbol and timeframe, strategy name, net profit, trades, win rate, max DD %, and profit factor.

### Comparison Scatter Plots

The comparison scatter plots help visualize how strategies relate across key metrics, with views such as CAGR vs Max Drawdown %, Profit Factor vs Trade Count, Winrate vs Trades, and Normalized Avg Win vs Avg Duration.

Each point represents a strategy, with strong performers being located in the quadrant in green.

<Tip>
  Hovering over a strategy point in the graph shows a tooltip with the relevant strategy details.
</Tip>
