Alpha Research: Difference between revisions
Blanked the page Tags: Blanking Manual revert |
No edit summary |
||
| Line 1: | Line 1: | ||
# MA21 Mean Reversion Strategy | |||
## MCX Crude Oil - Intraday Trading System | |||
--- | |||
## Core Concept | |||
**Trade pullbacks to the 21-period Moving Average (MA21).** | |||
The MA21 acts as a dynamic support/resistance zone. When price pulls back to this zone during a trending market, we enter in the direction of the trend expecting price to continue. | |||
> *"The MA is a ZONE, not a thin line"* - Entry allowed within ±25 points of MA21 | |||
--- | |||
## Instrument & Timeframe | |||
| Parameter | Value | | |||
|-----------|-------| | |||
| Instrument | MCX Crude Oil Futures | | |||
| Chart Timeframe | 5-minute | | |||
| Entry Precision | 1-minute (for exact timing) | | |||
| Trading Hours | 9:00 AM - 11:30 PM IST | | |||
| Blocked Hours | 9 AM (market open), 10 PM onwards | | |||
--- | |||
## Entry Rules | |||
### 1. MA Zone Requirement | |||
- Price must be within **±25 points** of MA21 | |||
- This defines the "discount zone" for longs and "premium zone" for shorts | |||
### 2. Direction Alignment (Hard Filter) | |||
Trade direction MUST align with MA21 slope: | |||
| MA21 Slope | Allowed Direction | | |||
|------------|-------------------| | |||
| Rising (↗) | LONG only | | |||
| Declining (↘) | SHORT only | | |||
| Flat (→) | Use Multi-Timeframe (MTF) direction | | |||
### 3. Setup Quality Grading | |||
Every potential trade is scored on 5 factors: | |||
| Factor | Weight | | |||
|--------|--------| | |||
| Timeframe Alignment | 30% | | |||
| Trend Strength | 20% | | |||
| Key Level Proximity | 20% | | |||
| Entry Technique | 15% | | |||
| Risk:Reward | 15% | | |||
**Grade Thresholds:** | |||
| Grade | Min Score | Action | | |||
|-------|-----------|--------| | |||
| A+ | 90+ | Trade with full size | | |||
| A | 80-89 | Trade with full size | | |||
| B | 70-79 | Trade with full size | | |||
| C | 60-69 | NO TRADE | | |||
| D | 50-59 | NO TRADE | | |||
| F | <50 | NO TRADE | | |||
### 4. Probability Zone Filter | |||
Based on price position within recent range: | |||
- **Top Third**: 80% probability of continuation (favor shorts after rally) | |||
- **Bottom Third**: 85% probability of reversal (favor longs after pullback) | |||
- **Sideways Market**: Mean reversion logic applies | |||
### 5. Special Pattern: Crash SHORT | |||
In sideways markets at top of range: | |||
- If big RED bar breaks below MA21 zone | |||
- Override any LONG signal to SHORT | |||
- Enter the breakdown | |||
--- | |||
## Exit Rules | |||
### Stop Loss: 40 Points | |||
| Method | Logic | | |||
|--------|-------| | |||
| Default | 40 points from entry | | |||
| Structure-based | Below recent swing low (LONG) / Above recent swing high (SHORT) | | |||
| MA Bounce | MA21 value ± 25 points buffer | | |||
| Minimum | Always at least 40 points | | |||
### Take Profit: 60 Points (1.5:1 R:R) | |||
| Calculation | Value | | |||
|-------------|-------| | |||
| Target Distance | Risk × 1.5 = 40 × 1.5 = **60 points** | | |||
| Alternative | 50% of distance to MA (if > 60 pts) | | |||
| Risk:Reward | 1.5:1 (gain Rs 150 for every Rs 100 risked) | | |||
### Timeout: 8 Hours Maximum | |||
- If trade doesn't hit stop or target within 8 hours | |||
- Exit at current market price | |||
- Prevents overnight holding | |||
--- | |||
## Risk Management | |||
| Parameter | Value | | |||
|-----------|-------| | |||
| Position Size | 1 lot (100 barrels) | | |||
| Risk per Trade | 40 points × 100 = Rs 4,000 | | |||
| Reward per Trade | 60 points × 100 = Rs 6,000 | | |||
| Max Concurrent Trades | 1 | | |||
--- | |||
## Cost Structure | |||
| Cost Type | Value | | |||
|-----------|-------| | |||
| Brokerage | Rs 20 per lot per leg (Dhan) | | |||
| CTT (Commodity Transaction Tax) | 0.01% on sell side | | |||
| Total Round-trip | ~Rs 40 brokerage + CTT | | |||
--- | |||
## Trade Flow Summary | |||
``` | |||
┌─────────────────────────────────────────────────────────────┐ | |||
│ ENTRY DECISION │ | |||
├─────────────────────────────────────────────────────────────┤ | |||
│ 1. Is price within ±25 pts of MA21? → NO = SKIP │ | |||
│ 2. Does direction align with MA21 slope? → NO = SKIP │ | |||
│ 3. Is setup grade A+, A, or B? → NO = SKIP │ | |||
│ 4. Is current hour allowed (not 9, 22, 23)? → NO = SKIP │ | |||
│ 5. Does probability zone allow this trade? → NO = SKIP │ | |||
│ │ | |||
│ ALL YES → ENTER TRADE │ | |||
└─────────────────────────────────────────────────────────────┘ | |||
┌─────────────────────────────────────────────────────────────┐ | |||
│ EXIT DECISION │ | |||
├─────────────────────────────────────────────────────────────┤ | |||
│ • Price hits STOP LOSS (40 pts) → EXIT (loss/profit*) │ | |||
│ • Price hits TARGET (60 pts) → EXIT (profit) │ | |||
│ • Time exceeds 8 HOURS → EXIT (at market) │ | |||
│ │ | |||
│ *Stop can be profitable if trailing stop moved in profit │ | |||
└─────────────────────────────────────────────────────────────┘ | |||
``` | |||
--- | |||
## Equity Curve | |||
 | |||
