Bollinger Upper
BollingerUpper
Bases: IndicatorBase
Bollinger Upper Band indicator.
Computes the upper Bollinger Band as: SMA + (\(k\) * standard deviation) where \(k\) is the number of standard deviations (default 2).
The rolling window is maintained independently for each symbol.
Until the window is fully populated, the indicator yields numpy.nan.
name
property
Canonical indicator name.
Returns:
| Type | Description |
|---|---|
str
|
Identifier encoding the indicator type, period, number of standard deviations, and bar field. |
Source code in src/onesecondtrader/indicators/bollinger/bollinger_upper.py
__init__(period=20, num_std=2.0, max_history=100, bar_field=models.BarField.CLOSE, plot_at=0, plot_as=models.PlotStyle.LINE)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
period
|
int
|
Window size used to compute the moving average and standard deviation. |
20
|
num_std
|
float
|
Number of standard deviations for the band offset. |
2.0
|
max_history
|
int
|
Maximum number of computed indicator values retained per symbol. |
100
|
bar_field
|
BarField
|
Bar field used as the input series. |
CLOSE
|
plot_at
|
int
|
Opaque plotting identifier forwarded to the charting backend. |
0
|
plot_as
|
PlotStyle
|
Visual style used to render the indicator. |
LINE
|
Source code in src/onesecondtrader/indicators/bollinger/bollinger_upper.py
_compute_indicator(incoming_bar)
Compute the upper Bollinger Band 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
|
Upper Bollinger Band value, or |
Source code in src/onesecondtrader/indicators/bollinger/bollinger_upper.py
_extract_field(incoming_bar)
Extract the configured bar field from an incoming bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
incoming_bar
|
BarReceived
|
Market bar providing the input data. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Extracted field value, or |