Double bottom top buy sell
Buy and sell markers after a double bottom or top breaks out; silent at default settings.
Two small state machines run on closing prices. The buy side waits for a close within eps above the lowest close of the last 100 bars, a bounce of at least pullback off that low, then a second close near the low; from there it marks a buy when a close breaks above the highest close of the same 100 bars. The sell side mirrors this at the top, marking a sell when a close breaks below the 100-bar low after a double top.
How to read it
- Markers sit on the candles where a signal fires; the indicator draws no line or pane.
- A buy needs two closes near the 100-bar low with a bounce in between, then a close above the 100-bar high. On a one-minute chart 100 bars is 100 minutes.
- A sell is the mirror: two closes near the 100-bar high with a dip in between, then a close below the 100-bar low.
- At default settings the chart shows no markers on SPY one-minute bars. Only a negative band can produce markers.
What it outputs
- Buy
- Marks a buy when a close breaks above the 100-bar high after a double bottom. The high includes the current close, so at band 0 it never fires.
- Sell
- Marks a sell when a close breaks below the 100-bar low after a double top. The low includes the current close, so at band 0 it never fires.
When it fires
The buy fires on the first bar of each breakout above the 100-bar high after the second bottom; the sell fires on each breakout below the 100-bar low after the second top. Both stay armed for the rest of the run. At band 0 neither fires.
Settings
- eps
- How close a close must sit to the 100-bar low (or high) to count as a touch. Raising it counts looser touches and fires more; lowering it needs near-exact retests. Below 0 nothing counts as a touch, so it never fires.
- pullback
- How far the close must rise off the low (or drop off the high) between the two touches. Raising it demands a deeper swing and fires less; lowering it accepts a shallow bounce. At 0 the bounce test always passes, so only the second touch matters.
- band
- Shifts the breakout line: a buy needs a close above the 100-bar high times (1 + band), a sell below the 100-bar low times (1 - band). At 0 or above nothing fires. Negative values move the line just short of the high or low, so markers appear.
- confirm_days
- How many bars in a row the breakout must hold before a marker. 1 marks the first breakout bar; higher values wait for that many consecutive bars, so fewer and later markers.
Pitfalls
- At default band 0 nothing fires on SPY one-minute bars from 1 Sep to 1 Oct 2026, because the breakout line is the 100-bar extreme of closes that already includes the current close.
- The channel is built from closes over 100 bars, not highs and lows, despite the Donchian name.
- After the second touch the state never returns to idle, so the pattern does not re-arm; later breakouts keep marking for the rest of the run.