turtle_quant_1.strategies.momentum.relative_strength_index¶
turtle_quant_1.strategies.momentum.relative_strength_index
¶
Relative Strength Index (RSI) strategy implementation.
RelativeStrengthIndex
¶
Bases: BaseStrategy
A strategy that uses the RSI to generate buy and sell signals.
Leading / Lagging: Lagging in construction. Leading in interpretation.
Lag period (in candles): (lookback_candles - 1) / 2
Effect: Delay in recognizing that a new trend has begun.
Initialize the RSI strategy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lookback_candles
|
int
|
The number of periods to use for the RSI. |
14
|
Source code in src/turtle_quant_1/strategies/momentum/relative_strength_index.py
generate_historical_scores
¶
Generate a historical score array for a symbol based on market data.
NOTE: Assume that the data is sorted by datetime.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
DataFrame with OHLCV data. |
required |
symbol
|
str
|
The symbol being analyzed. |
required |
Returns:
| Type | Description |
|---|---|
Series
|
Score array with each value between -1.0 and +1.0, indexed by the original data's index. |
Source code in src/turtle_quant_1/strategies/momentum/relative_strength_index.py
generate_prediction_score
¶
Generate a score for the strategy.
NOTE: Assume that the data is sorted by datetime.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
The data to use for the strategy. |
required |
symbol
|
str
|
The symbol to use for the strategy. |
required |