📦 SQA::MultiTimeframe¶
Description
MultiTimeframe - Analyze patterns across multiple timeframes
Provides methods for: - Timeframe conversion (daily → weekly → monthly) - Multi-timeframe signal confirmation - Trend alignment across timeframes - Support/resistance across timeframes
Common timeframe strategy: - Use higher timeframe for trend direction - Use lower timeframe for entry timing
🔨 Instance Methods¶
#stock()¶
Returns the value of attribute stock.
Source Location
#timeframes()¶
Returns the value of attribute timeframes.
Source Location
#initialize(stock:)¶
Initialize multi-timeframe analyzer
Parameters
| Name | Type | Description |
|---|---|---|
stock |
SQA::Stock |
Stock object with daily data |
Returns
Type: MultiTimeframe
a new instance of MultiTimeframe
Source Location
#convert_timeframes()¶
Convert daily data to weekly and monthly
Source Location
#trend_alignment(lookback: = 20)¶
Check trend alignment across timeframes
Parameters
| Name | Type | Description |
|---|---|---|
lookback |
Integer |
Periods to look back for trend |
Returns
Type: Hash
Trend direction for each timeframe
Source Location
#signal(strategy_class:, higher_timeframe: = :weekly, lower_timeframe: = :daily)¶
Generate multi-timeframe signal
Uses higher timeframe for trend, lower for timing.
Parameters
| Name | Type | Description |
|---|---|---|
strategy_class |
Class |
Strategy to apply |
higher_timeframe |
Symbol |
Timeframe for trend (:weekly, :monthly) |
lower_timeframe |
Symbol |
Timeframe for entry (:daily, :weekly) |
Returns
Type: Symbol
:buy, :sell, or :hold
Source Location
#support_resistance(tolerance: = 0.02)¶
Find support/resistance levels across timeframes
Levels that appear on multiple timeframes are stronger.
Parameters
| Name | Type | Description |
|---|---|---|
tolerance |
Float |
Price tolerance for matching levels (default: 0.02 for 2%) |
Returns
Type: Hash
Support and resistance levels
Source Location
#indicators(indicator:, **options)¶
Calculate indicators for each timeframe
Parameters
| Name | Type | Description |
|---|---|---|
indicator |
Symbol |
Indicator to calculate |
options |
Hash |
Indicator options |
Returns
Type: Hash
Indicator values for each timeframe
Source Location
#detect_divergence()¶
Detect divergence across timeframes
Divergence occurs when price and indicator move in opposite directions.
Returns
Type: Hash
Divergence information
Source Location
#confirmation(strategy_class:)¶
Check if timeframes confirm each other
Parameters
| Name | Type | Description |
|---|---|---|
strategy_class |
Class |
Strategy to use |
Returns
Type: Hash
Confirmation status
Source Location
📝 Attributes¶
👁️ stock read-only¶
Returns the value of attribute stock.
👁️ timeframes read-only¶
Returns the value of attribute timeframes.