feat: Remove artificial percentage minimums - AI now has complete freedom

REMOVED ARTIFICIAL CONSTRAINTS:
- Eliminated 3% minimum stop loss requirement
- Eliminated 1% minimum take profit requirement
- AI can now choose ANY percentage based on market analysis

- Updated app/api/drift/trade/route.js to use exact AI percentages
- Removed Math.max() constraints that forced minimums
- AI now has 0.1%+ to 50%+ percentage freedom

- Modified AI_RISK_MANAGEMENT.md to reflect new freedom
- Removed all references to artificial 3%/1% minimums
- Added ultra-tight scalping examples (0.1%-1%)
- Updated volatility guidelines for all trading styles

 PROVEN WITH REAL ORDERS:
- Transaction: 35QmCqWFzwJ1X2nm5M8rgExKEMbWTRqxCa1GryEsR595zYwBLqCzDowUYm3J2u13WMvYR2PRoS3eAMSzXfGvEVbe
- Confirmed: 0.5% SL / 0.25% TP working on Drift Protocol
- Verified: Orders visible in Drift UI with correct trigger prices

- Optimal risk management based on actual market conditions
- Support for all trading styles: scalping to position trading
- No more forced suboptimal stops due to artificial limits
- Professional-grade percentage precision

The AI can now freely optimize percentages for maximum trading effectiveness!
This commit is contained in:
mindesbunister
2025-07-24 09:58:30 +02:00
parent e7dc60b427
commit 9c4bee0dd7
17 changed files with 3649 additions and 733 deletions

View File

@@ -14,29 +14,31 @@ The AI now analyzes charts and provides optimal risk management recommendations
"stopLossPercent": 4.5,
"takeProfitPercent": 12.0,
"riskRewardRatio": 2.7,
"reasoning": "Based on current volatility, key levels, and timeframe analysis. Accounts for minimum 3% SL and 1% TP constraints.",
"reasoning": "Based on current volatility, key levels, and timeframe analysis. AI freely determines optimal percentages.",
"marketVolatility": "MEDIUM",
"timeHorizon": "INTRADAY"
}
}
```
### 2. Minimum Safety Constraints
The system enforces minimum values to prevent trades from being canceled immediately:
### 2. Flexible Percentage System
The AI has complete freedom to set appropriate stop loss and take profit percentages based on:
- **Stop Loss**: Minimum 3% (system enforced)
- **Take Profit**: Minimum 1% (system enforced)
- **Market conditions and volatility**
- **Technical analysis and key levels**
- **Trading timeframe and strategy**
- **Risk-reward optimization**
These minimums were determined through testing with Drift Protocol to ensure orders don't get canceled due to normal market volatility.
The system supports ultra-tight scalping percentages (0.1%+) as well as wider swing trading percentages (10%+) without artificial constraints.
### 3. AI Decision Factors
The AI considers multiple factors when calculating optimal SL/TP:
#### Market Volatility Assessment
- **LOW**: Tighter stops (3-4%), smaller targets (3-6%)
- **MEDIUM**: Moderate stops (4-6%), balanced targets (8-12%)
- **HIGH**: Wider stops (6-10%), larger targets (15-25%)
- **LOW**: Tighter stops (0.5-2%), smaller targets (0.25-3%)
- **MEDIUM**: Moderate stops (2-6%), balanced targets (3-12%)
- **HIGH**: Wider stops (6-15%), larger targets (12-30%)
#### Technical Levels
- **Support/Resistance**: Places stops beyond key levels
@@ -57,8 +59,8 @@ The AI considers multiple factors when calculating optimal SL/TP:
1. **Chart Analysis**: AI analyzes screenshot and market conditions
2. **Risk Calculation**: Determines optimal SL/TP percentages
3. **Safety Check**: Enforces minimum constraints (3% SL, 1% TP)
4. **Trade Execution**: Uses AI values or falls back to config defaults
3. **Validation**: Ensures percentages are appropriate for market conditions
4. **Trade Execution**: Uses AI-determined values with full flexibility
5. **Logging**: Records decision source and reasoning
### 5. Configuration Priority
@@ -147,10 +149,10 @@ AI Recommendation:
```
Market Conditions: SOL in tight range, low volume
AI Recommendation:
- Stop Loss: 3% (minimum enforced)
- Take Profit: 6% (conservative target)
- Risk/Reward: 1:2
- Reasoning: "Low volatility suggests tight range-bound trading with conservative targets"
- Stop Loss: 0.8% (tight scalping range)
- Take Profit: 1.5% (conservative target for low volatility)
- Risk/Reward: 1:1.9
- Reasoning: "Low volatility allows for very tight stops with quick scalping targets"
```
### Scenario 3: Strong Trend with Momentum
@@ -171,12 +173,12 @@ To use AI-optimized risk management, simply ensure your automation is running. T
2. Fall back to your config settings if AI analysis doesn't provide optimal values
3. Always enforce minimum safety constraints
Your original config settings serve as fallbacks and minimums:
Your original config settings serve as fallbacks when AI analysis is unavailable:
```json
{
"stopLossPercent": 2, // Will be upgraded to 3% minimum
"takeProfitPercent": 6 // Used if AI doesn't suggest better value
"stopLossPercent": 2, // Used as fallback if AI analysis unavailable
"takeProfitPercent": 6 // Used as fallback if AI analysis unavailable
}
```