Explainers / Order Block Finder
Order Block Finder, explained from the source
"Order Block Finder (Experimental)" by wugamlo is one of the most-boosted free order block scripts on TradingView, with more than 41,000 boosts. Its rule is short: a bullish order block is the last red candle before five green candles in a row, and a bearish one is the last green candle before five red ones. Everything else on the chart is drawn from that one candle.
How it works
- Find the run. On each bar the script looks back at the previous five candles. If all five closed green and the candle before them closed red, that red candle is a bullish order block. The mirror rule (green, then five red) gives a bearish one. A candle that closes exactly at its open counts as neither colour and breaks the run.
- Optional size filter. "Min. Percent move" compares the close of the order block candle with the close of the last candle in the run. The default is 0.0, so every run of five qualifies.
- Mark the zone. A bullish zone runs from the red candle's open down to its low; a bearish zone from the green candle's open up to its high. With "use whole range" on, both use the full high to low. A cross marks the midpoint.
- Draw it back. The triangle, the zone lines and the cross are plotted on the order block candle itself, six bars before the bar where the rule became true.
Why it looks better in hindsight
At the default of 5, a block can only be known six bars after its candle: five candles for the run, plus the script checks the run from the next bar. On a finished chart every triangle sits neatly at the start of a move, because the script only marks a candle once the move has already happened. It does not repaint after that (it only uses closed bars), but it is never early.
On random-walk prices with no structure in them, our re-implementation found a bullish block about every 62 to 69 bars and a bearish one about as often. That is what chance alone predicts: a red candle followed by five greens is a one in 64 event when each candle is a coin flip.
What the "latest channel" lines do
"Show latest Bullish/Bearish Channel" draws three thin lines (top, midpoint, bottom) for the most recent block. The code starts them at the bar where the block was found and extends them to the left, across the history behind it. They stop at the detection bar and are not extended into the bars that come after. So the level is shown running through past prices, where it was not yet known, and not across the bars where you would actually watch it. Each new block deletes the previous lines.
Zones are never marked broken. Price can trade straight through a block and it stays on the chart. In our simulation, price traded back into a zone within 50 bars in about two thirds of cases, on data that has no order blocks at all, so a revisit on its own shows little.
The settings
| Setting | Default | What it does |
|---|---|---|
| Relevant Periods to identify OB | 5 | how many same-colour candles must follow; also the delay (periods + 1 bars) |
| Min. Percent move to identify OB | 0.0 | minimum close-to-close move over the run; 0 means no filter |
| Use whole range [High/Low] | off | zone uses the full candle range instead of open to low (or open to high) |
| Show latest Bullish / Bearish Channel | on | the three left-running lines for the newest block |
| Show Latest OB Panel | off | a label with the newest block's high, midpoint and low |
Raising "Relevant Periods" makes blocks rarer and later, not more meaningful: at 7, a block is known 8 bars after its candle.
The alerts
Two alert conditions: "New Bullish OB detected" and "New Bearish OB detected". Each fires on the bar where the rule becomes true, six bars after the candle it refers to at the default. The script's own alert text says it is not a buy or sell signal, and nothing in the code tests what price does afterwards.
Where it fails
- Always late. A block is known periods + 1 bars after its candle (6 at the default) and drawn back, so a finished chart overstates how early it was visible.
- Candle colour only. One doji in the run cancels a block; a run of five tiny candles creates one. Size is ignored unless you set the threshold.
- No invalidation. Zones are never marked broken when price trades through them.
- Lines run the wrong way. The latest-channel lines extend left into history and stop at the detection bar.
- Chance-level frequency. On random prices the rule fires about as often as a coin-flip model predicts, so the count of blocks says nothing on its own.
- Fixed rule everywhere. The same five-candle rule applies on every market and timeframe; there is no test here of whether any block meant anything.
Also explained: Market Structure Break & Order Block · Support Resistance Channels · Pivot Points High Low · Repainting
Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. Order Block Finder is by wugamlo on TradingView, published under the Mozilla Public License 2.0; this page explains its published open-source code and is not affiliated with the author. Simulation figures come from synthetic random-walk prices and say nothing about how the indicator trades.
Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, Chandelier Exit, WaveTrend Oscillator, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, HalfTrend, ZigZag++, SSL Hybrid, CM MacD Ultimate MTF, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Pivot Point SuperTrend, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Support and Resistance (High Volume Boxe, Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue
Get the next teardown by email
One short email when a new teardown or free tool goes live, about twice a month. No signals, no hype. Unsubscribe in one click.
Almost done. Check your inbox and click the confirmation link.
Sent with Kit. Your address is used only for these emails. Privacy
No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.