Hawk-Backtester Analysis Results

Analysis Results — Calculation Logic

This document summarizes all analysis result items output after running a Hawk-Backtester simulation, along with their respective calculation logic.

Outcome Statistics»

Basic metrics indicating overall simulation performance.

MetricFormula / LogicDescription
Total Return (Equity(T) / InitialAssets) − 1 Return on initial capital based on final equity
Max Drawdown min((Equity(t) − Peak(t)) / Peak(t)) Maximum drawdown from peak equity.
Calculated by updating the peak at each point in time
Return / Max DD TotalReturn / |MaxDrawdown| Efficiency ratio of return to drawdown
Ending Assets At the final point in time assets Cash balance (excluding unrealized PnL)
Ending Equity At the final point in time virtualAssets Equity = Cash + Unrealized PnL
vs Buy & Hold EndEquity(Strategy) − EndEquity(BuyAndHold) Final equity difference versus a simple buy & hold strategy
Total Steps stat_history length of Total number of time steps in the simulation

Exposure Statistics»

Metrics indicating position exposure (leverage utilization).

MetricFormula / LogicDescription
Avg Gross Exposure mean(|NetUnits(t)| × Price(t) / Equity(t)) Mean absolute position multiplier (leverage)
Max Gross Exposure max(GrossExposure(t)) Multiplier at peak leverage
Avg Net Exposure mean(NetUnits(t) × Price(t) / Equity(t)) Mean net position.
Positive = long bias, Negative = short bias
Time in Market Σ(GrossExposure > 0) / TotalSteps Percentage of time holding a position
Long Ratio TotalLongUnits / (LongUnits + ShortUnits) Unit-weighted long ratio
Short Ratio 1 − LongRatio Unit-weighted short ratio
Exposure Efficiency TotalReturn / AvgGrossExposure Return per unit of average deployed leverage

Attribution Statistics»

Decomposes PnL components and analyzes the contribution of revenue sources and costs.

MetricFormula / LogicDescription
Long PnL Σ(closeRate − openRate) × units (buySide) Total P&L from long positions
Short PnL Σ(openRate − closeRate) × units (sellSide) Total P&L from short positions
Cost PnL Σ cost (All Tickets) Total trading costs (spreads, commissions, etc.)
Total PnL LongPnL + ShortPnL + CostPnL Total P&L
Long / Short / Cost Contribution EachPnL / TotalPnL PnL contribution ratio of each component
Profit Factor GrossProfit / GrossLoss Sum of winning trades / Sum of losing trades.
Above 1 indicates net profit
Win Rate WinCount / (WinCount + LossCount) Win rate (ratio of trades with PnL > 0)
Cost Burden |CostPnL| / |LongPnL + ShortPnL| Cost burden ratio relative to trading profit

Action Statistics»

Statistics on trade frequency, size, and holding period.

MetricFormula / LogicDescription
Total Orders BuyCount + SellCount Total number of buy and sell orders
Buy / Sell Ratio BuyCount / TotalOrders Proportion of buy orders among all orders
Orders Per 1000 Steps (TotalOrders / TotalSteps) × 1000 Order frequency per 1,000 steps
Median Holding Time median(CloseTime − OpenTime) Median holding period
P90 Holding Time percentile(HoldingTimes, 90) 90th percentile of holding period
Median Ticket Size median(|units|) Median position size
Partial Close Count Σ reduceCount Total number of partial close events

Scatter Analysis»

Multi-dimensional scatter plot analysis for each trade. PnL can be toggled between three display modes: Nominal / Return(%) / R-Multiple.

Preprocessing Calculations»

MetricFormula / LogicDescription
PnL (Nominal) Long: (closeRate − openRate) × units
Short: (openRate − closeRate) × units
Absolute P&L of each trade
PnL (Return %) PnL / (openRate × units) × 100 Return relative to entry amount
PnL (R-Multiple) PnL / Risk
Risk = MAE > 0 ? MAE : 0.5 × |PnL|
Return per unit of risk
MFE Long: (MaxHigh − openRate) × units
Short: (openRate − MinLow) × units
Maximum Favorable Excursion
Maximum favorable excursion (MFE) during position
MAE Long: (openRate − MinLow) × units
Short: (MaxHigh − openRate) × units
Maximum Adverse Excursion
Maximum adverse excursion (MAE) during position

S1: Holding Time vs PnL»

Visualizes the relationship between holding period and P&L, analyzing correlation and win rate.

