Skip to main content

donchian

Calculate the Donchian Channels.

Three lines generated by moving average calculations that comprise an indicator formed by upper and lower bands around a midrange or median band. The upper band marks the highest price of a security over N periods while the lower band marks the lowest price of a security over N periods. The area between the upper and lower bands represents the Donchian Channel.

Example​

from openbb import obb

stock_data = obb.equity.price.historical(symbol='TSLA', start_date='2023-01-01', provider='fmp')
donchian_data = obb.technical.donchian(data=stock_data.results, lower_length=20, upper_length=20, offset=0)

Parameters​

NameTypeDescriptionDefaultOptional
dataList[Data]List of data to be used for the calculation.False
indexstrIndex column name to use with data, by default "date".dateFalse
lower_lengthintNumber of periods for the lower band, by default 20.20False
upper_lengthintNumber of periods for the upper band, by default 20.20False
offsetintOffset of the Donchian Channel, by default 0.0False

Returns​

OBBject
results : List[Data]
The calculated data.