Skip to content

Commit 1ce893f

Browse files
flexible momentum analyzers explained + min_volume for each coin
1 parent 5c67db4 commit 1ce893f

File tree

9 files changed

+2678
-4
lines changed

9 files changed

+2678
-4
lines changed

β€ŽResearch/README.mdβ€Ž

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# Momentum Flexibility Research Scripts
2+
3+
This directory contains research scripts that reproduce and visualize the intelligent momentum detection system implemented in the trading automation bot.
4+
5+
## πŸ“Š Scripts Overview
6+
7+
### 1. `momentum_visualizer.py` (Graphical Version)
8+
9+
- **Requirements:** matplotlib, seaborn, numpy, pandas
10+
- **Features:** Interactive charts and graphs
11+
- **Output:** Visual plots showing momentum analysis
12+
- **Install dependencies:** `pip install -r requirements_viz.txt`
13+
14+
### 2. `momentum_analyzer.py` (Console Version) βœ…
15+
16+
- **Requirements:** Built-in Python libraries only
17+
- **Features:** Comprehensive console-based analysis
18+
- **Output:** Detailed text reports and statistics
19+
- **Ready to run:** No additional dependencies needed
20+
21+
## πŸš€ Quick Start
22+
23+
Run the console analyzer (recommended):
24+
25+
```bash
26+
python momentum_analyzer.py
27+
```
28+
29+
Or install dependencies and run the graphical version:
30+
31+
```bash
32+
pip install -r requirements_viz.txt
33+
python momentum_visualizer.py
34+
```
35+
36+
## 🎯 What These Scripts Demonstrate
37+
38+
### Dynamic Momentum System Features
39+
40+
1. **ATR-Based Threshold Adaptation**
41+
- Automatically adjusts based on market volatility
42+
- Higher ATR β†’ Higher thresholds (fewer false signals)
43+
- Lower ATR β†’ Lower thresholds (catches small moves)
44+
45+
2. **Multi-Timeframe Confirmation**
46+
- Analyzes 1m, 5m, and 15m timeframes
47+
- Different sensitivity for each timeframe
48+
- Prevents single-timeframe noise
49+
50+
3. **Multi-Indicator Fusion**
51+
- Price momentum (primary signal)
52+
- RSI momentum (overbought detection)
53+
- Volume spikes (unusual activity)
54+
- Moving average crossovers (trend changes)
55+
56+
4. **Safety Bounds**
57+
- Floor values prevent overly low thresholds
58+
- Cap values prevent overly high thresholds
59+
- Ensures functionality across all market conditions
60+
61+
5. **Symbol-Specific Calibration**
62+
- Different volume thresholds for BTC, ETH, altcoins
63+
- Adapts to natural volatility patterns
64+
- Recognizes trading characteristics of different pairs
65+
66+
## πŸ“ˆ Sample Output Analysis
67+
68+
The console analyzer shows:
69+
70+
```text
71+
🎯 HAS MOMENTUM: 🟒 YES/πŸ”΄ NO
72+
πŸ’Ή Price Momentum: βœ…/❌
73+
πŸ“ˆ RSI Momentum: βœ…/❌
74+
πŸ“Š Volume Spike: βœ…/❌
75+
πŸ”„ MA Cross: βœ…/❌
76+
```
77+
78+
### Threshold Adaptation Example
79+
80+
```text
81+
ATR Scenario 1m Threshold 5m Threshold 15m Threshold
82+
Low Volatility 0.110% 0.140% 0.170%
83+
Normal Volatility 0.440% 0.560% 0.680%
84+
High Volatility 0.825% 1.050% 1.275%
85+
Extreme Volatility 1.500% 1.800% 2.000%
86+
```
87+
88+
## πŸ”§ Configuration Parameters
89+
90+
The system uses these key parameters:
91+
92+
```python
93+
# ATR multipliers (sensitivity)
94+
k_1m: 0.55 # More sensitive for 1m
95+
k_5m: 0.70 # Medium sensitivity for 5m
96+
k_15m: 0.85 # Less sensitive for 15m
97+
98+
# Safety bounds
99+
floor_1m: 0.07% # Minimum threshold
100+
cap_1m: 1.5% # Maximum threshold
101+
102+
# Indicator thresholds
103+
rsi_overbought: 70
104+
volume_spike_multiplier: 2.0
105+
```
106+
107+
## πŸ’‘ Key Insights
108+
109+
1. **Adaptive Intelligence**: The system learns from recent market behavior and automatically adjusts sensitivity.
110+
111+
2. **Noise Filtering**: Multi-timeframe and multi-indicator confirmation significantly reduces false signals.
112+
113+
3. **Market Condition Awareness**: Different volatility environments get appropriate threshold calibration.
114+
115+
4. **No Manual Tuning**: Parameters self-adjust based on real-time market data.
116+
117+
5. **Cross-Asset Compatibility**: Works effectively across different cryptocurrency pairs.
118+
119+
## πŸ—οΈ Technical Implementation
120+
121+
The scripts reproduce the exact logic from `../Trading-Automation/trading_automation.py`:
122+
123+
- `calculate_atr_percent()` - ATR calculation as percentage of price
124+
- `dynamic_momentum_threshold()` - ATR-based threshold calculation
125+
- `check_advanced_momentum()` - Multi-indicator momentum detection
126+
- `has_recent_momentum()` - Multi-timeframe confirmation logic
127+
128+
## πŸ“‹ Use Cases
129+
130+
1. **System Understanding**: Visualize how the momentum detection works
131+
2. **Parameter Tuning**: Test different configuration values
132+
3. **Market Analysis**: Understand momentum patterns across timeframes
133+
4. **Strategy Validation**: Verify momentum logic before live trading
134+
5. **Educational**: Learn about adaptive trading algorithms
135+
136+
## 🎨 Customization
137+
138+
Both scripts can be easily modified to:
139+
140+
- Test different symbols (BTC, ETH, altcoins)
141+
- Adjust timeframe parameters
142+
- Modify indicator thresholds
143+
- Add new momentum indicators
144+
- Change analysis periods
145+
146+
## πŸ“ File Structure
147+
148+
```text
149+
Research/
150+
β”œβ”€β”€ momentum_analyzer.py # Console-based analyzer (no dependencies)
151+
β”œβ”€β”€ momentum_visualizer.py # Graphical analyzer (requires matplotlib)
152+
β”œβ”€β”€ requirements_viz.txt # Dependencies for graphical version
153+
└── README.md # This file
154+
```
155+
156+
## πŸ”— Related Files
157+
158+
- **Main Trading Bot**: `../Trading-Automation/trading_automation.py`
159+
- **Symbol Data**: `../Trading-Automation/symbols.yaml`
160+
- **Bot Configuration**: `../Trading-Automation/secrets.py`
161+
162+
Run the scripts to see the momentum flexibility in action! πŸš€
163+
164+
## πŸ§ͺ Research Notes
165+
166+
This research demonstrates how the trading bot's momentum detection system:
167+
168+
- **Adapts dynamically** to market conditions without manual intervention
169+
- **Balances sensitivity vs noise** through multi-indicator confirmation
170+
- **Scales effectively** across different asset classes and volatility regimes
171+
- **Maintains robustness** through safety bounds and validation logic
172+
173+
The implementation showcases advanced algorithmic trading concepts including adaptive thresholds, multi-timeframe analysis, and intelligent signal filtering.

0 commit comments

Comments
Β (0)