Donchian Channels

Donchian Channels are a technical analysis tool developed by Richard Donchian, often used to identify potential breakouts in the market.

Description:

Donchian Channels consist of three lines:

  1. Upper Band: This line is formed by the highest high over a specified period. For example, if you are using a 20-day Donchian Channel, the upper band is the highest price over the last 20 days.
  2. Lower Band: This line is formed by the lowest low over the same specified period. Following the 20-day example, the lower band is the lowest price over the last 20 days.
  3. Middle Band: Some traders also use a middle band (TAAPI includes it in the response), which is the average of the upper and lower bands. This can provide additional insight into the average price movement.

How Traders Use Donchian Channels:

  1. Breakout Signals: One of the primary uses of Donchian Channels is to identify breakout opportunities. When the price breaks above the upper band, it may indicate a bullish breakout, suggesting that the uptrend could continue. Conversely, if the price breaks below the lower band, it could signify a bearish breakout, indicating a potential downtrend.
  2. Trend Confirmation: Traders also use Donchian Channels to confirm the direction of the trend. If the price consistently stays above the middle band and the upper band is sloping upwards, it suggests a strong uptrend. Conversely, if the price consistently stays below the middle band and the lower band is sloping downwards, it indicates a strong downtrend.
  3. Support and Resistance: The upper and lower bands can act as dynamic support and resistance levels. During an uptrend, the lower band can act as support, and during a downtrend, the upper band can act as resistance. Traders may look for buying opportunities near the lower band in an uptrend and selling opportunities near the upper band in a downtrend.
  4. Volatility Measurement: The width of the Donchian Channels can also provide information about market volatility. Wider channels indicate higher volatility, while narrower channels suggest lower volatility.
  5. Entry and Exit Points: Traders often use Donchian Channels to determine entry and exit points for trades. For example, a trader might enter a long position when the price breaks above the upper band and exit when it falls below the lower band.

Get Donchian Channels values via API

We provide API access to the Donchian Channels values for all of the most popular assets like stocks, crypto (try one of the popular exchanges like Binance) and forex, on all commonly used timeframes – from the weekly and daily all the way down to one minute intervals. You can also calculate the values on your own data using our manual method.

Customise the Donchian Channels indicator

With our API, you can adjust the period of the Donchian Channels using the optional period parameter, offering flexibility in your analysis. This parameter allows you to customize the length of time over which the highest high and lowest low are calculated, catering to your specific trading style and the current market conditions. For instance, choosing a shorter period like 10 days might help you capture shorter-term trends and quick breakouts, while opting for a longer period such as 50 days could provide a broader view of the market trend. Being able to adjust the period empowers you to fine-tune your strategies and adapt to changing market dynamics, enhancing the effectiveness of your Donchian Channels analysis.

Get started with the donchianchannels

Simply make an HTTPS [GET] request or call in your browser:

			[GET] https://api.taapi.io/donchianchannels?secret=MY_SECRET&exchange=binance&symbol=BTC/USDT&interval=1h
		

API response

The donchianchannels endpoint returns a JSON response like this:

			{
	"value": {
		"upper": 72797.99,
		"middle": 66199,
		"lower": 59600.01
	}
}
		
Example response from TAAPI.IO when querying donchianchannels endpoint.

API parameters

