Free: indicator teardowns, a repaint checker and open-source scripts. No buy/sell signals, ever.

Taught to TradeSystems over signals.

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

  1. 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.
  2. 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.
  3. 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.
  4. 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

SettingDefaultWhat it does
Relevant Periods to identify OB5how many same-colour candles must follow; also the delay (periods + 1 bars)
Min. Percent move to identify OB0.0minimum close-to-close move over the run; 0 means no filter
Use whole range [High/Low]offzone uses the full candle range instead of open to low (or open to high)
Show latest Bullish / Bearish Channelonthe three left-running lines for the newest block
Show Latest OB Paneloffa 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

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

Next steps

  • Get a script fixed. Compiles but behaves differently live, or changes after a reload? In a Pine Script Audit, an AI model reads every line and writes a report on what to fix for $49, or also fixes those problems for $149. It cannot prove a script is safe.
  • Check your own script. Paste its source into the free repaint checker. It runs in your browser and flags known patterns.
Subscribe to the Teardown Letter: $19/moBack to Taught to Trade

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.