turtle_quant_1.strategies.helpers.support_resistance.stnry_pivot_point¶
turtle_quant_1.strategies.helpers.support_resistance.stnry_pivot_point
¶
Stationary pivot point support and resistance strategy.
StnryPivotPoint
¶
Bases: BaseSupResStrategy
Stationary pivot point support and resistance strategy.
This strategy calculates quarterly pivot points and their associated support (S1, S2) and resistance (R1, R2) levels based on the previous quarter's high, low, and close prices.
Formulas: - PP (Pivot Point) = (High + Low + Close) / 3 - R1 = 2 * PP - Low - R2 = PP + (High - Low) - S1 = 2 * PP - High - S2 = PP - (High - Low)
Initialize the StnryPivotPoint strategy.
Source code in src/turtle_quant_1/strategies/helpers/support_resistance/stnry_pivot_point.py
generate_historical_levels
¶
Generate quarterly pivot point levels for historical data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
DataFrame with OHLCV data containing columns: ['datetime', 'Open', 'High', 'Low', 'Close', 'Volume'] |
required |
symbol
|
str
|
The symbol being analyzed. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with pivot point levels. |
DataFrame
|
The columns are: ['datetime', 'level_values']. |
DataFrame
|
The 'level_values' column contains [PP, S1, S2, R1, R2] for each timestamp. |