Donchian breakout buy sell
Meant to mark breaks of the recent high or low; at default settings it never fires.
The indicator builds a Donchian channel over the last window bars, taking the highest high and the lowest low of them. The channel includes the current bar. Buy fires when the close is above the channel top times (1 + band), and sell when it is below the channel bottom times (1 - band). Because the current bar's own high sits in the top and its low in the bottom, a close can never clear either edge at band 0, so with default settings neither signal fires.
How to read it
- Buy and sell are drawn as markers on the candles, not in a pane below the price.
- At the default band of 0 there are no markers at all, so the chart looks empty.
- A negative band moves each edge inside the channel: buy means the close is within that fraction below the window high, and sell means it is within that fraction above the window low.
- At small negative bands both signals are often on at the same time, because the median 20-bar range in the sample month was only about 0.09% of price.
What it outputs
- Buy
- Fires when the close is above the window high times (1 + band). Never fires at the default band of 0, because the high is part of the window.
- Sell
- Fires when the close is below the window low times (1 - band). Never fires at the default band of 0, because the low is part of the window.
When it fires
A buy fires on the first bar of a run where the close sits within the band below the window high. A sell fires where the close sits within the band above the window low. At band 0 neither fires. A marker means price is pressing its recent extreme, not that it broke through.
Settings
- window
- How many bars the channel covers, including the current one. Longer means a wider channel, and it does not reliably mean fewer events: at -0.5% a 60-bar window gave 19 buy events against 10 for 20 bars.
- band
- Offset on both edges, 0 by default, and zero or above never fires. Small negatives such as -0.1% pull both edges inside the channel, so both signals fire often. From -0.5% down, both stay on for most bars.
- confirm_days
- How many bars in a row the condition must hold before it counts. 1 is the default and adds no filter. At -0.1% with 3 bars, buy and sell drop from about 22 to about 16 events a day each, and are rarely on together.
Pitfalls
- Looks broken: the channel includes the current bar, so at band 0 buy and sell never fire (zero events in the sample month). A channel built only from previous bars would fire about 40 times a day on each side.
- Flat bars: about 19% of the one-minute bars have high equal to low. At -0.1% buy and sell are both on together on about 70% of bars, so the two signals often contradict each other.
- A wide negative band, such as -1%, keeps both signals on for almost every bar and gave one event in the sample month, so it reads as a constant state rather than a stream of signals.