StatisticFormula
CorrelationPearsonCorrelation Coefficient (Holding Time, PnL)
Median HT — Winnersmedian(HoldingTime) for PnL > 0
Median HT — Losersmedian(HoldingTime) for PnL < 0
Win RateWinners / Total × 100

S2: MAE vs MFE»

Analyzes the relationship between MAE and MFE, with the MFE = MAE diagonal indicating breakeven.

StatisticFormula
Mean MFE — Winnersmean(MFE) for PnL > 0
Mean MAE — Losersmean(MAE) for PnL < 0
P(Favorable Excursion)(MFE > MAE count) / Total × 100
Heat Efficiencymean(PnL / MFE) for winners (MFE > 0)

S3: Position Size vs PnL»

Analyzes the relationship between position size and P&L.

StatisticFormula
CorrelationPearsonCorrelation Coefficient (Size, PnL)
Win Rate — Top DecileWin rate of trades in the top 10% by size
Win Rate — Bottom DecileWin rate of trades in the bottom 10% by size

S4: Entry Price vs PnL»

Analyzes the relationship between entry price range and P&L.

StatisticFormula
Win Rate — Low Price Q1Win rate of trades in the bottom 25% by price
Win Rate — High Price Q3Win rate of trades in the top 25% by price
Mean PnL — Low Q1mean(PnL) for Q1
Mean PnL — High Q3mean(PnL) for Q3

S5: Entry Time vs PnL»

Analyzes the relationship between entry timing (time axis) and P&L.Analyzes the relationship between entry timing (time axis) and profit/loss.

StatisticFormula
Win Rate — Early Q1Win rate of trades in the first 25% of the time series
Win Rate — Late Q3Win rate of trades in the last 25% of the time series
Mean PnL — Earlymean(PnL) for First Half Q1
Mean PnL — Latemean(PnL) for Second Half Q3

Exit Analysis»

Classifies trade exit reasons and detects anomalies in TP/SL hit status.Classifies trade exit reasons and performs TP/SL hit analysis with anomaly detection.

Exit Reason Classification»

Exit ReasonEvaluation CriteriaDescription
Take Profit (TP) Buy: high ≥ openRate + TP
Sell: low ≤ openRate − TP
Closed by reaching the take-profit level
Stop Loss (SL) Buy: low ≤ openRate − SL
Sell: high ≥ openRate + SL
Closed by reaching the stop-loss level.
When both TP and SL are hit on the same bar, SL takes priority
Strategy Close Explicit close by strategy code Closed by user's strategy logic
Force Close Forced liquidation due to insufficient margin Margin Call

Exit Summary»

The following are aggregated for each exit reason:

StatisticFormula
CountNumber of exits per reason
ShareCount / TotalTrades
Sum PnLTotal P&L per reason
Avg PnLSumPnL / Count
Median PnLmedian(PnL values)
Win Rate(PnL > 0 count) / Count

TP/SL Reach Matrix (2×2)»

Classifies each trade by TP-hit/SL-hit combination (2x2 matrix). Evaluated at float32 precision (aligned with the WASM engine).

SL=Not ReachedSL=Reached
TP=Reached Count, Share, Sum PnL, Avg PnL Count, Share, Sum PnL, Avg PnL
(SL hit — closed with SL priority)
TP=Not Reached Count, Share, Sum PnL, Avg PnL
(TP/SL not reached — strategy/forced close)
Count, Share, Sum PnL, Avg PnL

Miss & Anomaly Detection»

MetricFormulaDescription
Miss TP Rate (TPHit but TPClosed by other reason) / TPHit Count Percentage of trades that hit TP but were not closed at take-profit
Miss SL Rate (SLHit but SLClosed by other reason) / SLHit Count Percentage of trades that hit SL but were not closed at stop-loss
Anomaly TP Rate (TPClose but TPNot Reached) / TPNumber of Closes Percentage of trades recorded as TP close despite not reaching TP
(e.g., floating-point precision issues)
Anomaly SL Rate (SLClose but SLNot Reached) / SLNumber of Closes Percentage of trades recorded as SL close despite not reaching SL

Timeline Charts»

A group of time-synchronized charts. The X-axis of each chart is synchronized to a common timeline.

ChartContentDescription
Price + Positions OHLC + Entry/Exit Markers Overlays position entries and exits on the price chart
Equity Curve virtualAssets(t) Equity curve over time
Drawdown (Equity(t) − Peak(t)) / Peak(t) Drawdown over time (area chart with negative values)
Gross Exposure |NetUnits(t)| × Price(t) / Equity(t) Gross exposure over time
Net Exposure NetUnits(t) × Price(t) / Equity(t) Net exposure over time
(Positive = net long, Negative = net short)