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

Taught to TradeSystems over signals.

Explainers / FVG Order Blocks by BigBeluga

FVG Order Blocks by BigBeluga, explained from the source

FVG Order Blocks [BigBeluga] is an open-source TradingView indicator by BigBeluga, published in October 2024, with about 26,200 boosts. It marks three-bar price gaps (often called fair value gaps) and draws a coloured block next to each one. This page walks through the published code in order, says what each part does, and ends with where it fails. It does not say what any block means for the next move.

The surprise: the block is a band one ATR thick, not a candle

Many readers expect an "order block" to be a specific candle. In this script it is not. When a gap up is found, the block's top edge is the high of the first of the three bars, and its bottom edge is that high minus the 200-bar average true range. For a gap down, the block runs from the low of the first bar up by the same amount. So every block on the chart has the same thickness at the moment it is drawn, whatever the candles looked like, and that thickness is a volatility figure, not a price range that traded. The percentage printed in the block is the size of the gap as a share of price. The script uses no volume anywhere.

Step 1: finding the gap

On each closed bar, the script looks at the last three bars. A gap up needs the low of the newest bar to sit above the high of the bar two back, the middle bar's high to be above that same high, and the newest low to be above the oldest low. A gap down is the mirror image. The gap's size is then measured as a percentage of price, and the gap only counts if it is larger than "Filter Gaps by %", which is 0.5 by default. Only the most recent 2,000 bars are checked; that number is fixed in the code and is not a setting.

Step 2: the two boxes

Each gap that passes draws two things. The first is a small grey box over the gap itself, six bars wide, with the percentage on it. It is drawn once and never changed: the code does not track whether price later trades back through the gap. The second is the coloured block from the section above, which is stretched to the right edge of the chart. Its fill gets stronger as the gap's percentage approaches the largest gap of the last 200 bars, so the shading compares each gap with recent gaps on the same chart and is not an absolute scale.

Step 3: how a block is removed

A block goes away in three ways. First, when a whole bar sits beyond its far edge: for a block under a gap up, the bar's high must be below the block's bottom. A close through the block is not enough. Second, when another block on the same side has its top edge inside this one, this one is deleted. The rule looks only at where the top edges are, not at which block is older or had the larger gap. Third, when the number of blocks on a side reaches "Blocks Amount", the oldest is deleted. With "Broken Blocks" switched on, blocks removed the first way are greyed and kept in view.

Step 4: the optional arrows

"Order Blocks Signals" is off by default. When on, the script prints a small arrow when a bar's low sits above the top of a block after the previous bar's low was at or inside it (and the mirror for blocks above price). The arrow is placed on the previous bar, not on the bar that produced it. These are chart labels. The script has no alert conditions at all, so nothing in it can trigger a TradingView alert as published.

What the settings change

"Filter Gaps by %" (0.5) sets how large a gap must be, as a percentage of price. "Blocks Amount" (6) limits blocks per side. "Fair Value Gaps" shows or hides the small grey gap boxes. "Broken Blocks" keeps removed blocks on the chart in grey. "Order Blocks Signals" turns on the arrows. The 200-bar ATR, the 200-bar window for the shading and the 2,000-bar lookback are fixed in the code. The chart on the script's own page was made with 0.1 and 10 in the first two boxes, not the defaults of 0.5 and 6.

What we checked in Python

We ported the logic to Python and ran it on invented random-walk prices with 20 price ticks inside each bar, three runs of 20,000 bars, at two bar sizes. Before the filter, a three-bar gap formed on about 15% of bars in each direction, on prices with nothing in them to find.

The filter decides almost everything. With bars that typically move 1.5%, about 63% of gaps passed the default 0.5% filter. With bars that typically move 0.2%, under 1% of gaps passed, which is about one block per thousand bars. With the listing picture's 0.1 filter on the same small bars, about half passed.

"Blocks Amount" showed one fewer than the number entered. With 6, the most blocks ever standing on one side at a bar's close was 5; with 10 it was 9. The code deletes the oldest block as soon as the count reaches the setting, not when it passes it.

With the defaults on the larger bars, about half of all blocks (48% to 51%) were removed by the overlap rule, 37% to 39% by a whole bar beyond the far edge, and 12% to 13% by the count limit. In the overlap removals, the deleted block had the larger gap percentage about half the time. Bars closed beyond a block's far edge without removing it 0.76 to 0.80 times per block on average.

Inside a live bar, two things came and went. About 60 times per 1,000 bars, a block looked removed at the start of a bar and was back by its close, because the bar began wholly beyond the block and then traded back to it. With the arrows on, 90 to 94 arrows per 1,000 bars were still there at the close, and 125 to 137 appeared at the start of a bar and were gone by its close. These figures describe the code on invented data, not any market.

Where it fails

Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. FVG Order Blocks [BigBeluga] is by BigBeluga on TradingView; this page describes its published open-source code in our own words and is not affiliated with the author. Simulation figures come from synthetic random-walk prices and say nothing about how the script 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, Order Block Finder, 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, Volume Flow Indicator by LazyBear, CM_Williams_Vix_Fix by ChrisMoody, Bollinger + RSI Double Strategy by Chart, Ultimate Moving Average MTF by ChrisMood, Fibonacci Bollinger Bands by Rashad, Candlestick Patterns Identified by repo3, MACD + SMA 200 Strategy by ChartArt, Pine Script v5 to v6, Moving Average Cross Alert, Multi-Timefr, WaveTrend Oscillator [WT] by LazyBear, WaveTrend with Crosses [LazyBear], CM_Price-Action-Bars by ChrisMoody, RSI Candles by glaz, CM RSI-2 Strategy Lower Indicator by Chr, CM Stochastic Multi-TimeFrame by ChrisMo, CM_Ultimate RSI Multi Time Frame by Chri, TonyUX EMA Scalper - Buy / Sell by tux, MACD 4C by vkno422, My Pine Script is valid. What did the va

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.
Before you trust its backtest: the Integrity Checklist, $19 one-offBack 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.