File size: 8,517 Bytes
4ca09f3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
---
title: Indicators
sidebar_position: 2
description: A tutorial of the technical indicators included with the openbb-charting library, including how to get started using them.
keywords:
- tutorial
- OpenBB Platform
- getting started
- extensions
- charting
- view
- Plotly
- toolkits
- indicators
- Plotly
- OpenBBFigure
- PyWry
---
import HeadTitle from '@site/src/components/General/HeadTitle.tsx';
<HeadTitle title="Indicators - OpenBB Charting - Extensions | OpenBB Platform Docs" />
## Introduction
Select indicators (technical) can be added to a chart where the data is OHLC+V prices over time, and the data is for one symbol only.
They are meant as quick visualizations, and a way to build more complex charts.
As starting points, they can be refined to perfection by manipulating the figure object directly.
```python
from datetime import datetime, timedelta
from openbb import obb
data = obb.equity.price.historical(
"TSLA",
provider="yfinance",
interval="15m",
start_date=(datetime.now()-timedelta(days=21)).date(),
chart=True,
chart_params=dict(
heikin_ashi=True,
indicators=(dict(
ema=dict(length=[8,32]),
srlines={}, # For indicators, an empty dictionary implies the default state.
rsi=dict(length=32)
))
)
)
data.show()
```

## Available Indicators
To get all the indicators, use the `charting.indicators()` method.
The object returned is a Pydantic model where each indicator is field.
If you don't catch it, it will print as a docstring to the console.
:::danger
Some indicators, like RSI and MACD, create subplots. Only 4 subplots (not including the main candles + volume) can be created within the same view.
:::
```python
data.charting.indicators()
```
```console
SMA:
Parameters
----------
length : Union[int, list[int]]
Window length for the moving average, by default is 50.
The number is relative to the interval of the time series data.
offset : int
Number of periods to offset for the moving average, by default is 0.
EMA:
Parameters
----------
length : Union[int, list[int]]
Window length for the moving average, by default is 50.
The number is relative to the interval of the time series data.
offset : int
Number of periods to offset for the moving average, by default is 0.
HMA:
Parameters
----------
length : Union[int, list[int]]
Window length for the moving average, by default is 50.
The number is relative to the interval of the time series data.
offset : int
Number of periods to offset for the moving average, by default is 0.
WMA:
Parameters
----------
length : Union[int, list[int]]
Window length for the moving average, by default is 50.
The number is relative to the interval of the time series data.
offset : int
Number of periods to offset for the moving average, by default is 0.
ZLMA:
Parameters
----------
length : Union[int, list[int]]
Window length for the moving average, by default is 50.
The number is relative to the interval of the time series data.
offset : int
Number of periods to offset for the moving average, by default is 0.
AD:
Parameters
----------
offset : int
Offset value for the AD, by default is 0.
AD Oscillator:
Parameters
----------
fast : int
Number of periods to use for the fast calculation, by default 3.
slow : int
Number of periods to use for the slow calculation, by default 10.
offset : int
Offset to be used for the calculation, by default is 0.
ADX:
Parameters
----------
length : int
Window length for the ADX, by default is 50.
scalar : float
Scalar to multiply the ADX by, default is 100.
drift : int
Drift value for the ADX, by default is 1.
Aroon:
Parameters
----------
length : int
Window length for the Aroon, by default is 50.
scalar : float
Scalar to multiply the Aroon by, default is 100.
ATR:
Parameters
----------
length : int
Window length for the ATR, by default is 14.
mamode : Literal[rma, ema, sma, wma]
The mode to use for the moving average calculation.
drift : int
The difference period.
offset : int
Number of periods to offset the result, by default is 0.
CCI:
Parameters
----------
length : int
Window length for the CCI, by default is 14.
scalar : float
Scalar to multiply the CCI by, default is 0.015.
Clenow:
Parameters
----------
period : int
The number of periods for the momentum, by default 90.
Demark:
Parameters
----------
show_all : bool
Show 1 - 13.
If set to False, show 6 - 9.
offset : int
Number of periods to offset the result, by default is 0.
Donchian:
Parameters
----------
lower : Union[int, NoneType]
Window length for the lower band, by default is 20.
upper : Union[int, NoneType]
Window length for the upper band, by default is 20.
offset : Union[int, NoneType]
Number of periods to offset the result, by default is 0.
Fib:
Parameters
----------
period : int
The period to calculate the Fibonacci Retracement, by default 120.
start_date : Union[str, NoneType]
The start date for the Fibonacci Retracement.
end_date : Union[str, NoneType]
The end date for the Fibonacci Retracement.
Fisher:
Parameters
----------
length : int
Window length for the Fisher Transform, by default is 14.
signal : int
Fisher Signal Period
Ichimoku:
Parameters
----------
conversion : int
The conversion line period, by default 9.
base : int
The base line period, by default 26.
lagging : int
The lagging line period, by default 52.
offset : int
The offset period, by default 26.
lookahead : bool
Drops the Chikou Span Column to prevent potential data leak
KC:
Parameters
----------
length : int
Window length for the Keltner Channel, by default is 20.
scalar : float
Scalar to multiply the ATR, by default is 2.
mamode : Literal[ema, sma, wma, hna, zlma, rma]
The mode to use for the moving average calculation, by default is ema.
offset : int
Number of periods to offset the result, by default is 0.
MACD:
Parameters
----------
fast : Union[int, NoneType]
Window length for the fast EMA, by default is 12.
slow : Union[int, NoneType]
Window length for the slow EMA, by default is 26.
signal : Union[int, NoneType]
Window length for the signal line, by default is 9.
scalar : Union[float, NoneType]
Scalar to multiply the MACD by, default is 100.
OBV:
Parameters
----------
offset : int
Number of periods to offset the result, by default is 0.
RSI:
Parameters
----------
length : int
Window length for the RSI, by default is 14.
scalar : float
Scalar to multiply the RSI by, default is 100.
drift : int
Drift value for the RSI, by default is 1.
SRLines:
Parameters
----------
show : bool
Show the support and resistance lines.
Stoch:
Parameters
----------
fast_k : int
The fast K period, by default 14.
slow_d : int
The slow D period, by default 3.
slow_k : int
The slow K period, by default 3.
```
The model can be converted to a dictionary and then passed through the `indicators` params.
The chart below is built from the same object as the one above.
```python
indicators = data.charting.indicators().dict()
macd=indicators.get("macd")
kc=indicators.get("kc")
chart_params=dict(
candles=False,
title="My New Chart",
indicators=(dict(
macd=macd,
kc=kc,
))
)
data.charting.to_chart(**chart_params)
```

:::tip
Data can be exported directly from the chart as a CSV. Use the button at the bottom-right of the mode bar.
:::
|