secret
Required String
The secret which is emailed to you when you request an API key.
exchange
Required String
The exchange you want to calculate the indicator from: binance, binancefutures or one of our supported exchanges. For other crypto / stock exchanges, please refer to our Client or Manual integration methods.
symbol
Required String
Symbol names are always uppercase, with the coin separated by a forward slash and the market: COIN/MARKET. For example: BTC/USDT Bitcoin to Tether, or LTC/BTC Litecoin to Bitcoin...
interval
Required String
Interval or time frame: We support the following time frames: 1m, 5m, 15m, 30m, 1h, 2h, 4h, 12h, 1d, 1w. So if you're interested in values on hourly candles, use interval=1h, for daily values use interval=1d, etc.
backtrack
Optional Integer
The backtrack parameter removes candles from the data set and calculates the donchianchannels value X amount of candles back. So, if you’re fetching the donchianchannels on the hourly and you want to know what the donchianchannels was 5 hours ago, set backtrack=5. The default is 0 and a maximum is 50.
backtracks
Optional Integer
The backtracks parameter returns the donchianchannels value calculated on every candle for the past X candles. For example, if you want to know what the donchianchannels was every hour for the past 12 hours, you use backtracks=12. As a result, you will get 12 values back.
chart
Optional String
The chart parameter accepts one of two values: candles or heikinashi. candles is the default, but if you set this to heikinashi, the indicator values will be calculated using Heikin Ashi candles. Note: Pro & Expert Plans only.
addResultTimestamp
Optional Boolean
true or false. Defaults to false. By setting to true the API will return a timestamp with every result (real-time and backtracked) to which candle the value corresponds. This is helpful when requesting multiple backtracks.
gaps
New Optional Boolean
true or false. Defaults to true. By setting to false, the API will ensure that there are no candles missing. This often happens on lower timeframes in thin markets. Gaps will be filled by a new candle with 0 volume, and OHLC set the the close price of the latest candle with volume.
results
New Optional String
number or max. Use this parameter to access historical values on the past X candles until the most recent candle. Use max to return all available historical values. Returns an array with the oldest value on top and most recent value returned the last.
period
Optional Integer

The number of candles over which the highest high and lowest low are calculated.

Default: 20

More examples

Let's say you want to know the donchianchannels value on the last closed candle on the 30m timeframe. You are not interest in the real-time value, so you use the backtrack=1 optional parameter to go back 1 candle in history to the last closed candle.

				[GET] https://api.taapi.io/donchianchannels?secret=MY_SECRET&exchange=binance&symbol=BTC/USDT&interval=30m&backtrack=1
			
Get donchianchannels values on each of the past X candles in one call

Let's say you want to know what the donchianchannels daily value was each day for the previous 10 days. You can get this returned by our API easily and efficiently in one call using the backtracks=10 parameter:

				[GET] https://api.taapi.io/donchianchannels?secret=MY_SECRET&exchange=binance&symbol=BTC/USDT&interval=1d&backtracks=10
			

Here's the example response:

				[
	{
		"value": {
			"upper": 72797.99,
			"middle": 66199,
			"lower": 59600.01
		},
		"backtrack": 0
	},
	{
		"value": {
			"upper": 72797.99,
			"middle": 66199,
			"lower": 59600.01
		},
		"backtrack": 1
	},
	{
		"value": {
			"upper": 72797.99,
			"middle": 66199,
			"lower": 59600.01
		},
		"backtrack": 2
	},
	{
		"value": {
			"upper": 72797.99,
			"middle": 66199,
			"lower": 59600.01
		},
		"backtrack": 3
	},
	{
		"value": {
			"upper": 72797.99,
			"middle": 66199,
			"lower": 59600.01
		},
		"backtrack": 4
	},
	{
		"value": {
			"upper": 72797.99,
			"middle": 66199,
			"lower": 59600.01
		},
		"backtrack": 5
	},
	{
		"value": {
			"upper": 72797.99,
			"middle": 66238.07500000001,
			"lower": 59678.16
		},
		"backtrack": 6
	},
	{
		"value": {
			"upper": 72797.99,
			"middle": 66238.07500000001,
			"lower": 59678.16
		},
		"backtrack": 7
	},
	{
		"value": {
			"upper": 72797.99,
			"middle": 66729.28,
			"lower": 60660.57
		},
		"backtrack": 8
	},
	{
		"value": {
			"upper": 72797.99,
			"middle": 66729.28,
			"lower": 60660.57
		},
		"backtrack": 9
	}
]
			

Looking for even more integration examples in different languages like NodeJS, PHP, Python, Curl or Ruby? Continue to [GET] REST - Direct documentation.