ml4t-diagnostic 0.1.0a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ml4t/diagnostic/AGENT.md +25 -0
- ml4t/diagnostic/__init__.py +166 -0
- ml4t/diagnostic/backends/__init__.py +10 -0
- ml4t/diagnostic/backends/adapter.py +192 -0
- ml4t/diagnostic/backends/polars_backend.py +899 -0
- ml4t/diagnostic/caching/__init__.py +40 -0
- ml4t/diagnostic/caching/cache.py +331 -0
- ml4t/diagnostic/caching/decorators.py +131 -0
- ml4t/diagnostic/caching/smart_cache.py +339 -0
- ml4t/diagnostic/config/AGENT.md +24 -0
- ml4t/diagnostic/config/README.md +267 -0
- ml4t/diagnostic/config/__init__.py +219 -0
- ml4t/diagnostic/config/barrier_config.py +277 -0
- ml4t/diagnostic/config/base.py +301 -0
- ml4t/diagnostic/config/event_config.py +148 -0
- ml4t/diagnostic/config/feature_config.py +404 -0
- ml4t/diagnostic/config/multi_signal_config.py +55 -0
- ml4t/diagnostic/config/portfolio_config.py +215 -0
- ml4t/diagnostic/config/report_config.py +391 -0
- ml4t/diagnostic/config/sharpe_config.py +202 -0
- ml4t/diagnostic/config/signal_config.py +206 -0
- ml4t/diagnostic/config/trade_analysis_config.py +310 -0
- ml4t/diagnostic/config/validation.py +279 -0
- ml4t/diagnostic/core/__init__.py +29 -0
- ml4t/diagnostic/core/numba_utils.py +315 -0
- ml4t/diagnostic/core/purging.py +372 -0
- ml4t/diagnostic/core/sampling.py +471 -0
- ml4t/diagnostic/errors/__init__.py +205 -0
- ml4t/diagnostic/evaluation/AGENT.md +26 -0
- ml4t/diagnostic/evaluation/__init__.py +437 -0
- ml4t/diagnostic/evaluation/autocorrelation.py +531 -0
- ml4t/diagnostic/evaluation/barrier_analysis.py +1050 -0
- ml4t/diagnostic/evaluation/binary_metrics.py +910 -0
- ml4t/diagnostic/evaluation/dashboard.py +715 -0
- ml4t/diagnostic/evaluation/diagnostic_plots.py +1037 -0
- ml4t/diagnostic/evaluation/distribution/__init__.py +499 -0
- ml4t/diagnostic/evaluation/distribution/moments.py +299 -0
- ml4t/diagnostic/evaluation/distribution/tails.py +777 -0
- ml4t/diagnostic/evaluation/distribution/tests.py +470 -0
- ml4t/diagnostic/evaluation/drift/__init__.py +139 -0
- ml4t/diagnostic/evaluation/drift/analysis.py +432 -0
- ml4t/diagnostic/evaluation/drift/domain_classifier.py +517 -0
- ml4t/diagnostic/evaluation/drift/population_stability_index.py +310 -0
- ml4t/diagnostic/evaluation/drift/wasserstein.py +388 -0
- ml4t/diagnostic/evaluation/event_analysis.py +647 -0
- ml4t/diagnostic/evaluation/excursion.py +390 -0
- ml4t/diagnostic/evaluation/feature_diagnostics.py +873 -0
- ml4t/diagnostic/evaluation/feature_outcome.py +666 -0
- ml4t/diagnostic/evaluation/framework.py +935 -0
- ml4t/diagnostic/evaluation/metric_registry.py +255 -0
- ml4t/diagnostic/evaluation/metrics/AGENT.md +23 -0
- ml4t/diagnostic/evaluation/metrics/__init__.py +133 -0
- ml4t/diagnostic/evaluation/metrics/basic.py +160 -0
- ml4t/diagnostic/evaluation/metrics/conditional_ic.py +469 -0
- ml4t/diagnostic/evaluation/metrics/feature_outcome.py +475 -0
- ml4t/diagnostic/evaluation/metrics/ic_statistics.py +446 -0
- ml4t/diagnostic/evaluation/metrics/importance_analysis.py +338 -0
- ml4t/diagnostic/evaluation/metrics/importance_classical.py +375 -0
- ml4t/diagnostic/evaluation/metrics/importance_mda.py +371 -0
- ml4t/diagnostic/evaluation/metrics/importance_shap.py +715 -0
- ml4t/diagnostic/evaluation/metrics/information_coefficient.py +527 -0
- ml4t/diagnostic/evaluation/metrics/interactions.py +772 -0
- ml4t/diagnostic/evaluation/metrics/monotonicity.py +226 -0
- ml4t/diagnostic/evaluation/metrics/risk_adjusted.py +324 -0
- ml4t/diagnostic/evaluation/multi_signal.py +550 -0
- ml4t/diagnostic/evaluation/portfolio_analysis/__init__.py +83 -0
- ml4t/diagnostic/evaluation/portfolio_analysis/analysis.py +734 -0
- ml4t/diagnostic/evaluation/portfolio_analysis/metrics.py +589 -0
- ml4t/diagnostic/evaluation/portfolio_analysis/results.py +334 -0
- ml4t/diagnostic/evaluation/report_generation.py +824 -0
- ml4t/diagnostic/evaluation/signal_selector.py +452 -0
- ml4t/diagnostic/evaluation/stat_registry.py +139 -0
- ml4t/diagnostic/evaluation/stationarity/__init__.py +97 -0
- ml4t/diagnostic/evaluation/stationarity/analysis.py +518 -0
- ml4t/diagnostic/evaluation/stationarity/augmented_dickey_fuller.py +296 -0
- ml4t/diagnostic/evaluation/stationarity/kpss_test.py +308 -0
- ml4t/diagnostic/evaluation/stationarity/phillips_perron.py +365 -0
- ml4t/diagnostic/evaluation/stats/AGENT.md +43 -0
- ml4t/diagnostic/evaluation/stats/__init__.py +191 -0
- ml4t/diagnostic/evaluation/stats/backtest_overfitting.py +219 -0
- ml4t/diagnostic/evaluation/stats/bootstrap.py +228 -0
- ml4t/diagnostic/evaluation/stats/deflated_sharpe_ratio.py +591 -0
- ml4t/diagnostic/evaluation/stats/false_discovery_rate.py +295 -0
- ml4t/diagnostic/evaluation/stats/hac_standard_errors.py +108 -0
- ml4t/diagnostic/evaluation/stats/minimum_track_record.py +408 -0
- ml4t/diagnostic/evaluation/stats/moments.py +164 -0
- ml4t/diagnostic/evaluation/stats/rademacher_adjustment.py +436 -0
- ml4t/diagnostic/evaluation/stats/reality_check.py +155 -0
- ml4t/diagnostic/evaluation/stats/sharpe_inference.py +219 -0
- ml4t/diagnostic/evaluation/themes.py +330 -0
- ml4t/diagnostic/evaluation/threshold_analysis.py +957 -0
- ml4t/diagnostic/evaluation/trade_analysis.py +1136 -0
- ml4t/diagnostic/evaluation/trade_dashboard/__init__.py +32 -0
- ml4t/diagnostic/evaluation/trade_dashboard/app.py +315 -0
- ml4t/diagnostic/evaluation/trade_dashboard/export/__init__.py +18 -0
- ml4t/diagnostic/evaluation/trade_dashboard/export/csv.py +82 -0
- ml4t/diagnostic/evaluation/trade_dashboard/export/html.py +276 -0
- ml4t/diagnostic/evaluation/trade_dashboard/io.py +166 -0
- ml4t/diagnostic/evaluation/trade_dashboard/normalize.py +304 -0
- ml4t/diagnostic/evaluation/trade_dashboard/stats.py +386 -0
- ml4t/diagnostic/evaluation/trade_dashboard/style.py +79 -0
- ml4t/diagnostic/evaluation/trade_dashboard/tabs/__init__.py +21 -0
- ml4t/diagnostic/evaluation/trade_dashboard/tabs/patterns.py +354 -0
- ml4t/diagnostic/evaluation/trade_dashboard/tabs/shap_analysis.py +280 -0
- ml4t/diagnostic/evaluation/trade_dashboard/tabs/stat_validation.py +186 -0
- ml4t/diagnostic/evaluation/trade_dashboard/tabs/worst_trades.py +236 -0
- ml4t/diagnostic/evaluation/trade_dashboard/types.py +129 -0
- ml4t/diagnostic/evaluation/trade_shap/__init__.py +102 -0
- ml4t/diagnostic/evaluation/trade_shap/alignment.py +188 -0
- ml4t/diagnostic/evaluation/trade_shap/characterize.py +413 -0
- ml4t/diagnostic/evaluation/trade_shap/cluster.py +302 -0
- ml4t/diagnostic/evaluation/trade_shap/explain.py +208 -0
- ml4t/diagnostic/evaluation/trade_shap/hypotheses/__init__.py +23 -0
- ml4t/diagnostic/evaluation/trade_shap/hypotheses/generator.py +290 -0
- ml4t/diagnostic/evaluation/trade_shap/hypotheses/matcher.py +251 -0
- ml4t/diagnostic/evaluation/trade_shap/hypotheses/templates.yaml +467 -0
- ml4t/diagnostic/evaluation/trade_shap/models.py +386 -0
- ml4t/diagnostic/evaluation/trade_shap/normalize.py +116 -0
- ml4t/diagnostic/evaluation/trade_shap/pipeline.py +263 -0
- ml4t/diagnostic/evaluation/trade_shap_dashboard.py +283 -0
- ml4t/diagnostic/evaluation/trade_shap_diagnostics.py +588 -0
- ml4t/diagnostic/evaluation/validated_cv.py +535 -0
- ml4t/diagnostic/evaluation/visualization.py +1050 -0
- ml4t/diagnostic/evaluation/volatility/__init__.py +45 -0
- ml4t/diagnostic/evaluation/volatility/analysis.py +351 -0
- ml4t/diagnostic/evaluation/volatility/arch.py +258 -0
- ml4t/diagnostic/evaluation/volatility/garch.py +460 -0
- ml4t/diagnostic/integration/__init__.py +48 -0
- ml4t/diagnostic/integration/backtest_contract.py +671 -0
- ml4t/diagnostic/integration/data_contract.py +316 -0
- ml4t/diagnostic/integration/engineer_contract.py +226 -0
- ml4t/diagnostic/logging/__init__.py +77 -0
- ml4t/diagnostic/logging/logger.py +245 -0
- ml4t/diagnostic/logging/performance.py +234 -0
- ml4t/diagnostic/logging/progress.py +234 -0
- ml4t/diagnostic/logging/wandb.py +412 -0
- ml4t/diagnostic/metrics/__init__.py +9 -0
- ml4t/diagnostic/metrics/percentiles.py +128 -0
- ml4t/diagnostic/py.typed +1 -0
- ml4t/diagnostic/reporting/__init__.py +43 -0
- ml4t/diagnostic/reporting/base.py +130 -0
- ml4t/diagnostic/reporting/html_renderer.py +275 -0
- ml4t/diagnostic/reporting/json_renderer.py +51 -0
- ml4t/diagnostic/reporting/markdown_renderer.py +117 -0
- ml4t/diagnostic/results/AGENT.md +24 -0
- ml4t/diagnostic/results/__init__.py +105 -0
- ml4t/diagnostic/results/barrier_results/__init__.py +36 -0
- ml4t/diagnostic/results/barrier_results/hit_rate.py +304 -0
- ml4t/diagnostic/results/barrier_results/precision_recall.py +266 -0
- ml4t/diagnostic/results/barrier_results/profit_factor.py +297 -0
- ml4t/diagnostic/results/barrier_results/tearsheet.py +397 -0
- ml4t/diagnostic/results/barrier_results/time_to_target.py +305 -0
- ml4t/diagnostic/results/barrier_results/validation.py +38 -0
- ml4t/diagnostic/results/base.py +177 -0
- ml4t/diagnostic/results/event_results.py +349 -0
- ml4t/diagnostic/results/feature_results.py +787 -0
- ml4t/diagnostic/results/multi_signal_results.py +431 -0
- ml4t/diagnostic/results/portfolio_results.py +281 -0
- ml4t/diagnostic/results/sharpe_results.py +448 -0
- ml4t/diagnostic/results/signal_results/__init__.py +74 -0
- ml4t/diagnostic/results/signal_results/ic.py +581 -0
- ml4t/diagnostic/results/signal_results/irtc.py +110 -0
- ml4t/diagnostic/results/signal_results/quantile.py +392 -0
- ml4t/diagnostic/results/signal_results/tearsheet.py +456 -0
- ml4t/diagnostic/results/signal_results/turnover.py +213 -0
- ml4t/diagnostic/results/signal_results/validation.py +147 -0
- ml4t/diagnostic/signal/AGENT.md +17 -0
- ml4t/diagnostic/signal/__init__.py +69 -0
- ml4t/diagnostic/signal/_report.py +152 -0
- ml4t/diagnostic/signal/_utils.py +261 -0
- ml4t/diagnostic/signal/core.py +275 -0
- ml4t/diagnostic/signal/quantile.py +148 -0
- ml4t/diagnostic/signal/result.py +214 -0
- ml4t/diagnostic/signal/signal_ic.py +129 -0
- ml4t/diagnostic/signal/turnover.py +182 -0
- ml4t/diagnostic/splitters/AGENT.md +19 -0
- ml4t/diagnostic/splitters/__init__.py +36 -0
- ml4t/diagnostic/splitters/base.py +501 -0
- ml4t/diagnostic/splitters/calendar.py +421 -0
- ml4t/diagnostic/splitters/calendar_config.py +91 -0
- ml4t/diagnostic/splitters/combinatorial.py +1064 -0
- ml4t/diagnostic/splitters/config.py +322 -0
- ml4t/diagnostic/splitters/cpcv/__init__.py +57 -0
- ml4t/diagnostic/splitters/cpcv/combinations.py +119 -0
- ml4t/diagnostic/splitters/cpcv/partitioning.py +263 -0
- ml4t/diagnostic/splitters/cpcv/purge_engine.py +379 -0
- ml4t/diagnostic/splitters/cpcv/windows.py +190 -0
- ml4t/diagnostic/splitters/group_isolation.py +329 -0
- ml4t/diagnostic/splitters/persistence.py +316 -0
- ml4t/diagnostic/splitters/utils.py +207 -0
- ml4t/diagnostic/splitters/walk_forward.py +757 -0
- ml4t/diagnostic/utils/__init__.py +42 -0
- ml4t/diagnostic/utils/config.py +542 -0
- ml4t/diagnostic/utils/dependencies.py +318 -0
- ml4t/diagnostic/utils/sessions.py +127 -0
- ml4t/diagnostic/validation/__init__.py +54 -0
- ml4t/diagnostic/validation/dataframe.py +274 -0
- ml4t/diagnostic/validation/returns.py +280 -0
- ml4t/diagnostic/validation/timeseries.py +299 -0
- ml4t/diagnostic/visualization/AGENT.md +19 -0
- ml4t/diagnostic/visualization/__init__.py +223 -0
- ml4t/diagnostic/visualization/backtest/__init__.py +98 -0
- ml4t/diagnostic/visualization/backtest/cost_attribution.py +762 -0
- ml4t/diagnostic/visualization/backtest/executive_summary.py +895 -0
- ml4t/diagnostic/visualization/backtest/interactive_controls.py +673 -0
- ml4t/diagnostic/visualization/backtest/statistical_validity.py +874 -0
- ml4t/diagnostic/visualization/backtest/tearsheet.py +565 -0
- ml4t/diagnostic/visualization/backtest/template_system.py +373 -0
- ml4t/diagnostic/visualization/backtest/trade_plots.py +1172 -0
- ml4t/diagnostic/visualization/barrier_plots.py +782 -0
- ml4t/diagnostic/visualization/core.py +1060 -0
- ml4t/diagnostic/visualization/dashboards/__init__.py +36 -0
- ml4t/diagnostic/visualization/dashboards/base.py +582 -0
- ml4t/diagnostic/visualization/dashboards/importance.py +801 -0
- ml4t/diagnostic/visualization/dashboards/interaction.py +263 -0
- ml4t/diagnostic/visualization/dashboards.py +43 -0
- ml4t/diagnostic/visualization/data_extraction/__init__.py +48 -0
- ml4t/diagnostic/visualization/data_extraction/importance.py +649 -0
- ml4t/diagnostic/visualization/data_extraction/interaction.py +504 -0
- ml4t/diagnostic/visualization/data_extraction/types.py +113 -0
- ml4t/diagnostic/visualization/data_extraction/validation.py +66 -0
- ml4t/diagnostic/visualization/feature_plots.py +888 -0
- ml4t/diagnostic/visualization/interaction_plots.py +618 -0
- ml4t/diagnostic/visualization/portfolio/__init__.py +41 -0
- ml4t/diagnostic/visualization/portfolio/dashboard.py +514 -0
- ml4t/diagnostic/visualization/portfolio/drawdown_plots.py +341 -0
- ml4t/diagnostic/visualization/portfolio/returns_plots.py +487 -0
- ml4t/diagnostic/visualization/portfolio/risk_plots.py +301 -0
- ml4t/diagnostic/visualization/report_generation.py +1343 -0
- ml4t/diagnostic/visualization/signal/__init__.py +103 -0
- ml4t/diagnostic/visualization/signal/dashboard.py +911 -0
- ml4t/diagnostic/visualization/signal/event_plots.py +514 -0
- ml4t/diagnostic/visualization/signal/ic_plots.py +635 -0
- ml4t/diagnostic/visualization/signal/multi_signal_dashboard.py +974 -0
- ml4t/diagnostic/visualization/signal/multi_signal_plots.py +603 -0
- ml4t/diagnostic/visualization/signal/quantile_plots.py +625 -0
- ml4t/diagnostic/visualization/signal/turnover_plots.py +400 -0
- ml4t/diagnostic/visualization/trade_shap/__init__.py +90 -0
- ml4t_diagnostic-0.1.0a1.dist-info/METADATA +1044 -0
- ml4t_diagnostic-0.1.0a1.dist-info/RECORD +242 -0
- ml4t_diagnostic-0.1.0a1.dist-info/WHEEL +4 -0
- ml4t_diagnostic-0.1.0a1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
# Trade SHAP Hypothesis Templates
|
|
2
|
+
#
|
|
3
|
+
# Templates for generating hypotheses about why trading patterns cause losses.
|
|
4
|
+
# Each template matches feature patterns and generates actionable suggestions.
|
|
5
|
+
#
|
|
6
|
+
# Template structure:
|
|
7
|
+
# name: Unique identifier
|
|
8
|
+
# description: Human-readable description
|
|
9
|
+
# feature_patterns: Glob patterns to match feature names (fnmatch syntax)
|
|
10
|
+
# conditions:
|
|
11
|
+
# direction: high | low | positive | negative | extreme | moderate | any
|
|
12
|
+
# significance: required | optional
|
|
13
|
+
# hypothesis_template: String template with {feature} placeholder
|
|
14
|
+
# actions: List of remediation suggestions
|
|
15
|
+
# confidence_base: Base confidence score (0-1)
|
|
16
|
+
|
|
17
|
+
# =============================================================================
|
|
18
|
+
# COMPREHENSIVE TEMPLATES (21 templates)
|
|
19
|
+
# =============================================================================
|
|
20
|
+
|
|
21
|
+
comprehensive:
|
|
22
|
+
# ---------------------------------------------------------------------------
|
|
23
|
+
# Momentum patterns
|
|
24
|
+
# ---------------------------------------------------------------------------
|
|
25
|
+
- name: momentum_high
|
|
26
|
+
description: High momentum causing losses
|
|
27
|
+
feature_patterns:
|
|
28
|
+
- "*momentum*"
|
|
29
|
+
- "*mom*"
|
|
30
|
+
- "*roc*"
|
|
31
|
+
conditions:
|
|
32
|
+
direction: high
|
|
33
|
+
significance: required
|
|
34
|
+
hypothesis_template: >-
|
|
35
|
+
Trades are losing when {feature} shows high values, suggesting momentum
|
|
36
|
+
reversal or false breakouts after strong momentum runs
|
|
37
|
+
actions:
|
|
38
|
+
- "Add momentum confirmation: require volume increase with momentum"
|
|
39
|
+
- "Implement momentum decay filters: avoid entries after extended moves"
|
|
40
|
+
- "Consider shorter momentum windows to catch reversals earlier"
|
|
41
|
+
- "Add trend strength indicator to distinguish continuation vs reversal"
|
|
42
|
+
confidence_base: 0.75
|
|
43
|
+
|
|
44
|
+
- name: momentum_low
|
|
45
|
+
description: Low momentum causing losses
|
|
46
|
+
feature_patterns:
|
|
47
|
+
- "*momentum*"
|
|
48
|
+
- "*mom*"
|
|
49
|
+
- "*roc*"
|
|
50
|
+
conditions:
|
|
51
|
+
direction: low
|
|
52
|
+
significance: required
|
|
53
|
+
hypothesis_template: >-
|
|
54
|
+
Trades are losing when {feature} shows low values, suggesting late entries
|
|
55
|
+
after momentum exhaustion or premature counter-trend trades
|
|
56
|
+
actions:
|
|
57
|
+
- "Tighten momentum entry thresholds: require minimum momentum"
|
|
58
|
+
- "Add trend confirmation before counter-trend entries"
|
|
59
|
+
- "Consider leading indicators (e.g., volume, breadth) before momentum"
|
|
60
|
+
- "Implement regime filters: avoid low momentum in trending regimes"
|
|
61
|
+
confidence_base: 0.70
|
|
62
|
+
|
|
63
|
+
- name: momentum_negative
|
|
64
|
+
description: Negative momentum causing losses
|
|
65
|
+
feature_patterns:
|
|
66
|
+
- "*momentum*"
|
|
67
|
+
- "*mom*"
|
|
68
|
+
- "*roc*"
|
|
69
|
+
conditions:
|
|
70
|
+
direction: negative
|
|
71
|
+
significance: required
|
|
72
|
+
hypothesis_template: >-
|
|
73
|
+
Trades are losing when {feature} is negative, indicating counter-trend
|
|
74
|
+
entries or failed trend following in downtrends
|
|
75
|
+
actions:
|
|
76
|
+
- "Add directional filters: only trade with positive momentum"
|
|
77
|
+
- "Implement regime awareness: avoid counter-trend in strong trends"
|
|
78
|
+
- "Consider dual momentum: combine absolute + relative momentum"
|
|
79
|
+
- "Add volatility filters: avoid high vol during negative momentum"
|
|
80
|
+
confidence_base: 0.72
|
|
81
|
+
|
|
82
|
+
# ---------------------------------------------------------------------------
|
|
83
|
+
# Volatility patterns
|
|
84
|
+
# ---------------------------------------------------------------------------
|
|
85
|
+
- name: volatility_high
|
|
86
|
+
description: High volatility causing losses
|
|
87
|
+
feature_patterns:
|
|
88
|
+
- "*vol*"
|
|
89
|
+
- "*volatility*"
|
|
90
|
+
- "*atr*"
|
|
91
|
+
conditions:
|
|
92
|
+
direction: high
|
|
93
|
+
significance: required
|
|
94
|
+
hypothesis_template: >-
|
|
95
|
+
Trades are losing when {feature} is high, indicating entries during
|
|
96
|
+
volatility spikes with wider spreads and adverse execution
|
|
97
|
+
actions:
|
|
98
|
+
- "Add volatility ceiling: skip entries when volatility exceeds threshold"
|
|
99
|
+
- "Implement adaptive position sizing: reduce size in high volatility"
|
|
100
|
+
- "Consider volatility-adjusted stops: wider stops in high vol periods"
|
|
101
|
+
- "Add regime filters: identify vol spike regimes using rolling percentiles"
|
|
102
|
+
confidence_base: 0.78
|
|
103
|
+
|
|
104
|
+
- name: volatility_low
|
|
105
|
+
description: Low volatility causing losses
|
|
106
|
+
feature_patterns:
|
|
107
|
+
- "*vol*"
|
|
108
|
+
- "*volatility*"
|
|
109
|
+
- "*atr*"
|
|
110
|
+
conditions:
|
|
111
|
+
direction: low
|
|
112
|
+
significance: required
|
|
113
|
+
hypothesis_template: >-
|
|
114
|
+
Trades are losing when {feature} is low, suggesting false breakouts from
|
|
115
|
+
consolidation or insufficient price movement
|
|
116
|
+
actions:
|
|
117
|
+
- "Add volatility floor: require minimum volatility for breakout trades"
|
|
118
|
+
- "Implement breakout confirmation: volume + price action confirmation"
|
|
119
|
+
- "Consider volatility expansion filters: wait for vol to increase"
|
|
120
|
+
- "Add range filters: measure consolidation tightness before breakouts"
|
|
121
|
+
confidence_base: 0.73
|
|
122
|
+
|
|
123
|
+
- name: volatility_regime
|
|
124
|
+
description: Volatility regime shifts causing losses
|
|
125
|
+
feature_patterns:
|
|
126
|
+
- "*vol*regime*"
|
|
127
|
+
- "*vol_state*"
|
|
128
|
+
- "*volatility*state*"
|
|
129
|
+
conditions:
|
|
130
|
+
direction: any
|
|
131
|
+
significance: required
|
|
132
|
+
hypothesis_template: >-
|
|
133
|
+
Trades are losing during {feature} regime shifts, suggesting strategy
|
|
134
|
+
is regime-dependent and fails during transitions
|
|
135
|
+
actions:
|
|
136
|
+
- "Add regime detection: identify and label vol regimes (low/medium/high)"
|
|
137
|
+
- "Implement regime-specific strategies: different parameters per regime"
|
|
138
|
+
- "Consider vol targeting: dynamically adjust exposure to target constant vol"
|
|
139
|
+
- "Add transition filters: skip trades during regime changes"
|
|
140
|
+
confidence_base: 0.76
|
|
141
|
+
|
|
142
|
+
# ---------------------------------------------------------------------------
|
|
143
|
+
# Trend patterns
|
|
144
|
+
# ---------------------------------------------------------------------------
|
|
145
|
+
- name: trend_high
|
|
146
|
+
description: Strong trend causing losses
|
|
147
|
+
feature_patterns:
|
|
148
|
+
- "*trend*"
|
|
149
|
+
- "*adx*"
|
|
150
|
+
- "*dmi*"
|
|
151
|
+
conditions:
|
|
152
|
+
direction: high
|
|
153
|
+
significance: required
|
|
154
|
+
hypothesis_template: >-
|
|
155
|
+
Trades are losing when {feature} indicates strong trend, suggesting
|
|
156
|
+
whipsaws in ranging markets or late entries in exhausted trends
|
|
157
|
+
actions:
|
|
158
|
+
- "Add trend strength confirmation: require multiple trend indicators to align"
|
|
159
|
+
- "Implement market regime filters: identify ranging vs trending markets"
|
|
160
|
+
- "Consider trend maturity: avoid entries in late-stage trends"
|
|
161
|
+
- "Add mean reversion filters: detect ranging conditions early"
|
|
162
|
+
confidence_base: 0.71
|
|
163
|
+
|
|
164
|
+
- name: trend_low
|
|
165
|
+
description: Weak trend causing losses
|
|
166
|
+
feature_patterns:
|
|
167
|
+
- "*trend*"
|
|
168
|
+
- "*adx*"
|
|
169
|
+
- "*dmi*"
|
|
170
|
+
conditions:
|
|
171
|
+
direction: low
|
|
172
|
+
significance: required
|
|
173
|
+
hypothesis_template: >-
|
|
174
|
+
Trades are losing when {feature} is low (weak trend), indicating
|
|
175
|
+
premature mean reversion entries in trending markets
|
|
176
|
+
actions:
|
|
177
|
+
- "Strengthen trend filters: require clearer trend exhaustion signals"
|
|
178
|
+
- "Add reversal confirmation: wait for actual trend reversal, not just weakness"
|
|
179
|
+
- "Implement regime awareness: avoid counter-trend in persistent trends"
|
|
180
|
+
- "Consider divergence indicators: look for momentum/price divergence"
|
|
181
|
+
confidence_base: 0.74
|
|
182
|
+
|
|
183
|
+
# ---------------------------------------------------------------------------
|
|
184
|
+
# Mean reversion / oscillator patterns
|
|
185
|
+
# ---------------------------------------------------------------------------
|
|
186
|
+
- name: oscillator_extreme
|
|
187
|
+
description: Extreme oscillator values causing losses
|
|
188
|
+
feature_patterns:
|
|
189
|
+
- "*rsi*"
|
|
190
|
+
- "*stoch*"
|
|
191
|
+
- "*williams*"
|
|
192
|
+
- "*cci*"
|
|
193
|
+
conditions:
|
|
194
|
+
direction: extreme
|
|
195
|
+
significance: required
|
|
196
|
+
hypothesis_template: >-
|
|
197
|
+
Trades are losing when {feature} shows extreme values, suggesting mean
|
|
198
|
+
reversion signals are triggering in trending markets or regime shifts
|
|
199
|
+
actions:
|
|
200
|
+
- "Add trend filters: only take mean reversion in range-bound markets"
|
|
201
|
+
- "Implement confirmation delays: wait for initial reversal before entry"
|
|
202
|
+
- "Consider multi-timeframe: confirm reversion on multiple timeframes"
|
|
203
|
+
- "Add volume confirmation: require volume to support reversal"
|
|
204
|
+
confidence_base: 0.72
|
|
205
|
+
|
|
206
|
+
- name: oscillator_moderate
|
|
207
|
+
description: Moderate oscillator values causing losses
|
|
208
|
+
feature_patterns:
|
|
209
|
+
- "*rsi*"
|
|
210
|
+
- "*stoch*"
|
|
211
|
+
- "*williams*"
|
|
212
|
+
- "*cci*"
|
|
213
|
+
conditions:
|
|
214
|
+
direction: moderate
|
|
215
|
+
significance: required
|
|
216
|
+
hypothesis_template: >-
|
|
217
|
+
Trades are losing when {feature} is moderately extended, indicating
|
|
218
|
+
premature entries before true extremes are reached
|
|
219
|
+
actions:
|
|
220
|
+
- "Tighten entry thresholds: wait for more extreme readings"
|
|
221
|
+
- "Add confirmation indicators: combine multiple oscillators"
|
|
222
|
+
- "Implement patience filters: require sustained extreme readings"
|
|
223
|
+
- "Consider adaptive thresholds: adjust based on recent volatility"
|
|
224
|
+
confidence_base: 0.68
|
|
225
|
+
|
|
226
|
+
# ---------------------------------------------------------------------------
|
|
227
|
+
# Volume patterns
|
|
228
|
+
# ---------------------------------------------------------------------------
|
|
229
|
+
- name: volume_low
|
|
230
|
+
description: Low volume causing losses
|
|
231
|
+
feature_patterns:
|
|
232
|
+
- "*volume*"
|
|
233
|
+
- "*vol_*"
|
|
234
|
+
- "*obv*"
|
|
235
|
+
conditions:
|
|
236
|
+
direction: low
|
|
237
|
+
significance: required
|
|
238
|
+
hypothesis_template: >-
|
|
239
|
+
Trades are losing when {feature} is low, indicating price moves without
|
|
240
|
+
volume support (weak/false signals)
|
|
241
|
+
actions:
|
|
242
|
+
- "Add volume confirmation: require minimum volume for entry signals"
|
|
243
|
+
- "Implement volume thresholds: compare to recent average volume"
|
|
244
|
+
- "Consider volume profile: analyze volume distribution at price levels"
|
|
245
|
+
- "Add breadth indicators: confirm with market-wide participation"
|
|
246
|
+
confidence_base: 0.77
|
|
247
|
+
|
|
248
|
+
- name: volume_high
|
|
249
|
+
description: High volume causing losses
|
|
250
|
+
feature_patterns:
|
|
251
|
+
- "*volume*"
|
|
252
|
+
- "*vol_*"
|
|
253
|
+
- "*obv*"
|
|
254
|
+
conditions:
|
|
255
|
+
direction: high
|
|
256
|
+
significance: required
|
|
257
|
+
hypothesis_template: >-
|
|
258
|
+
Trades are losing when {feature} is high, suggesting volume climax or
|
|
259
|
+
panic selling indicating trend exhaustion
|
|
260
|
+
actions:
|
|
261
|
+
- "Add volume spike filters: avoid entries during extreme volume"
|
|
262
|
+
- "Implement exhaustion detection: identify climactic volume patterns"
|
|
263
|
+
- "Consider volume rate of change: track acceleration patterns"
|
|
264
|
+
- "Add wait periods: delay entries after volume spikes"
|
|
265
|
+
confidence_base: 0.74
|
|
266
|
+
|
|
267
|
+
# ---------------------------------------------------------------------------
|
|
268
|
+
# Correlation / relationship patterns
|
|
269
|
+
# ---------------------------------------------------------------------------
|
|
270
|
+
- name: correlation_low
|
|
271
|
+
description: Low correlation causing losses
|
|
272
|
+
feature_patterns:
|
|
273
|
+
- "*corr*"
|
|
274
|
+
- "*correlation*"
|
|
275
|
+
- "*beta*"
|
|
276
|
+
conditions:
|
|
277
|
+
direction: low
|
|
278
|
+
significance: required
|
|
279
|
+
hypothesis_template: >-
|
|
280
|
+
Trades are losing when {feature} is low, indicating breakdown of expected
|
|
281
|
+
correlations or relationships (regime shift or structural change)
|
|
282
|
+
actions:
|
|
283
|
+
- "Add correlation monitoring: track rolling correlations for stability"
|
|
284
|
+
- "Implement regime filters: identify correlation regimes"
|
|
285
|
+
- "Consider multi-asset confirmation: require consistent signals across assets"
|
|
286
|
+
- "Add relationship validation: verify fundamental relationship holds"
|
|
287
|
+
confidence_base: 0.79
|
|
288
|
+
|
|
289
|
+
- name: spread_high
|
|
290
|
+
description: High spread causing losses
|
|
291
|
+
feature_patterns:
|
|
292
|
+
- "*spread*"
|
|
293
|
+
- "*basis*"
|
|
294
|
+
- "*premium*"
|
|
295
|
+
conditions:
|
|
296
|
+
direction: high
|
|
297
|
+
significance: required
|
|
298
|
+
hypothesis_template: >-
|
|
299
|
+
Trades are losing when {feature} widens, suggesting liquidity stress,
|
|
300
|
+
market dislocation, or fundamental relationship breakdown
|
|
301
|
+
actions:
|
|
302
|
+
- "Add spread thresholds: avoid trades when spread exceeds limits"
|
|
303
|
+
- "Implement liquidity filters: monitor bid-ask spreads and depth"
|
|
304
|
+
- "Consider funding cost tracking: monitor cost of carry"
|
|
305
|
+
- "Add market stress indicators: detect risk-off environments"
|
|
306
|
+
confidence_base: 0.80
|
|
307
|
+
|
|
308
|
+
# ---------------------------------------------------------------------------
|
|
309
|
+
# Regime patterns
|
|
310
|
+
# ---------------------------------------------------------------------------
|
|
311
|
+
- name: regime_transition
|
|
312
|
+
description: Regime transitions causing losses
|
|
313
|
+
feature_patterns:
|
|
314
|
+
- "*regime*"
|
|
315
|
+
- "*state*"
|
|
316
|
+
- "*hmm*"
|
|
317
|
+
conditions:
|
|
318
|
+
direction: any
|
|
319
|
+
significance: required
|
|
320
|
+
hypothesis_template: >-
|
|
321
|
+
Trades are losing when {feature} indicates regime transition, suggesting
|
|
322
|
+
strategy parameters are regime-dependent
|
|
323
|
+
actions:
|
|
324
|
+
- "Add regime detection: implement HMM or regime-switching models"
|
|
325
|
+
- "Implement regime-aware strategies: different parameters per regime"
|
|
326
|
+
- "Consider regime transition filters: pause trading during transitions"
|
|
327
|
+
- "Add ensemble approach: combine regime-specific sub-strategies"
|
|
328
|
+
confidence_base: 0.81
|
|
329
|
+
|
|
330
|
+
- name: market_state
|
|
331
|
+
description: Market state causing losses
|
|
332
|
+
feature_patterns:
|
|
333
|
+
- "*market_state*"
|
|
334
|
+
- "*mkt_regime*"
|
|
335
|
+
- "*environment*"
|
|
336
|
+
conditions:
|
|
337
|
+
direction: any
|
|
338
|
+
significance: required
|
|
339
|
+
hypothesis_template: >-
|
|
340
|
+
Trades are losing in specific {feature} states, indicating strategy
|
|
341
|
+
works only in certain market regimes
|
|
342
|
+
actions:
|
|
343
|
+
- "Implement regime filtering: only trade in favorable regimes"
|
|
344
|
+
- "Add regime detection: classify markets (trending/ranging/volatile)"
|
|
345
|
+
- "Consider adaptive parameters: adjust strategy based on regime"
|
|
346
|
+
- "Add regime-specific backtesting: validate strategy per regime"
|
|
347
|
+
confidence_base: 0.78
|
|
348
|
+
|
|
349
|
+
# ---------------------------------------------------------------------------
|
|
350
|
+
# Moving average patterns
|
|
351
|
+
# ---------------------------------------------------------------------------
|
|
352
|
+
- name: ma_crossover
|
|
353
|
+
description: MA crossover related losses
|
|
354
|
+
feature_patterns:
|
|
355
|
+
- "*ma*"
|
|
356
|
+
- "*ema*"
|
|
357
|
+
- "*sma*"
|
|
358
|
+
conditions:
|
|
359
|
+
direction: any
|
|
360
|
+
significance: required
|
|
361
|
+
hypothesis_template: >-
|
|
362
|
+
Trades are losing when {feature} conditions are present, suggesting
|
|
363
|
+
whipsaws in ranging markets or delayed signals in trending markets
|
|
364
|
+
actions:
|
|
365
|
+
- "Add confirmation filters: require price action confirmation"
|
|
366
|
+
- "Implement ADX filter: only trade crossovers in trending conditions"
|
|
367
|
+
- "Consider adaptive MAs: use ATR-based or volatility-adjusted periods"
|
|
368
|
+
- "Add time-based filters: avoid recent crossover reversals"
|
|
369
|
+
confidence_base: 0.69
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
# =============================================================================
|
|
373
|
+
# MINIMAL TEMPLATES (5 templates) - fallback patterns
|
|
374
|
+
# =============================================================================
|
|
375
|
+
|
|
376
|
+
minimal:
|
|
377
|
+
- name: momentum_generic
|
|
378
|
+
description: Momentum-related losses
|
|
379
|
+
feature_patterns:
|
|
380
|
+
- "*momentum*"
|
|
381
|
+
- "*mom*"
|
|
382
|
+
- "*roc*"
|
|
383
|
+
conditions:
|
|
384
|
+
direction: any
|
|
385
|
+
significance: required
|
|
386
|
+
hypothesis_template: >-
|
|
387
|
+
Trades are losing when {feature} shows extreme values, suggesting
|
|
388
|
+
momentum timing issues
|
|
389
|
+
actions:
|
|
390
|
+
- "Add momentum confirmation with volume"
|
|
391
|
+
- "Implement momentum decay filters"
|
|
392
|
+
- "Consider shorter momentum windows"
|
|
393
|
+
confidence_base: 0.70
|
|
394
|
+
|
|
395
|
+
- name: volatility_generic
|
|
396
|
+
description: Volatility-related losses
|
|
397
|
+
feature_patterns:
|
|
398
|
+
- "*vol*"
|
|
399
|
+
- "*volatility*"
|
|
400
|
+
- "*atr*"
|
|
401
|
+
conditions:
|
|
402
|
+
direction: any
|
|
403
|
+
significance: required
|
|
404
|
+
hypothesis_template: >-
|
|
405
|
+
Trades are losing when {feature} is extreme, indicating volatility
|
|
406
|
+
regime issues
|
|
407
|
+
actions:
|
|
408
|
+
- "Add volatility filters (ceiling and floor)"
|
|
409
|
+
- "Implement adaptive position sizing"
|
|
410
|
+
- "Add regime detection for volatility"
|
|
411
|
+
confidence_base: 0.72
|
|
412
|
+
|
|
413
|
+
- name: trend_generic
|
|
414
|
+
description: Trend-related losses
|
|
415
|
+
feature_patterns:
|
|
416
|
+
- "*trend*"
|
|
417
|
+
- "*ma*"
|
|
418
|
+
- "*ema*"
|
|
419
|
+
- "*adx*"
|
|
420
|
+
conditions:
|
|
421
|
+
direction: any
|
|
422
|
+
significance: required
|
|
423
|
+
hypothesis_template: >-
|
|
424
|
+
Trades are losing when {feature} indicates trend conditions, suggesting
|
|
425
|
+
trend/range regime issues
|
|
426
|
+
actions:
|
|
427
|
+
- "Add trend strength confirmation"
|
|
428
|
+
- "Implement market regime filters"
|
|
429
|
+
- "Consider trend maturity indicators"
|
|
430
|
+
confidence_base: 0.68
|
|
431
|
+
|
|
432
|
+
- name: oscillator_generic
|
|
433
|
+
description: Mean reversion failures
|
|
434
|
+
feature_patterns:
|
|
435
|
+
- "*rsi*"
|
|
436
|
+
- "*stoch*"
|
|
437
|
+
- "*williams*"
|
|
438
|
+
- "*cci*"
|
|
439
|
+
conditions:
|
|
440
|
+
direction: any
|
|
441
|
+
significance: required
|
|
442
|
+
hypothesis_template: >-
|
|
443
|
+
Trades are losing when {feature} is extreme, indicating mean reversion
|
|
444
|
+
signals failing in trends
|
|
445
|
+
actions:
|
|
446
|
+
- "Add trend filters for mean reversion"
|
|
447
|
+
- "Implement confirmation delays"
|
|
448
|
+
- "Consider multi-timeframe confirmation"
|
|
449
|
+
confidence_base: 0.69
|
|
450
|
+
|
|
451
|
+
- name: volume_generic
|
|
452
|
+
description: Volume-related losses
|
|
453
|
+
feature_patterns:
|
|
454
|
+
- "*volume*"
|
|
455
|
+
- "*vol_*"
|
|
456
|
+
- "*obv*"
|
|
457
|
+
conditions:
|
|
458
|
+
direction: any
|
|
459
|
+
significance: required
|
|
460
|
+
hypothesis_template: >-
|
|
461
|
+
Trades are losing when {feature} is extreme, indicating volume
|
|
462
|
+
confirmation issues
|
|
463
|
+
actions:
|
|
464
|
+
- "Add volume confirmation requirements"
|
|
465
|
+
- "Implement volume thresholds"
|
|
466
|
+
- "Consider volume profile analysis"
|
|
467
|
+
confidence_base: 0.71
|