Page 1 of 1

Stop getting stopped out! Why you need an Order Block (OB) Finder for Scalping

Posted: Thu Jul 30, 2026 7:30 pm
by PTScalper
Hey everyone,
If you're new to forex scalping and keep getting chopped up on the 1-minute or 5-minute charts,
you need to look into Order Blocks (OB). I see a lot of rookies relying purely on lagging indicators like moving averages or RSI,
but if you want to trade like the "smart money" (the big banks and institutions),
OBs are the way to go.So, what exactly is an Order Block?

Think of it as a hidden footprint left by the whales. When institutional traders drop massive orders, the market
consolidates and then explodes in one direction. A bullish order block is simply the last down (bearish) candle right
before a massive upward breakout. A bearish order block is the last up (bullish) candle before a huge downward dump.

Because these big players couldn't get all their massive orders filled at once, there are a ton of leftover limit orders sitting
in that original zone. When the price eventually drops back down into that bullish OB zone, it acts like a trampoline.
The remaining orders get triggered, and the price instantly reacts. Using an Order Block Finder indicator makes
this 10x easier for beginners. Instead of squinting at your charts trying to guess where the banks bought or sold,
the indicator automatically draws these supply and demand zones directly on your chart.

For scalping, this is gold. You just wait for the price to retrace into the colored box, look for a quick
rejection (like a pin bar), and ride the bounce for a fast 10-20 pips. Stop blindly buying breakouts.
Let the price come back to the Order Block. Anyone else using SMC (Smart Money Concepts) for their scalping?

Let me know below!

Basic Order Block Finder MT4 Code (MQL4)Here is a basic, rookie-friendly MT4 custom indicator script.
It scans the chart for impulsive price movements (defined by a pip threshold) and draws a rectangle over the candle
immediately preceding the move, simulating a basic Order Block.To use this:
Open MT4 -> Press F4 (MetaEditor) -> Click New -> Custom Indicator -> Paste this code over everything, and hit Compile.

Code: Select all

//+------------------------------------------------------------------+
//|                                              Basic_OB_Finder.mq4 |
//|                                      Copyright 2026, RookieForum |
//+------------------------------------------------------------------+
#property copyright "Forum Post Example"
#property version   "1.00"
#property indicator_chart_window

// User Inputs
extern int Lookback = 200;           // Number of historical bars to scan
extern int ThresholdPips = 15;       // Size of the impulsive move in pips

int OnInit() {
   return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason) {
   // Clean up the drawn rectangles when removing the indicator
   ObjectsDeleteAll(0, "OB_");
}

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   // Only draw on the initial load to save processing power
   if (prev_calculated == 0) {
      double point = Point;
      if (Digits == 3 || Digits == 5) point *= 10; // Adjust for fractional pip brokers

      // Loop through historical bars (index i is older than index i-1)
      for (int i = Lookback; i > 1; i--) {
         
         // 1. Identify Bullish Order Blocks (Impulsive move UP)
         if (close[i-1] - open[i-1] > ThresholdPips * point) {
            if (close[i] < open[i]) { // Previous candle was bearish
               string bullName = "OB_Bull_" + IntegerToString(time[i]);
               if(ObjectFind(0, bullName) < 0) {
                  // Draw a green rectangle over the bearish candle
                  ObjectCreate(0, bullName, OBJ_RECTANGLE, 0, time[i], high[i], time[i-1], low[i]);
                  ObjectSetInteger(0, bullName, OBJPROP_COLOR, clrMediumSeaGreen);
                  ObjectSetInteger(0, bullName, OBJPROP_BACK, true);
               }
            }
         }
         
         // 2. Identify Bearish Order Blocks (Impulsive move DOWN)
         if (open[i-1] - close[i-1] > ThresholdPips * point) {
            if (close[i] > open[i]) { // Previous candle was bullish
               string bearName = "OB_Bear_" + IntegerToString(time[i]);
               if(ObjectFind(0, bearName) < 0) {
                  // Draw a red rectangle over the bullish candle
                  ObjectCreate(0, bearName, OBJ_RECTANGLE, 0, time[i], high[i], time[i-1], low[i]);
                  ObjectSetInteger(0, bearName, OBJPROP_COLOR, clrIndianRed);
                  ObjectSetInteger(0, bearName, OBJPROP_BACK, true);
               }
            }
         }
      }
   }
   return(rates_total);
}
//+------------------------------------------------------------------+

