Ensemble Strategies¶
Combine multiple strategies with voting and meta-learning.
Basic Ensemble¶
ensemble = SQA::Ensemble.new(
strategies: [
SQA::Strategy::RSI,
SQA::Strategy::MACD,
SQA::Strategy::BollingerBands
],
voting_method: :majority
)
signal = ensemble.signal(vector) # => :buy, :sell, or :hold
Voting Methods¶
Majority Voting¶
Weighted Voting¶
Unanimous¶
Confidence-Based¶
Dynamic Weighting¶
# Update weights based on performance
ensemble.update_weight(SQA::Strategy::RSI, 1.5) # Increase weight
ensemble.update_weight(SQA::Strategy::MACD, 0.5) # Decrease weight
Strategy Rotation¶
# Select best strategy for current market
selected = ensemble.rotate(stock)
# Automatically switches based on recent performance