-
Notifications
You must be signed in to change notification settings - Fork 2
VoterAgent Strategy
The VoterAgent is the production-ready core of AutoTrader-AgentEdge, using pure mathematical MACD+RSI voting to generate trading signals.
Status: ✅ Production-Ready Validation: 0.856 Sharpe ratio, 36.6% return (2024-2025) Approach: Pure mathematical calculations - NO LLM calls
The VoterAgent combines two complementary technical indicators:
-
MACD (Moving Average Convergence Divergence)
- Captures trend momentum and direction
- Fibonacci-optimized parameters: 13/34/8 (fast/slow/signal)
- Generates BUY/SELL signals based on histogram
-
RSI (Relative Strength Index)
- Identifies overbought/oversold conditions
- Period: 14, Oversold: 30, Overbought: 70
- Filters extreme market conditions
# Strong Consensus (85% confidence)
if MACD == BUY and RSI == BUY:
action = BUY
position_size = 100%
confidence = "strong"
# Weak Signal (65% confidence)
if MACD == BUY and RSI == HOLD:
action = BUY
position_size = 50%
confidence = "weak"
# Conflict or Neutral (0% confidence)
if MACD == BUY and RSI == SELL:
action = HOLD
position_size = 0%
confidence = "none"Requiring consensus between momentum (MACD) and extremes (RSI) filters false signals and reduces whipsaws.
- Strong signals (both agree): Full position
- Weak signals (one agrees): Half position
- No signals (conflict): Stay in cash
- MACD: Good at trending markets
- RSI: Good at ranging markets
- Together: Better coverage across market conditions
| Metric | MACD-Only | Voting (MACD+RSI) | Winner |
|---|---|---|---|
| Sharpe Ratio | 0.841 | 0.856 | Voting |
| Max Drawdown | -10.58% | -10.10% | Voting |
| Win Rate | 31.9% | 51.4% | Voting |
- Total Return: 36.6%
- Sharpe Ratio: 0.771
- Trading Days: 417
- Max Drawdown: -10.10%
Key Finding: Voting performs relatively better in volatile markets, with superior risk management during corrections.
# MACD Configuration (Fibonacci sequence)
MACD_FAST = 13
MACD_SLOW = 34
MACD_SIGNAL = 8
# RSI Configuration
RSI_PERIOD = 14
RSI_OVERSOLD = 30
RSI_OVERBOUGHT = 70
# Voting Thresholds
MACD_HISTOGRAM_THRESHOLD = 0.1
CONSENSUS_CONFIDENCE_BOOST = 0.15
WEAK_SIGNAL_CONFIDENCE_BOOST = 0.10# Test with AAPL
python main.py test-voterOutput:
✅ VoterAgent configured: MACD: (13/34/8), RSI: 14 period, 30/70 levels
✅ Loaded 42 data points
📊 Trading Decision: BUY (Confidence: 65.0%)
Reasoning: Weak signal: Only MACD signals BUY
MACD: BUY (Histogram: 0.111064)
RSI: HOLD (Value: 51.6)
from src.autogen_agents.voter_agent import VoterAgent
import pandas as pd
# Initialize VoterAgent
voter = VoterAgent(
name='production_voter',
macd_params={'fast': 13, 'slow': 34, 'signal': 8},
rsi_params={'period': 14, 'oversold': 30, 'overbought': 70}
)
# Get market data (DataFrame with 'Close' column)
df = fetch_market_data('SPY')
# Evaluate voting decision
result = voter.evaluate_voting('SPY', df, return_components=True)
print(f"Action: {result['action']}")
print(f"Confidence: {result['confidence']:.1%}")
print(f"Reasoning: {result['reasoning']}")The VoterAgent uses pure mathematical calculations instead of LLM-based reasoning because:
- Faster: Instant calculations vs API calls
- Cheaper: No LLM API costs
- More Reliable: Deterministic vs probabilistic
- Proven: 0.856 Sharpe vs ~60% LLM sentiment accuracy
Historical Context: Extensive LLM sentiment analysis testing (V0-V4 framework) showed pure math indicators outperform complex AI-based approaches for this use case.
- Paper Trading: Test the strategy safely
- Risk Management: Understand position sizing and stops
- Using main.py CLI: Command reference
Validated: Experiment #293 | Production-Ready: October 2025