--- | |||
## Backtest Results (19 Months) | |||
| Metric | Value | | |||
|--------|-------| | |||
| Initial Capital | Rs 1.00 Lakhs | | |||
| Final Value | Rs 26.48 Lakhs | | |||
| Total Profit | Rs 25.48 Lakhs | | |||
| Total Return | 2,548% | | |||
| Peak Value | Rs 28.35 Lakhs | | |||
| Max Drawdown | -78.6% | | |||
| Total Trades | 7,534 | | |||
| Win Rate | 57.6% | | |||
| Profit Factor | 1.20 | | |||
| Average Win | Rs 3,464 | | |||
| Average Loss | Rs 3,904 | | |||
| Largest Win | Rs 26,799 | | |||
| Largest Loss | Rs 13,217 | | |||
| Avg Holding Time | 2.4 hours | | |||
### Exit Reason Breakdown | |||
| Exit Type | Count | % | Note | | |||
|-----------|-------|---|------| | |||
| Stop | 5,444 | 72.3% | Includes trailing stop profits | | |||
| Target | 1,716 | 22.8% | 100% winners | | |||
| Timeout | 374 | 5.0% | 8-hour limit | | |||
### Direction Distribution | |||
| Direction | Count | % | | |||
|-----------|-------|---| | |||
| SHORT | 6,024 | 80% | | |||
| LONG | 1,510 | 20% | | |||
### Setup Quality Distribution | |||
| Grade | Count | | |||
|-------|-------| | |||
| A+ | 3,457 | | |||
| A | 551 | | |||
| C | 3,526 | | |||
--- | |||
## Key Strategy Principles | |||
1. **Trade WITH the trend** - MA21 slope determines direction | |||
2. **Enter at value** - Only when price is near MA21 zone | |||
3. **Quality over quantity** - Only A+, A, B setups are traded | |||
4. **Fixed risk management** - 40 pt stop, 60 pt target | |||
5. **Time discipline** - Maximum 8 hour holding period | |||
6. **No overnight risk** - All positions closed intraday | |||
--- | |||
## Source Code Reference | |||
All rules implemented in: | |||
- `signal_generation_trade_management.py` - Entry/Exit logic | |||
- `setup_quality_detection.py` - Trade grading system | |||
- `trade_execution_engine.py` - Stop/Target/Timeout execution | |||
- `probability_zone_analysis.py` - Zone-based filtering | |||
--- | |||
*Document generated from code analysis - January 2026* | |||
Revision as of 10:51, 5 January 2026
- MA21 Mean Reversion Strategy
- MCX Crude Oil - Intraday Trading System
---
- Core Concept
- Trade pullbacks to the 21-period Moving Average (MA21).**
The MA21 acts as a dynamic support/resistance zone. When price pulls back to this zone during a trending market, we enter in the direction of the trend expecting price to continue.
> *"The MA is a ZONE, not a thin line"* - Entry allowed within ±25 points of MA21
---
- Instrument & Timeframe
| Parameter | Value | |-----------|-------| | Instrument | MCX Crude Oil Futures | | Chart Timeframe | 5-minute | | Entry Precision | 1-minute (for exact timing) | | Trading Hours | 9:00 AM - 11:30 PM IST | | Blocked Hours | 9 AM (market open), 10 PM onwards |
---
- Entry Rules
- 1. MA Zone Requirement
- Price must be within **±25 points** of MA21 - This defines the "discount zone" for longs and "premium zone" for shorts
- 2. Direction Alignment (Hard Filter)
Trade direction MUST align with MA21 slope:
| MA21 Slope | Allowed Direction | |------------|-------------------| | Rising (↗) | LONG only | | Declining (↘) | SHORT only | | Flat (→) | Use Multi-Timeframe (MTF) direction |
- 3. Setup Quality Grading
Every potential trade is scored on 5 factors:
| Factor | Weight | |--------|--------| | Timeframe Alignment | 30% | | Trend Strength | 20% | | Key Level Proximity | 20% | | Entry Technique | 15% | | Risk:Reward | 15% |
- Grade Thresholds:**
| Grade | Min Score | Action | |-------|-----------|--------| | A+ | 90+ | Trade with full size | | A | 80-89 | Trade with full size | | B | 70-79 | Trade with full size | | C | 60-69 | NO TRADE | | D | 50-59 | NO TRADE | | F | <50 | NO TRADE |
- 4. Probability Zone Filter
Based on price position within recent range: - **Top Third**: 80% probability of continuation (favor shorts after rally) - **Bottom Third**: 85% probability of reversal (favor longs after pullback) - **Sideways Market**: Mean reversion logic applies
- 5. Special Pattern: Crash SHORT
In sideways markets at top of range: - If big RED bar breaks below MA21 zone - Override any LONG signal to SHORT - Enter the breakdown
---
- Exit Rules
- Stop Loss: 40 Points
| Method | Logic | |--------|-------| | Default | 40 points from entry | | Structure-based | Below recent swing low (LONG) / Above recent swing high (SHORT) | | MA Bounce | MA21 value ± 25 points buffer | | Minimum | Always at least 40 points |
- Take Profit: 60 Points (1.5:1 R:R)
| Calculation | Value | |-------------|-------| | Target Distance | Risk × 1.5 = 40 × 1.5 = **60 points** | | Alternative | 50% of distance to MA (if > 60 pts) | | Risk:Reward | 1.5:1 (gain Rs 150 for every Rs 100 risked) |
- Timeout: 8 Hours Maximum
- If trade doesn't hit stop or target within 8 hours - Exit at current market price - Prevents overnight holding
---
- Risk Management
| Parameter | Value | |-----------|-------| | Position Size | 1 lot (100 barrels) | | Risk per Trade | 40 points × 100 = Rs 4,000 | | Reward per Trade | 60 points × 100 = Rs 6,000 | | Max Concurrent Trades | 1 |
---
- Cost Structure
| Cost Type | Value | |-----------|-------| | Brokerage | Rs 20 per lot per leg (Dhan) | | CTT (Commodity Transaction Tax) | 0.01% on sell side | | Total Round-trip | ~Rs 40 brokerage + CTT |
---
- Trade Flow Summary
``` ┌─────────────────────────────────────────────────────────────┐ │ ENTRY DECISION │ ├─────────────────────────────────────────────────────────────┤ │ 1. Is price within ±25 pts of MA21? → NO = SKIP │ │ 2. Does direction align with MA21 slope? → NO = SKIP │ │ 3. Is setup grade A+, A, or B? → NO = SKIP │ │ 4. Is current hour allowed (not 9, 22, 23)? → NO = SKIP │ │ 5. Does probability zone allow this trade? → NO = SKIP │ │ │ │ ALL YES → ENTER TRADE │ └─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐ │ EXIT DECISION │ ├─────────────────────────────────────────────────────────────┤ │ • Price hits STOP LOSS (40 pts) → EXIT (loss/profit*) │ │ • Price hits TARGET (60 pts) → EXIT (profit) │ │ • Time exceeds 8 HOURS → EXIT (at market) │ │ │ │ *Stop can be profitable if trailing stop moved in profit │ └─────────────────────────────────────────────────────────────┘ ```
---
- Equity Curve

