turtle_quant_1.strategies.mean_reversion.rsi_sup_res_divergence¶
turtle_quant_1.strategies.mean_reversion.rsi_sup_res_divergence
¶
RSI Support Resistance Divergence strategy implementation.
RsiSupResDivergence
¶
Bases: BaseStrategy
Initialize the RSI strategy.
Leading / Lagging: Lagging in construction. Leading in interpretation.
Lag period (in candles): (lookback_candles - 1) / 2
Effect: Delay in recognizing that price has deviated far enough from equilibrium.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lookback_candles
|
int
|
The number of periods to use for the RSI. |
60
|
local_extrema_window
|
int
|
The size of the window for the local maxima and minima. |
5
|
Source code in src/turtle_quant_1/strategies/mean_reversion/rsi_sup_res_divergence.py
generate_historical_scores
¶
Generate the historical scores.
NOTE: Assume that the data is sorted by datetime.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
The data to generate the scores from. |
required |
symbol
|
str
|
The symbol to generate the scores for. |
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/mean_reversion/rsi_sup_res_divergence.py
generate_prediction_score
¶
Generate the prediction score.
NOTE: Assume that the data is sorted by datetime.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
The data to generate the score from. |
required |
symbol
|
str
|
The symbol to generate the score for. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The prediction score. |