Section A: Geometry Overview
Section A visualizes the 2D distribution of MFE vs MAE to reveal the overall shape of trade outcomes.
What It Does
- Creates scatter plots showing every trade as a point in (MFE, MAE) space
- Generates marginal distributions (histograms + KDE) for MFE and MAE separately
- Calculates summary metrics (median, percentiles, win rate, correlation)
- Supports outlier removal for cleaner visualizations
Key Questions Answered
- What is the overall shape of outcomes?
- Is there asymmetry suggesting an edge?
- Are there obvious data quality issues (outliers)?
- Is the signal "tight-stop friendly" or does it need room?
API Usage
from signal_analyzer import analyze, AnalysisConfig
# Run Section A
config = AnalysisConfig(H=20, sections=['A'])
result = analyze(df, sig_col='sig', config=config)
# Access metrics
metrics = result.section_a['long']['metrics']
print(f"Median MFE: {metrics['median_mfe']:.2f}%")
print(f"Median MAE: {metrics['median_mae']:.2f}%")
print(f"Win Rate: {metrics['win_rate']*100:.1f}%")
print(f"MFE 95th: {metrics['mfe_p95']:.2f}%")
print(f"MAE 5th: {metrics['mae_p5']:.2f}%")
Output Structure
The section_a result contains:
result.section_a = {
'long': {
'scatter': {
'raw': {'mfe': np.array, 'mae': np.array},
'trimmed': {'mfe': np.array, 'mae': np.array},
},
'marginals': {
'mfe_bins': np.array,
'mfe_counts': np.array,
'mfe_kde_x': np.array,
'mfe_kde_y': np.array,
# ... same for MAE
},
'metrics': {
'n_trades': int,
'median_mfe': float,
'median_mae': float,
'win_rate': float,
'mfe_p95': float,
'mae_p5': float,
'mae_mfe_corr': float,
}
},
'short': { ... } # Same structure
}
Generated Plots
Scatter Plot

What to look for:
- Dense cluster near (0, 0): Weak follow-through, consider filtering signals
- Right tail in MFE: Edge comes from subset of winners
- Large negative MAE tail: Survival risk, need wide stops
- Wedge shape: Good asymmetry (winners bigger than losers)
- Diagonal correlation: MFE and MAE scale together (regime-mixing?)
Marginal Distributions

What to look for:
- MFE distribution: Right-skewed = few big winners carry the edge
- MAE distribution: Left-skewed = fat tail of large losers
- Bimodal distributions: Multiple trade archetypes (see Section F)
- Tight distributions: Consistent behavior, predictable outcomes
Interpreting Metrics
Median MFE/MAE
The typical achievable profit and typical max drawdown. Use these as baseline targets/stops.
Example:
→ Target ~2.5% profit, expect ~1.2% drawdown on typical trade.Win Rate
Percentage of trades with MFE > 0. Note: This is MFE-based (best achievable), not final P&L.
Example:
→ 65% of trades show some profit potential within horizon H.Percentiles
MFE 95th percentile = best 5% of trades. MAE 5th percentile = worst 5% of trades.
Example:
→ Best trades can reach 8.5%. Worst drawdowns hit -4.2%.Correlation
Correlation between MFE and MAE. High positive correlation suggests regime-mixing or volatility dependence.
Example:
→ Strong positive correlation. Big winners also have big drawdowns. Consider Section E (vol normalization).Configuration Options
Outlier Removal
Control trimming with trim_method and trim_k:
# IQR method (default)
config = AnalysisConfig(trim_method='iqr', trim_k=1.5)
# More permissive (keep more outliers)
config = AnalysisConfig(trim_method='iqr', trim_k=3.0)
# Percentile method
config = AnalysisConfig(trim_method='percentile', trim_k=5) # Remove top/bottom 5%
# No trimming
config = AnalysisConfig(trim_method=None)
When to use:
- Default (IQR, k=1.5): Most cases, removes extreme outliers
- Permissive (k=3.0): When you have clean data or want to keep tail events
- Percentile: When you know exact percentage to trim
- None: When every trade matters (e.g., small sample size)
Decision Guide
Based on your Section A output:
| Observation | Action |
|---|---|
| Dense cluster at (0,0) | Signal has weak follow-through. Consider filtering or shorter horizon. |
| Wedge shape (wide MFE, narrow MAE) | Good asymmetry. Proceed to Section B for stop sizing. |
| High MAE/MFE correlation | Regime-mixing or vol-dependent. Run Section E. |
| Bimodal distributions | Multiple trade types. Run Section F for clustering. |
| Win rate <50% | Edge comes from few big winners. Need patient exits. |
| Win rate >70% | High hit rate. Use smaller targets, wider stops. |
Example Interpretation
Long Trades (n=1247):
Median MFE: 1.85%
Median MAE: -0.92%
Win Rate: 68.5%
MFE 95th: 5.42%
MAE 5th: -3.18%
Correlation: 0.31
Interpretation:
- Positive edge: Median MFE (1.85%) > |Median MAE| (0.92%). Good asymmetry.
- High win rate: 68.5% hit rate suggests mean-reversion or tight signal.
- Reasonable tails: 95th MFE at 5.42% shows upside. 5th MAE at -3.18% is manageable.
- Low correlation: 0.31 suggests consistent behavior across regimes.
Next steps:
- Section B: Find optimal stop size (likely around 1-2% based on MAE)
- Section C: Check if trailing stops work (high win rate suggests MFE-first)
- Section D: Validate TP=2%, SL=1% feasibility
Related Sections
- Section B: Frontiers - Use median MAE to guide stop sizing
- Section E: Volatility - If correlation is high (>0.6)
- Section F: Clusters - If distributions are bimodal
API Reference
- geometry module - Detailed function documentation
- scatter module - Plotting functions