Skip to content
Algo Trade Analytics Docs

Scope & Matching Engine

The Scope Definition section configures your analysis parameters, and the Matching Engine pairs your alert signals with broker fills. Understanding these systems helps you get accurate results.


Choose which trading instrument to analyze:

OptionDescription
Specific SymbolAnalyze one instrument (e.g., TSLA, SPY)
ALLAggregate view across all traded symbols

Select the time window for your analysis:

ComponentDescription
Start DateBeginning of analysis window
End DateEnd of analysis window
Start TimeOptional: specific time on start date
End TimeOptional: specific time on end date

Recommended ranges:

Use CaseRange
Daily monitoringLast 24 hours
Weekly reviewLast 7 days
Performance auditLast 30 days
Issue investigationSpecific date/time

Best for: Active strategies with real-time alert capture.

When selected:

  • Fetches alert events from your webhook history
  • Filters to the specified symbol and date range
  • Provides millisecond-precision timestamps

Requirements:

  • Webhook endpoint configured and active
  • TradingView alerts sending to your webhook
  • Alert history exists for the selected period

The matching engine pairs your alert signals with broker fills based on configurable tolerances.

  1. Time Window Filtering

    For each alert, identify broker fills within the time tolerance:

    alert_time to (alert_time + time_window)
  2. Symbol Matching

    Only pair alerts and fills for the same trading symbol.

  3. Direction Matching

    Match buy alerts with buy fills, sell alerts with sell fills.

  4. Best Match Selection

    If multiple fills qualify, select based on:

    • Closest timestamp (primary)
    • Smallest price difference (secondary)
  5. Classification

    Each pair is classified:

    • Full Match — Entry and exit both matched
    • Entry Only — Entry matched, exit missing
    • Exit Only — Exit matched, entry missing
    • Unmatched — No corresponding fill found
SettingDefaultDescription
Time Window5 minutesMax delay from alert to fill
Price Tolerance2%Acceptable price difference

Adjusting tolerances:

ScenarioTime WindowPrice Tolerance
High-frequency30 seconds0.5%
Standard trading5 minutes2%
Position trading30 minutes5%
Volatile markets10 minutes5%

Both the entry and exit signals have corresponding fills.

Alert: Entry Long @ 09:30:00, $100.00
Fill: Buy @ 09:30:02, $100.05
→ Matched with 2s latency, $0.05 slippage
Alert: Exit Long @ 14:45:00, $105.00
Fill: Sell @ 14:45:03, $104.95
→ Matched with 3s latency, -$0.05 slippage

Entry executed but exit is missing.

Common causes:

  • Exit alert not configured
  • Exit order rejected or timed out
  • Position still open

Exit executed but entry wasn’t matched.

Common causes:

  • Entry alert missing from dataset
  • Position opened outside analysis window
  • Manual entry, automated exit

Alert fired but no corresponding fill exists.

Common causes:

  • Order rejected by broker
  • Insufficient buying power
  • Market closed
  • Network failure

Broker fill without a corresponding alert.

Common causes:

  • Manual trading outside strategy
  • Alerts from different source
  • Duplicate order execution

TradingView → Webhook → Database → Analysis
  • Alerts arrive via webhook POST request
  • Stored with millisecond precision timestamps
  • Available for analysis immediately
Alpaca API → Polling/Webhook → Database → Analysis
  • Fills retrieved from Alpaca trade history
  • Updated periodically or via broker webhooks
  • May have slight delay from actual execution
EventTimestamp Source
AlertWebhook receipt time
Order SubmittedPlatform timestamp
FillBroker execution timestamp

Symptoms: “0 alerts found” message

Solutions:

  1. Expand date range
  2. Check webhook configuration
  3. Verify TradingView alerts are active
  4. Switch to CSV import

Symptoms: “0 fills found” message

Solutions:

  1. Verify Alpaca connection is active
  2. Check that orders were submitted
  3. Expand date range
  4. Check symbol spelling

Symptoms: Low match rate despite activity

Solutions:

  1. Verify symbol format consistency
  2. Check for exchange prefixes (NASDAQ:AAPL vs AAPL)
  3. Ensure alerts and orders use same symbol