📦 SQA::StrategyGenerator¶
🔨 Instance Methods¶
#stock()¶
Returns the value of attribute stock.
Source Location
#profitable_points()¶
Returns the value of attribute profitable_points.
Source Location
#patterns()¶
Returns the value of attribute patterns.
Source Location
#min_gain_percent()¶
Returns the value of attribute min_gain_percent.
Source Location
#fpop()¶
Returns the value of attribute fpop.
Source Location
#min_loss_percent()¶
Returns the value of attribute min_loss_percent.
Source Location
#indicators_config()¶
Returns the value of attribute indicators_config.
Source Location
#inflection_window()¶
Returns the value of attribute inflection_window.
Source Location
#max_fpl_risk()¶
Returns the value of attribute max_fpl_risk.
Source Location
#required_fpl_directions()¶
Returns the value of attribute required_fpl_directions.
Source Location
#initialize(stock:, min_gain_percent: = 10.0, min_loss_percent: = nil, fpop: = 10, inflection_window: = 3, max_fpl_risk: = nil, required_fpl_directions: = nil)¶
Returns
Type: StrategyGenerator
a new instance of StrategyGenerator
Source Location
#discover_patterns(min_pattern_frequency: = 2)¶
Main entry point: Discover patterns in historical data
Source Location
#generate_strategy(pattern_index: = 0, strategy_type: = :proc)¶
Generate a trading strategy from discovered patterns
Source Location
#generate_strategies(top_n: = 5, strategy_type: = :class)¶
Generate multiple strategies from top N patterns
Source Location
#print_patterns(max_patterns: = 10)¶
Print discovered patterns
Source Location
#export_patterns(filename)¶
Export patterns to CSV
Source Location
#walk_forward_validate(train_size: = 250, test_size: = 60, step_size: = 30)¶
Walk-forward validation - discover patterns with time-series cross-validation
Splits data into train/test windows and rolls forward through history to prevent overfitting. Only keeps patterns that work out-of-sample.
Parameters
| Name | Type | Description |
|---|---|---|
train_size |
Integer |
Training window size in days |
test_size |
Integer |
Testing window size in days |
step_size |
Integer |
How many days to step forward each iteration |
Returns
Type: Hash
Validation results with patterns and performance
Source Location
#discover_context_aware_patterns(analyze_regime: = true, analyze_seasonal: = true, sector: = nil)¶
Discover patterns with context (regime, seasonal, sector)
Parameters
| Name | Type | Description |
|---|---|---|
analyze_regime |
Boolean |
Detect and filter by market regime |
analyze_seasonal |
Boolean |
Detect seasonal patterns |
sector |
Symbol |
Sector classification |
Returns
Type: Array<Pattern>
Patterns with context metadata
Source Location
📝 Attributes¶
👁️ stock read-only¶
Returns the value of attribute stock.
👁️ profitable_points read-only¶
Returns the value of attribute profitable_points.
👁️ patterns read-only¶
Returns the value of attribute patterns.
👁️ min_gain_percent read-only¶
Returns the value of attribute min_gain_percent.
👁️ fpop read-only¶
Returns the value of attribute fpop.
👁️ min_loss_percent read-only¶
Returns the value of attribute min_loss_percent.
👁️ indicators_config read-only¶
Returns the value of attribute indicators_config.
👁️ inflection_window read-only¶
Returns the value of attribute inflection_window.
👁️ max_fpl_risk read-only¶
Returns the value of attribute max_fpl_risk.
👁️ required_fpl_directions read-only¶
Returns the value of attribute required_fpl_directions.