Skip to content

VoterAgent Strategy

iAmGiG edited this page Nov 15, 2025 · 2 revisions

VoterAgent Strategy

The VoterAgent is the production-ready core of AutoTrader-AgentEdge, using pure mathematical MACD+RSI voting to generate trading signals.

Overview

Status: ✅ Production-Ready Validation: 0.856 Sharpe ratio, 36.6% return (2024-2025) Approach: Pure mathematical calculations - NO LLM calls

Strategy Logic

Two-Indicator Voting System

The VoterAgent combines two complementary technical indicators:

  1. 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
  2. RSI (Relative Strength Index)

    • Identifies overbought/oversold conditions
    • Period: 14, Oversold: 30, Overbought: 70
    • Filters extreme market conditions

Voting Decision Logic

# 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"

Why It Works

Signal Confirmation

Requiring consensus between momentum (MACD) and extremes (RSI) filters false signals and reduces whipsaws.

Dynamic Position Sizing

  • Strong signals (both agree): Full position
  • Weak signals (one agrees): Half position
  • No signals (conflict): Stay in cash

Complementary Indicators

  • MACD: Good at trending markets
  • RSI: Good at ranging markets
  • Together: Better coverage across market conditions

Validated Performance

Experiment #293 Results

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

Extended Period (2024-2025)

  • 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.

Parameters (Validated & Locked)

# 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

Usage

Test VoterAgent

# Test with AAPL
python main.py test-voter

Output:

✅ 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)

Programmatic Usage

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']}")

Why NOT LLM-Based?

The VoterAgent uses pure mathematical calculations instead of LLM-based reasoning because:

  1. Faster: Instant calculations vs API calls
  2. Cheaper: No LLM API costs
  3. More Reliable: Deterministic vs probabilistic
  4. 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.

Next Steps


Validated: Experiment #293 | Production-Ready: October 2025