The candle pattern gate looks at the last closed candle on a timeframe you name. It lets the entry through, or not, depending on a mode you choose.
What it does
You pick one of two modes:
- Must be present: the entry is blocked unless the last closed candle is the pattern you named.
- Must be absent: the entry is blocked if the last closed candle is that pattern.
When the gate stops a setup in a backtest, Why no trade here? says which way, for example "The last closed candle was a doji, and your filter says it must be absent."
The related detector
There is also a candle pattern detector, which is a different thing. Instead of filtering an entry, it creates one. Both read the same list: the six original bar patterns (an inside bar, an outside bar, the narrowest of the last four or seven bars, and bullish or bearish engulfing) and more than a hundred published candlestick patterns, from a doji to the three methods. See candle patterns in Studio for the list and the numbers each one asks for.
The detector has two trigger modes:
- Breakout. The pattern sets a level at its high and low. For a pattern of several candles, that is the highest high and lowest low of all of them. The signal comes when a later candle closes a number of ticks beyond one of them.
- Close direction. The pattern's last candle is the signal, at its close. It enters the way the pattern points: a bullish pattern is a long, a bearish one a short. An outside bar goes the way its body closed. Patterns that point neither way, such as a doji, can only use a breakout.
How many candles the break may take, and how many ticks beyond, belong to a breakout. With close direction, leave those boxes empty. The builder flags them if they hold a number, because the signal would not run with them.
Which candle the gate reads
Normally the gate reads the last closed candle when the entry is decided. You can choose instead the candle the signal's pattern formed on. Beside a breakout, that is the pattern candle, not the later candle that broke out. For example, a narrowest-of-four breakout with an inside bar gate reads whether the narrow candle was also an inside bar.
Gate or detector
The gate adds a candle condition on top of a detector you already have. The detector is for when the candle pattern is the setup.
What can go wrong
Both read closed candles on the timeframe you name on the block, not the one you happen to be looking at. If a rule seems to fire at odd moments, check the timeframe on the block.
If the gate is switched on but can't be read, for example a newer pattern with one of its numbers missing, the builder names what's wrong. A backtest and the Bot then refuse the strategy rather than run it without the gate.
Four-hour and daily candles
At four hours and one day, candles follow the futures trading day, not midnight. A daily candle is one trading session: from the 5pm Central open to the 4pm Central close the next afternoon.
Four-hour candles start at 5pm, 9pm, 1am, 5am, 9am and 1pm Central. The last one is three hours long, because the session closes at 4pm. On a holiday with an early close, the day's last candle ends at the early close.
Every other block reads the same candles at those lengths, in a backtest and live.