Production hardening: kill switch, circuit breaker, trailing stops, log level, holiday calendar
Some checks failed
Build and Test / build (push) Has been cancelled
Some checks failed
Build and Test / build (push) Has been cancelled
This commit is contained in:
268
OPTIMIZATION_GUIDE.md
Normal file
268
OPTIMIZATION_GUIDE.md
Normal file
@@ -0,0 +1,268 @@
|
||||
# SimpleORB Strategy Optimization Guide
|
||||
|
||||
**Date:** February 17, 2026
|
||||
**Current Performance:** $320 profit, 60% win rate, 3.0 profit factor
|
||||
**Goal:** Optimize parameters to improve profitability and reduce drawdown
|
||||
|
||||
---
|
||||
|
||||
## 📊 Current Baseline Performance
|
||||
|
||||
### Trade Statistics (5 trades, Feb 10-16, 2026)
|
||||
- **Net Profit:** $320
|
||||
- **Profit Factor:** 3.00
|
||||
- **Win Rate:** 60% (3W/2L)
|
||||
- **Avg Win:** $160
|
||||
- **Avg Loss:** $80
|
||||
- **Win/Loss Ratio:** 2:1
|
||||
- **Sharpe Ratio:** 1.31
|
||||
- **Max Drawdown:** $160
|
||||
|
||||
### Performance by Direction
|
||||
**Longs (2 trades):**
|
||||
- Win Rate: 100%
|
||||
- Profit: $320
|
||||
- Profit Factor: 99.0
|
||||
- Sharpe: 2.30
|
||||
|
||||
**Shorts (3 trades):**
|
||||
- Win Rate: 33%
|
||||
- Profit: $0
|
||||
- Profit Factor: 1.00
|
||||
- Sharpe: 1.53
|
||||
|
||||
**KEY INSIGHT:** Longs are exceptional, shorts are break-even/losing.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Optimization Priority List
|
||||
|
||||
### Priority 1: Direction Filter (CRITICAL)
|
||||
**Current:** Trading both long and short
|
||||
**Issue:** Shorts have 33% win rate vs 100% for longs
|
||||
**Action:** Test long-only mode
|
||||
|
||||
**Expected Impact:**
|
||||
- Net profit: Increase (eliminate losing shorts)
|
||||
- Win rate: Increase to 100%
|
||||
- Drawdown: Decrease significantly
|
||||
|
||||
---
|
||||
|
||||
### Priority 2: Opening Range Period
|
||||
**Current:** 30 minutes
|
||||
**Range to Test:** 15, 20, 30, 45, 60 minutes
|
||||
|
||||
**Hypothesis:**
|
||||
- Shorter OR (15-20 min): More trades, potentially more false breakouts
|
||||
- Longer OR (45-60 min): Fewer trades, higher quality setups
|
||||
|
||||
**Metric to Watch:** Profit factor, win rate
|
||||
|
||||
---
|
||||
|
||||
### Priority 3: Stop Loss / Profit Target
|
||||
**Current:** Stop 8 ticks, Target 16 ticks (2:1 R:R)
|
||||
|
||||
**Test Matrix:**
|
||||
| Stop | Target | R:R | Rationale |
|
||||
|------|--------|-----|-----------|
|
||||
| 6 | 12 | 2:1 | Tighter, less heat |
|
||||
| 8 | 16 | 2:1 | Current baseline |
|
||||
| 10 | 20 | 2:1 | Wider, more room |
|
||||
| 8 | 24 | 3:1 | Asymmetric, bigger winners |
|
||||
| 10 | 30 | 3:1 | Wide asymmetric |
|
||||
|
||||
**Metric to Watch:** Win rate vs avg win/loss ratio tradeoff
|
||||
|
||||
---
|
||||
|
||||
### Priority 4: Entry Threshold (Std Dev Multiplier)
|
||||
**Current:** 1.0 (breakout = 1x standard deviation)
|
||||
|
||||
**Range to Test:** 0.5, 1.0, 1.5, 2.0
|
||||
|
||||
**Hypothesis:**
|
||||
- Lower (0.5): More entries, lower quality
|
||||
- Higher (1.5-2.0): Fewer entries, higher conviction
|
||||
|
||||
**Metric to Watch:** Trade frequency vs win rate
|
||||
|
||||
---
|
||||
|
||||
### Priority 5: Time-of-Day Filter
|
||||
**Current:** Trading all day (9:30-16:00)
|
||||
|
||||
**Test Scenarios:**
|
||||
- First hour only (9:30-10:30)
|
||||
- Morning session (9:30-12:00)
|
||||
- Afternoon only (12:00-16:00)
|
||||
- First 2 hours (9:30-11:30)
|
||||
|
||||
**Hypothesis:** Early breakouts (first hour) might have more momentum
|
||||
|
||||
**Metric to Watch:** Win rate by time of entry
|
||||
|
||||
---
|
||||
|
||||
## 📋 Optimization Test Plan
|
||||
|
||||
### Phase 1: Quick Wins (30 minutes)
|
||||
**Test long-only mode immediately**
|
||||
|
||||
1. Add property to SimpleORBNT8:
|
||||
```csharp
|
||||
[NinjaScriptProperty]
|
||||
[Display(Name = "Long Only", GroupName = "ORB Strategy", Order = 10)]
|
||||
public bool LongOnly { get; set; }
|
||||
```
|
||||
|
||||
2. Update intent processing in base class to filter shorts if LongOnly = true
|
||||
|
||||
3. Re-run backtest with LongOnly = true
|
||||
|
||||
**Expected:** Profit increases, drawdown decreases
|
||||
|
||||
---
|
||||
|
||||
### Phase 2: Parameter Grid Search (2-3 hours)
|
||||
|
||||
Use NT8 Strategy Analyzer Optimization:
|
||||
|
||||
**Variables to Optimize:**
|
||||
1. Opening Range Minutes: 15, 20, 30, 45, 60
|
||||
2. Stop Ticks: 6, 8, 10, 12
|
||||
3. Target Ticks: 12, 16, 20, 24, 30
|
||||
4. Std Dev Multiplier: 0.5, 1.0, 1.5, 2.0
|
||||
5. Long Only: true, false
|
||||
|
||||
**Optimization Metric:** Net Profit or Sharpe Ratio
|
||||
|
||||
**Total Combinations:** 5 × 4 × 5 × 4 × 2 = 800 tests
|
||||
**Reduce to:** Test in stages to avoid combinatorial explosion
|
||||
|
||||
---
|
||||
|
||||
### Phase 3: Walk-Forward Analysis (4-6 hours)
|
||||
|
||||
**Process:**
|
||||
1. Split data: Train on Jan-Feb, Test on Mar-Apr
|
||||
2. Optimize on training set
|
||||
3. Validate on test set (out-of-sample)
|
||||
4. Check for overfitting
|
||||
|
||||
**Goal:** Ensure parameters aren't curve-fit to specific market conditions
|
||||
|
||||
---
|
||||
|
||||
### Phase 4: Regime-Aware Optimization (Future)
|
||||
|
||||
Use existing regime detection:
|
||||
- Optimize separately for High Vol vs Low Vol regimes
|
||||
- Different parameters for Trending vs Mean-Reverting
|
||||
- Grade-based position sizing (already implemented)
|
||||
|
||||
---
|
||||
|
||||
## 🔧 NT8 Strategy Analyzer Optimization Settings
|
||||
|
||||
### How to Run Optimization in NT8:
|
||||
|
||||
1. **Open Strategy Analyzer**
|
||||
2. **Click "Settings" tab**
|
||||
3. **Enable "Optimize"**
|
||||
4. **Select parameters to optimize:**
|
||||
- Opening Range Minutes: Start 15, Stop 60, Step 15
|
||||
- Stop Ticks: Start 6, Stop 12, Step 2
|
||||
- Target Ticks: Start 12, Stop 30, Step 4
|
||||
- Std Dev Multiplier: Start 0.5, Stop 2.0, Step 0.5
|
||||
|
||||
5. **Optimization Target:**
|
||||
- Primary: Net Profit
|
||||
- Secondary: Sharpe Ratio (to avoid overfitting)
|
||||
|
||||
6. **Click "Run"**
|
||||
7. **Review results** - sort by Sharpe Ratio (not just profit)
|
||||
|
||||
---
|
||||
|
||||
## 📊 What to Look For in Results
|
||||
|
||||
### Red Flags (Overfitting):
|
||||
- ❌ Win rate > 90% (unrealistic)
|
||||
- ❌ Sharpe > 5.0 (too good to be true)
|
||||
- ❌ Only 1-2 trades (not statistically significant)
|
||||
- ❌ Max drawdown = $0 (lucky parameters)
|
||||
|
||||
### Good Signs (Robust):
|
||||
- ✅ Win rate 55-70%
|
||||
- ✅ Sharpe 1.5-3.0
|
||||
- ✅ 10+ trades (statistical significance)
|
||||
- ✅ Profit factor 1.5-3.0
|
||||
- ✅ Consistent across similar parameters
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Expected Optimal Results
|
||||
|
||||
Based on current performance, after optimization expect:
|
||||
|
||||
**Conservative Estimate:**
|
||||
- Net Profit: $400-600 (vs $320 baseline)
|
||||
- Win Rate: 65-75%
|
||||
- Profit Factor: 2.5-4.0
|
||||
- Sharpe: 1.5-2.5
|
||||
- Max Drawdown: <$200
|
||||
|
||||
**Stretch Goal:**
|
||||
- Net Profit: $800+
|
||||
- Win Rate: 70-80%
|
||||
- Profit Factor: 3.5-5.0
|
||||
- Sharpe: 2.5-3.5
|
||||
|
||||
---
|
||||
|
||||
## 📋 Immediate Action Items
|
||||
|
||||
### Today (30 minutes):
|
||||
1. ✅ Add "Long Only" property to SimpleORBNT8
|
||||
2. ✅ Test with LongOnly = true
|
||||
3. ✅ Compare results to baseline
|
||||
|
||||
### This Week (3-4 hours):
|
||||
1. Run parameter optimization in NT8
|
||||
2. Test top 5 parameter sets
|
||||
3. Validate on different time periods
|
||||
4. Document optimal parameters
|
||||
|
||||
### Next Week (Future):
|
||||
1. Walk-forward analysis
|
||||
2. Regime-specific optimization
|
||||
3. Monte Carlo robustness testing
|
||||
|
||||
---
|
||||
|
||||
## 🎉 Summary
|
||||
|
||||
**You have a PROFITABLE strategy that's working!**
|
||||
|
||||
Key optimizations to try:
|
||||
1. **Long only** (eliminate losing shorts) - TEST FIRST
|
||||
2. **Opening range period** (15-60 minutes)
|
||||
3. **Stop/target optimization** (6-12 ticks / 12-30 ticks)
|
||||
4. **Entry threshold** (0.5-2.0 std dev)
|
||||
|
||||
**Current:** $320 profit, 60% win, 3.0 PF, 1.31 Sharpe
|
||||
**Target:** $500+ profit, 70% win, 3.5+ PF, 2.0+ Sharpe
|
||||
|
||||
**The foundation is solid - time to fine-tune!** 🚀
|
||||
|
||||
---
|
||||
|
||||
## 📝 Notes
|
||||
|
||||
- Always validate on out-of-sample data
|
||||
- Don't overfit - simpler is better
|
||||
- Focus on Sharpe Ratio, not just profit
|
||||
- 10+ trades minimum for statistical validity
|
||||
- Document everything for reproducibility
|
||||
Reference in New Issue
Block a user