Re: Stop getting stopped out! Why you need an Order Block (OB) Finder for Scalping

Posted: Thu Jul 30, 2026 7:33 pm
by PTScalper
Here is the complete guide for setting up the Order Block Finder indicator on MetaTrader 5 (MT5)
using IC Markets (or any MT5 broker), followed by the converted MQL5 code.

How to Set Up & Run on MT5 (IC Markets)

1.Open IC Markets MT5 & MetaEditor:Launch your IC Markets MetaTrader 5 terminal. In the top menu bar, click Tools $\rightarrow$ MetaQuotes Language Editor (or simply press F4 on your keyboard).

2.Create a New Indicator File:In MetaEditor, click New on the top toolbar (or press Ctrl+N). Select Custom Indicator (template), click Next, set the name to Basic_OB_Finder, and click Finish.

3.Paste the MQL5 Code:Select all default text in the editor window and delete it. Copy the MQL5 code provided below and paste it into the blank document.

4.Compile the Script:Click the Compile button at the top toolbar (or press F7). Check the Errors tab at the bottom to make sure it shows 0 errors, 0 warnings.

5.Attach to Your Scalping Chart:Return to MT5. Open the Navigator window (Ctrl+N), expand Indicators $\rightarrow$ Custom, and drag Basic_OB_Finder onto your chart (such as EURUSD on the 1M or 5M timeframe). Set your inputs and click OK.

Code: Select all

//+------------------------------------------------------------------+
//|                                              Basic_OB_Finder.mq5 |
//|                                      Copyright 2026, RookieForum |
//+------------------------------------------------------------------+
#property copyright "Forum Post Example"
#property version   "1.00"
#property indicator_chart_window
#property indicator_plots 0

// Inputs
input int Lookback = 200;           // Number of historical bars to scan
input int ThresholdPips = 15;       // Minimum size of impulsive move in pips

int OnInit() {
   return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason) {
   // Clean up drawn rectangles when removing the indicator
   ObjectsDeleteAll(0, "OB_");
}

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   if (rates_total < Lookback + 1) return(0);

   // Set bar indexing: 0 = current bar, 1 = previous completed bar
   ArraySetAsSeries(time, true);
   ArraySetAsSeries(open, true);
   ArraySetAsSeries(high, true);
   ArraySetAsSeries(low, true);
   ArraySetAsSeries(close, true);

   // Execute scan on initial load
   if (prev_calculated == 0) {
      double point = _Point;
      if (_Digits == 3 || _Digits == 5) point *= 10; // Adjust for fractional pips (raw spreads)

      int limit = Lookback;
      if (limit >= rates_total - 1) limit = rates_total - 2;

      for (int i = limit; i >= 2; i--) {
         
         // 1. Identify Bullish Order Block (Impulsive move UP on bar i-1)
         if ((close[i-1] - open[i-1]) > ThresholdPips * point) {
            if (close[i] < open[i]) { // Bar i was the last bearish candle before the move
               string bullName = "OB_Bull_" + IntegerToString(time[i]);
               if (ObjectFind(0, bullName) < 0) {
                  ObjectCreate(0, bullName, OBJ_RECTANGLE, 0, time[i], high[i], time[i-1], low[i]);
                  ObjectSetInteger(0, bullName, OBJPROP_COLOR, clrMediumSeaGreen);
                  ObjectSetInteger(0, bullName, OBJPROP_BACK, true);
                  ObjectSetInteger(0, bullName, OBJPROP_SELECTABLE, false);
               }
            }
         }
         
         // 2. Identify Bearish Order Block (Impulsive move DOWN on bar i-1)
         if ((open[i-1] - close[i-1]) > ThresholdPips * point) {
            if (close[i] > open[i]) { // Bar i was the last bullish candle before the drop
               string bearName = "OB_Bear_" + IntegerToString(time[i]);
               if (ObjectFind(0, bearName) < 0) {
                  ObjectCreate(0, bearName, OBJ_RECTANGLE, 0, time[i], high[i], time[i-1], low[i]);
                  ObjectSetInteger(0, bearName, OBJPROP_COLOR, clrIndianRed);
                  ObjectSetInteger(0, bearName, OBJPROP_BACK, true);
                  ObjectSetInteger(0, bearName, OBJPROP_SELECTABLE, false);
               }
            }
         }
      }
   }
   return(rates_total);
}
//+------------------------------------------------------------------+

