What counts as a no-wick candle?

A bullish no-wick candle closes above its open, and its low equals its open. A bearish one closes below its open, and its high equals its open. The wick on the other side can still be there.

The strategy also checks where the candle closes. For a buy setup, the close has to be above both the 20 EMA and the 50 EMA. For a sell setup, it has to be below both. Once a setup qualifies, the script places a limit order at the candle’s open. The order becomes eligible on the next bar.

Two gold charts, two different outcomes

On September 11, the 06:00 candle opened at $4,345.61. The next five bars stayed above that price. The 07:30 candle traded through the limit level, so this retest was within the ten-bar window.

On May 25, a 09:15 setup left a buy limit at $4,623.66. The next ten bars stayed above it. Gold finally touched the level at 12:15, on bar 12. The order would already have expired. Both examples replay the entry rules from a flat position.

XAUUSD reaches $4,623.66 on bar 12 after a pending buy setup expires on bar 10.
May 25, 2026. The yellow line ends after the tenth eligible candle. The dotted line shows the original order level through the later touch.

What happens once an order fills?

The stop goes beyond the most recent confirmed swing on the other side of the planned entry, with a configurable buffer and minimum distance. The target defaults to 1R, measured from the planned entry and stop. If an opposite no-wick candle closes while the trade is active, the strategy moves the stop to the simulated entry price.

The default limit is three filled trades per day. An opposite no-wick candle can cancel an unfilled order. The script also supports restricted hours, manually entered USD news times, and an optional support and resistance filter.

The setting I’d test first

I’d start with the retest window. Keep the same gold feed, timeframe, and exit rules, then compare five, ten, and twenty bars. Pull up the trades that appear only in the longer window. The May 25 chart shows exactly the kind of entry you’d be adding.

Already have a strategy? See how to compare settings in Pine Backtest Studio.

Have a setup you want to backtest?

Send me your entry and exit rules and a chart example. I can turn them into a TradingView strategy you can test bar by bar.

Request a Pine Script strategy
CW.
Written by CW

Sharing practical TradingView strategies and Pine Script development notes.