Period Extreme
PeriodExtreme
Bases: IndicatorBase
N-Period Extreme indicator.
Computes the minimum or maximum value of a source indicator over a rolling window of \(n\) periods. The source indicator is instantiated internally and updated on each bar.
Until the window is fully populated, the indicator yields numpy.nan.
name
property
Canonical indicator name.
Returns:
| Type | Description |
|---|---|
str
|
Identifier combining source name, period, and extreme type. |
Source code in src/onesecondtrader/indicators/period_extreme.py
__init__(source, period=20, extreme_type=models.ExtremeType.MAX, max_history=100, plot_at=0, plot_as=models.PlotStyle.LINE, plot_color=models.PlotColor.BLACK, **source_kwargs)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
type[IndicatorBase]
|
Source indicator class to instantiate. |
required |
period
|
int
|
Lookback window size. |
20
|
extreme_type
|
ExtremeType
|
Whether to compute the minimum or maximum. |
MAX
|
max_history
|
int
|
Maximum number of computed indicator values retained per symbol. |
100
|
plot_at
|
int
|
Opaque plotting identifier forwarded to the charting backend. |
0
|
plot_as
|
PlotStyle
|
Visual style used to render the indicator. |
LINE
|
plot_color
|
PlotColor
|
Color used to render the indicator. |
BLACK
|
**source_kwargs
|
Any
|
Keyword arguments passed to the source indicator constructor. |
{}
|
Source code in src/onesecondtrader/indicators/period_extreme.py
_compute_indicator(incoming_bar)
Compute the n-period extreme for a single received bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
incoming_bar
|
BarReceived
|
Market bar used as input for the computation. |
required |
Returns:
| Type | Description |
|---|---|
float
|
N-period min or max value, or |