For the Bot and Backtest. Your chart draws both, and so does the script you copy to another platform. They can't yet draw the gap with the parts that change how it is traded, or a rejection candle whose average is on longer candles than your setup's. Every number is yours. The averages are exponential moving averages of candle closes. A detector decides when a setup's last candle closes.
Fair value gap at a moving average
A fair value gap is the space between the first candle's high and the third candle's low (a gap up), or the first candle's low and the third candle's high (a gap down). You can set the smallest gap, in ticks, that counts.
A setup needs a gap, the average's line passing through at least one of the three candles, and the third candle closing above the average for a gap up (a long) or below it for a gap down (a short).
If the first candle closed on the other side of the average, price crossed it, and the gap counts. If it was already on the gap's side, it's a return, which counts only if you choose.
You can add these beside it:
- Continuation gaps away from the average. Lets in a gap where no candle touched the average, closing above it for a long or below it for a short. Its first candle must close within a multiple of the detector's widest stop allowed, measured from the average (you set both). After an entry, these must be on that entry's side until price touches the average. You set how many may be taken before price touches the average again; a touch of the average, or an entry from a gap at the average, starts the count again.
- Middle candle spans the gap's midpoint. The middle candle's range must include the gap's midpoint, so this refuses a gap only after price jumps between candles. Continuation gaps aren't checked.
- Entries per gap. One gap gives at most the number you set. A later, overlapping gap on the same side is the same gap.
Moving average rejection candle
You set the average's length, and its candle length: your setup's own, or a whole multiple of it, using the last longer candle that has closed.
A setup is a candle whose open and close are both above the average (a long), or both below it (a short), and whose range reaches the average. You can let a candle within a number of ticks of the average count, and require the wick on the average's side to be at least as long as the other wick.
These gates use a second, faster average, the same length on each.
You can add these beside it:
- Faster average on the trade's side: above the detector's average for a long, below it for a short.
- Faster average moving: it must have moved more than a number of ticks, up or down, over a number of candles.
- Averages apart: the two averages must be more than a number of ticks apart.
Where the stop goes
Builder names are in brackets.
- The average (the indicator line): its value when the setup completes.
- The gap's far side (the opposite band) or its middle (the middle of the bands).
- The candles' extreme (the pattern candle's extreme): the lowest low for a long, or highest high for a short, of the three candles or of the rejection candle.
- Recent candles (the swing extreme): the lowest low or highest high over a number of candles you set.
- A set distance: ticks from the entry, which you type.
You can add a buffer of ticks. A stop on the wrong side of the entry places no trade.
What can go wrong
- A gate beside a detector that doesn't read it, or two faster-average gates with different lengths: the builder flags it, and the strategy won't run until you fix it.
More parts change how each detector trades: see More parts for the gap and rejection candle.
What's next
Targets: Entries and exits.