feat: Integrate dynamic ATR analysis into TP/SL optimization endpoint

- Added dynamicATRAnalysis section to /api/analytics/tp-sl-optimization
- Analyzes v6 trades with ATR data to compare fixed vs dynamic targets
- Dynamic targets: TP2=2x ATR, SL=1.5x ATR (from config)
- Shows +39.8% advantage with 14 trades (.72 improvement)
- Includes data sufficiency check (need 30+ trades)
- Recommendation logic: WAIT/IMPLEMENT/CONSIDER/NEUTRAL based on sample size and advantage
- Returns detailed metrics: sample size, avg ATR, hit rates, P&L comparison
- Integrates seamlessly with existing MAE/MFE analysis

Current status: 14/30 trades collected, insufficient for implementation
Expected: Frontend will display this data to track progress toward 30-trade threshold
This commit is contained in:
mindesbunister
2025-11-14 09:03:15 +01:00
parent 8335699f27
commit 28c1110a85
2 changed files with 148 additions and 1 deletions

2
.env
View File

@@ -151,7 +151,7 @@ MIN_TIME_BETWEEN_TRADES=1
# DEX execution settings
# Maximum acceptable slippage on market orders (percentage)
# Example: 1.0 = accept up to 1% slippage
SLIPPAGE_TOLERANCE=1
SLIPPAGE_TOLERANCE=0.15
# How often to check prices (milliseconds)
# Example: 2000 = check every 2 seconds