Re: Stop getting stopped out! Why you need an Order Block (OB) Finder for Scalping

Posted: Thu Jul 30, 2026 7:35 pm
by PTScalper
And here i prepared it for IC trader:

cTrader uses C# for its custom indicators, which makes it incredibly powerful but requires a slightly different setup than MetaTrader.

How to Set Up & Run on cTrader

1.Open cTrader Automate:Launch your IC Markets cTrader desktop platform. On the far-left menu panel, click on the Automate tab (it looks like an algorithm node or play button).

2.Create a New Indicator:In the left-hand column under the Automate screen, click on the Indicators tab, then click the "+" (New) button at the top of that list. Name your new indicator Basic_OB_Finder.

3.Paste the C# Code:The code editor will open in the middle of your screen. Delete all the default code that is already there, and paste the C# code provided below.

4.Build (Compile) the Indicator:Click the Build button at the top of the code editor (or press Ctrl+B). Look at the "Build Result" log at the bottom to ensure it says Build Succeeded.

5.Attach to Your Chart:Click back to the Trade tab on the far-left menu to view your charts. Right-click anywhere on your scalping chart, select Indicators $\rightarrow$ Custom $\rightarrow$ Basic_OB_Finder. Adjust your pip threshold and click OK!

Copy and paste this directly into the cTrader Automate editor. I've programmed this version to draw semi-transparent boxes so you can still easily see the candlestick wicks hidden inside the Order Blocks.

Code: Select all

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Basic_OB_Finder : Indicator
    {
        [Parameter("Lookback (Bars)", DefaultValue = 200, MinValue = 10)]
        public int Lookback { get; set; }

        [Parameter("Threshold (Pips)", DefaultValue = 15.0)]
        public double ThresholdPips { get; set; }

        protected override void Initialize()
        {
            // Initialization happens here if needed
        }

        public override void Calculate(int index)
        {
            // Ensure we have enough historical data to look back 2 candles
            if (index < 2) return;

            // To keep the platform running lightning-fast, we only scan the recent 'Lookback' window
            if (Bars.Count - index > Lookback) return;

            // cTrader automatically handles 4 vs 5 digit brokers using Symbol.PipSize
            double thresholdPrice = ThresholdPips * Symbol.PipSize;

            // Prices for the impulsive breakout candle (index - 1)
            double open1 = Bars.OpenPrices[index - 1];
            double close1 = Bars.ClosePrices[index - 1];
            
            // Prices for the actual Order Block candle (index - 2)
            double open2 = Bars.OpenPrices[index - 2];
            double close2 = Bars.ClosePrices[index - 2];
            double high2 = Bars.HighPrices[index - 2];
            double low2 = Bars.LowPrices[index - 2];

            // 1. Identify Bullish Order Block (A massive move UP on the previous candle)
            if (close1 - open1 > thresholdPrice)
            {
                // The candle right before the explosion MUST have been a bearish down-candle
                if (close2 < open2)
                {
                    string bullName = "OB_Bull_" + index;
                    // Draw a semi-transparent green box over the origin of the move
                    var rect = Chart.DrawRectangle(bullName, index - 2, high2, index, low2, Color.FromArgb(70, Color.Green));
                    rect.IsFilled = true;
                }
            }

            // 2. Identify Bearish Order Block (A massive dump DOWN on the previous candle)
            if (open1 - close1 > thresholdPrice)
            {
                // The candle right before the dump MUST have been a bullish up-candle
                if (close2 > open2)
                {
                    string bearName = "OB_Bear_" + index;
                    // Draw a semi-transparent red box over the origin of the move
                    var rect = Chart.DrawRectangle(bearName, index - 2, high2, index, low2, Color.FromArgb(70, Color.Red));
                    rect.IsFilled = true;
                }
            }
        }
    }
}

Pro Tip for cTrader:

Because IC Markets cTrader runs directly through standard FIX API routing, the price feeds can be highly volatile on lower timeframes. If your chart suddenly gets flooded with too many boxes on the 1-minute timeframe, simply increase the Threshold (Pips) parameter slightly in the indicator settings to filter out the "noise" and only show the true institutional footprints.