---
- Backtest Results (19 Months)
| Metric | Value | |--------|-------| | Initial Capital | Rs 1.00 Lakhs | | Final Value | Rs 26.48 Lakhs | | Total Profit | Rs 25.48 Lakhs | | Total Return | 2,548% | | Peak Value | Rs 28.35 Lakhs | | Max Drawdown | -78.6% | | Total Trades | 7,534 | | Win Rate | 57.6% | | Profit Factor | 1.20 | | Average Win | Rs 3,464 | | Average Loss | Rs 3,904 | | Largest Win | Rs 26,799 | | Largest Loss | Rs 13,217 | | Avg Holding Time | 2.4 hours |
- Exit Reason Breakdown
| Exit Type | Count | % | Note | |-----------|-------|---|------| | Stop | 5,444 | 72.3% | Includes trailing stop profits | | Target | 1,716 | 22.8% | 100% winners | | Timeout | 374 | 5.0% | 8-hour limit |
- Direction Distribution
| Direction | Count | % | |-----------|-------|---| | SHORT | 6,024 | 80% | | LONG | 1,510 | 20% |
- Setup Quality Distribution
| Grade | Count | |-------|-------| | A+ | 3,457 | | A | 551 | | C | 3,526 |
---
- Key Strategy Principles
1. **Trade WITH the trend** - MA21 slope determines direction 2. **Enter at value** - Only when price is near MA21 zone 3. **Quality over quantity** - Only A+, A, B setups are traded 4. **Fixed risk management** - 40 pt stop, 60 pt target 5. **Time discipline** - Maximum 8 hour holding period 6. **No overnight risk** - All positions closed intraday
---
- Source Code Reference
All rules implemented in: - `signal_generation_trade_management.py` - Entry/Exit logic - `setup_quality_detection.py` - Trade grading system - `trade_execution_engine.py` - Stop/Target/Timeout execution - `probability_zone_analysis.py` - Zone-based filtering
---
- Document generated from code analysis - January 2026*