Documentation

Learn how to leverage LocalAlpha to visualize, analyze, and optimize your LEAN backtests without leaving your desktop.


LocalAlpha

Installation

LocalAlpha is a standalone binary. It includes a bundled Python environment for analytics, so you don't need to manage `pip` dependencies manually.

System Requirements
  • • macOS 12+ (Apple Silicon or Intel)
  • • Windows 10/11 (WSL2 optional)
  • • Linux (Debian/Ubuntu 20.04+)
  • • 4GB RAM minimum (8GB recommended for large logs)

Privacy-First Architecture

Unlike web-based dashboards, LocalAlpha runs 100% on your machine.

  • Frontend (Tauri)Renders charts using Rust-native webview. No browser telemetry.
  • Analytics (Python Sidecar)A spawned subprocess handles number crunching using Pandas and QuantStats. It accepts inputs only from localhost.

Ingesting Results

LocalAlpha reads the standard `result.json` generated by the LEAN CLI.

Method 1: Drag & Drop

Simply drag your `result.json` file anywhere onto the application window. The dashboard will instantly parse:

  • Equity Curve points
  • Order Events
  • Runtime Statistics
  • Log messages

Auto-Watch Mode

For a seamless "Code → Backtest → Analyze" loop, configure Auto-Watch.

  1. Open Settings (Gear Icon).
  2. Under "Watch Folder", select your LEAN CLI output directory (usually `./backtests`).
  3. Toggle Enable Auto-Watch.
Tip: LocalAlpha intelligently filters files. It will ignore temporary files and only refresh when a valid `result.json` is completely written.

Reality Check (Reconciliation)

Verify that your live trading matches your backtests. This tool performs fuzzy matching between two `result.json` files (e.g., a Backtest vs. Live Trading result).

How it works

Upload two files. LocalAlpha will match trades based on Symbol, Quantity, and Entry Time (within a configurable tolerance window).

  • Slippage Analysis: Calculates the difference in execution price between simulated and live orders.
  • Latency: Measures the time delay between expected entry/exit and actual execution.
  • Missing Trades: Highlights orders that occurred in backtest but failed in live (or vice versa).

Core Metrics

We use the industry-standard QuantStats Python library to verify LEAN's summary statistics.

Sharpe & Sortino

Calculated using daily returns (resampled from your equity curve).
Sharpe: Excess return per unit of total volatility.
Sortino: Excess return per unit of downside volatility.

Probabilistic Sharpe Ratio (PSR)

We calculate the Probabilistic Sharpe Ratio to estimate the probability that your strategy's performance is not due to luck (false discoveries), adjusting for skewness and kurtosis.

Analysis Visualizations

LocalAlpha provides over 40 multidimensional visualizations to audit your strategy's DNA.

Risk & Efficiency

MAE/MFE Scatter
Optimize stop-loss and take-profit levels.
Entry/Exit Efficiency
Measures quality of trade timing.
MAE Distribution
Histogram of adverse price moves.
Drawdown Duration
Profile of recovery times.
Drawdown Depth vs Duration
Recovery effort analysis.
Risk/Reward Ratio
Distribution of R:R per trade.

Trade Dynamics

Trade P&L Distribution
Histogram of profit/loss frequency.
Holding Period vs Profit
Time-to-Return relationship.
Streak Analysis
Serial correlation of wins/losses.
Lag Plot
Autocorrelation of trade outcomes.
Trade Size vs Profit
Sizing effectiveness.
Trade Returns (%)
Percentage-based return distribution.
Trade Duration Histogram
Frequency of trade lengths.
Consecutive Win/Loss
Runs analysis.

Timing & Seasonality

P&L by Day/Hour
Identify your most profitable sessions.
Activity Heatmap
Visual density of entries.
Monthly Trade Count
Volume tracking over time.
Seasonality Chart
Average return per calendar month.
Profit by Day of Month
Monthly cycle analysis.
Entry Time Distribution
Execution timing frequency.

Asset-Level Performance

Performance by Symbol
Rank symbols by total P&L.
Win Rate by Symbol
Accuracy per instrument.
Profit Factor by Symbol
Risk-adjusted asset quality.
Expectancy by Symbol
Expected value per trade.
Cumulative P&L by Instrument
Time series decomposition.
Sharpe by Symbol
Risk-adjusted performance per asset.
Avg Win/Loss by Symbol
Capture ratio per instrument.

Stability & Rolling Stats

Rolling Win Rate
Strategy stability over time.
Rolling Profit Factor
Profitability consistency.
Rolling Statistics
Sharpe and Volatility drift.
Rolling Kelly Criterion
Position sizing evolution.
Concurrent Positions
Risk concentration tracking.
Monthly Returns Bar
Chronological performance grid.
Win/Loss Evolution
Cumulative count tracking.
Avg Duration Evolution
Timeframe drift monitoring.

Monte Carlo Simulation

Stress-test your strategy by shuffling the order of your trades.

Methodology

We perform 1,000 simulations by randomly shuffling your realized trade P&L values (without replacement). This preserves the distribution of returns but destroys the sequence.

  • 95th Percentile: Optimistic outcome (Lucky sequence)
  • 50th Percentile: Median outcome (Expected performance)
  • 5th Percentile: Pessimistic outcome (Unlucky sequence - "Risk of Ruin")

Log Explorer

Debug complex strategies with a virtualized log viewer capable of handling gigabytes of text.

Search Syntax

ERRORFinds simple text matches (case-insensitive)
Order:\s+\d+Regex support for complex patterns

Strategy Optimization

Visualizing parameter stability is crucial to avoid overfitting. LocalAlpha allows you to ingest optimization CSV results and visualize them as heatmaps.

Optimization Heatmaps

Upload your optimization CSV file to visualize the relationship between parameters (e.g., Lookback Period, Threshold) and performance metrics (Sharpe Ratio, Net Profit).

  • Robustness Zones: Identify broad areas of profitability rather than single isolated peaks (which indicate overfitting).
  • Parameter Sensitivity: See how sensitive your strategy is to small changes in parameter values.

Portfolio & Attribution

Analyze multiple strategies simultaneously and decompose their drivers of return.

Portfolio Correlation

Upload multiple backtests to create a "Fund Manager" view.

  • Correlation Matrix: View Pearson correlation coefficients between strategies to assess diversification benefits.
  • Combined Equity: See the weighted performance of your entire portfolio of algorithms.

Drivers of Return (Attribution)

Decompose your strategy's returns to understand why it made money.

  • Long/Short Attribution: Split performance by side.
  • Sector Exposure: Visual breakdown of trade concentration by industry sector.
  • Rolling Beta: Monitor your strategy's market sensitivity over time.