Indicator · Pine Script v5 · On the chart

Smart Money / LIT - M1 Structure & OB

by ifreddyman2014-tech· code credited to Claude AI - Smart Money / LIT Strategy Indicator

This overlay indicator marks market structure on the price chart.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code223
Settings10inputs
LicenceNone statedfile: MPL-2.0
Last update8 months ago14 Feb 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

223 lines of Pine Script v5 from Smart_Money_LIT_M1_Indicator.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Smart_Money_LIT_M1_Indicator.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Claude AI - Smart Money / LIT Strategy Indicator

//@version=5
indicator("Smart Money / LIT - M1 Structure & OB", overlay=true, max_boxes_count=50, max_labels_count=100)

// ═══════════════════════════════════════════════════════════════════════════════
// НАСТРОЙКИ / INPUTS
// ═══════════════════════════════════════════════════════════════════════════════

// 1. СВИНГИ (Pivots)
pivotLength = input.int(5, "Pivot Length (свечей слева/справа)", minval=2, maxval=20,
     tooltip="Количество свечей для подтверждения локального максимума/минимума")

// 2. DISPLACEMENT (Импульс)
displacementFactor = input.float(1.5, "Displacement Factor (коэффициент импульса)", minval=1.0, maxval=5.0, step=0.1,
     tooltip="Тело свечи должно быть больше среднего тела последних 10 свечей × этот коэффициент")
avgBodyPeriod = input.int(10, "Средний период для расчёта тела свечи", minval=5, maxval=50)

// 3. ВИЗУАЛИЗАЦИЯ
showBOS = input.bool(true, "Показать BOS Labels", group="Визуализация")
showOB = input.bool(true, "Показать Order Blocks", group="Визуализация")

bullishOBColor = input.color(color.new(color.blue, 80), "Цвет Bullish OB", group="Визуализация")
bearishOBColor = input.color(color.new(color.red, 80), "Цвет Bearish OB", group="Визуализация")

bosLabelSize = input.string("small", "Размер BOS Label", options=["tiny", "small", "normal"], group="Визуализация")

// ═══════════════════════════════════════════════════════════════════════════════
// ФУНКЦИИ / LOGIC
// ═══════════════════════════════════════════════════════════════════════════════

// Расчёт тела свечи
candleBody = math.abs(close - open)

// Средний размер тела за последние N свечей
avgBody = ta.sma(candleBody, avgBodyPeriod)

// Проверка на DISPLACEMENT (импульсная свеча)
isDisplacement = candleBody > (avgBody * displacementFactor)

// Определение направления свечи
isBullishCandle = close > open
isBearishCandle = close < open

// ═══════════════════════════════════════════════════════════════════════════════
// 1. ОПРЕДЕЛЕНИЕ СВИНГОВ (PIVOTS)
// ═══════════════════════════════════════════════════════════════════════════════

// Подтверждённые пивоты (они появляются с задержкой = pivotLength)
pivotHigh = ta.pivothigh(high, pivotLength, pivotLength)
pivotLow = ta.pivotlow(low, pivotLength, pivotLength)

// Переменные для хранения последнего подтверждённого пивота
var float lastPivotHigh = na
var int lastPivotHighBar = na

var float lastPivotLow = na
var int lastPivotLowBar = na

// Обновляем пивоты
if not na(pivotHigh)
    lastPivotHigh := pivotHigh
    lastPivotHighBar := bar_index - pivotLength

if not na(pivotLow)
    lastPivotLow := pivotLow
    lastPivotLowBar := bar_index - pivotLength

// ═══════════════════════════════════════════════════════════════════════════════
// 2 & 3. STRICT BOS С DISPLACEMENT
// ═══════════════════════════════════════════════════════════════════════════════

// BUY BOS: Close пробивает последний Pivot High + есть displacement
buyBOS = not na(lastPivotHigh) and close > lastPivotHigh and isDisplacement and isBullishCandle

// SELL BOS: Close пробивает последний Pivot Low + есть displacement
sellBOS = not na(lastPivotLow) and close < lastPivotLow and isDisplacement and isBearishCandle

// ═══════════════════════════════════════════════════════════════════════════════
// 4. ПОИСК ORDER BLOCK (OB)
// ═══════════════════════════════════════════════════════════════════════════════

// Для BUY BOS: ищем последнюю медвежью свечу перед импульсом вверх
var int bullishOBBar = na
var float bullishOBTop = na
var float bullishOBBottom = na

if buyBOS
    // Ищем последнюю медвежью свечу перед текущим баром
    for i = 1 to 20
        if close[i] < open[i]  // медвежья свеча
            bullishOBBar := bar_index - i
            // Тело свечи (не фитили!)
            bullishOBTop := open[i]       // верх тела медвежьей свечи
            bullishOBBottom := close[i]   // низ тела медвежьей свечи
            break

// Для SELL BOS: ищем последнюю бычью свечу перед импульсом вниз
var int bearishOBBar = na
var float bearishOBTop = na
var float bearishOBBottom = na

if sellBOS
    // Ищем последнюю бычью свечу перед текущим баром
    for i = 1 to 20
        if close[i] > open[i]  // бычья свеча
            bearishOBBar := bar_index - i
            // Тело свечи (не фитили!)
            bearishOBTop := close[i]      // верх тела бычьей свечи
            bearishOBBottom := open[i]    // низ тела бычьей свечи
            break

// ═══════════════════════════════════════════════════════════════════════════════
// 5. ВИЗУАЛИЗАЦИЯ
// ═══════════════════════════════════════════════════════════════════════════════

// --- BOS LABELS ---
if showBOS and buyBOS
    label.new(
         bar_index,
         low,
         "BOS ↑",
         color=color.new(color.blue, 0),
         style=label.style_label_up,
         textcolor=color.white,
         size=bosLabelSize == "tiny" ? size.tiny : bosLabelSize == "small" ? size.small : size.normal
     )

if showBOS and sellBOS
    label.new(
         bar_index,
         high,
         "BOS ↓",
         color=color.new(color.red, 0),
         style=label.style_label_down,
         textcolor=color.white,
         size=bosLabelSize == "tiny" ? size.tiny : bosLabelSize == "small" ? size.small : size.normal
     )

// --- ORDER BLOCKS (BOXES) ---

// Bullish OB (для BUY)
if showOB and buyBOS and not na(bullishOBBar)
    box.new(
         left=bullishOBBar,
         top=bullishOBTop,
         right=bar_index + 50,  // продляем вправо
         bottom=bullishOBBottom,
         border_color=color.new(color.blue, 50),
         bgcolor=bullishOBColor,
         border_width=1,
         extend=extend.right,
         text="OB",
         text_color=color.blue,
         text_size=size.small
     )

// Bearish OB (для SELL)
if showOB and sellBOS and not na(bearishOBBar)
    box.new(
         left=bearishOBBar,
         top=bearishOBTop,
         right=bar_index + 50,  // продляем вправо
         bottom=bearishOBBottom,
         border_color=color.new(color.red, 50),
         bgcolor=bearishOBColor,
         border_width=1,
         extend=extend.right,
         text="OB",
         text_color=color.red,
         text_size=size.small
     )

// ═══════════════════════════════════════════════════════════════════════════════
// ВИЗУАЛИЗАЦИЯ ПИВОТОВ (опционально, для отладки)
// ═══════════════════════════════════════════════════════════════════════════════

showPivots = input.bool(false, "Показать Pivot High/Low", group="Дополнительно")

plotshape(
     showPivots and not na(pivotHigh) ? pivotHigh : na,
     title="Pivot High",
     style=shape.triangledown,
     location=location.abovebar,
     color=color.new(color.red, 30),
     size=size.tiny
 )

plotshape(
     showPivots and not na(pivotLow) ? pivotLow : na,
     title="Pivot Low",
     style=shape.triangleup,
     location=location.belowbar,
     color=color.new(color.green, 30),
     size=size.tiny
 )

// ═══════════════════════════════════════════════════════════════════════════════
// ИНФОРМАЦИЯ НА ГРАФИКЕ
// ═══════════════════════════════════════════════════════════════════════════════

// Показываем текущий размер тела и средний (для понимания displacement)
showDebug = input.bool(false, "Debug: показать размер тела свечи", group="Дополнительно")

if showDebug
    var table debugTable = table.new(position.top_right, 2, 3, border_width=1)

    if barstate.islast
        table.cell(debugTable, 0, 0, "Текущее тело:", text_color=color.white, bgcolor=color.new(color.gray, 50))
        table.cell(debugTable, 1, 0, str.tostring(candleBody, "#.#####"), text_color=color.yellow, bgcolor=color.new(color.gray, 50))

        table.cell(debugTable, 0, 1, "Среднее тело:", text_color=color.white, bgcolor=color.new(color.gray, 50))
        table.cell(debugTable, 1, 1, str.tostring(avgBody, "#.#####"), text_color=color.white, bgcolor=color.new(color.gray, 50))

        table.cell(debugTable, 0, 2, "Displacement?:", text_color=color.white, bgcolor=color.new(color.gray, 50))
        table.cell(debugTable, 1, 2, isDisplacement ? "✓ ДА" : "✗ НЕТ",
             text_color=isDisplacement ? color.lime : color.red,
             bgcolor=color.new(color.gray, 50))

// ═══════════════════════════════════════════════════════════════════════════════
// КОНЕЦ СКРИПТА
// ═══════════════════════════════════════════════════════════════════════════════

Overview

Smart Money / LIT - M1 Structure & OB finds swing highs and lows with a configurable pivot length, flags displacement candles whose body exceeds the recent average body by a set factor, and can label breaks of structure. It also draws bullish and bearish order-block boxes with user colors. Optional settings show the pivots and the candle body size for debugging. The visible script does not define entries, exits, or stop rules.

Details

Published by

ifreddyman2014-tech on GitHub

Code credit

Claude AI - Smart Money / LIT Strategy Indicator, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

SMC / ICT / price action, Support & resistance

Markets

Any symbol

Timeframes

M1-M5

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Pivot Length (свечей слева/справа)int5pivotLength
Displacement Factor (коэффициент импульса)float1.5displacementFactor
Средний период для расчёта тела свечиint10avgBodyPeriod
Показать BOS LabelsbooltrueshowBOS
Показать Order BlocksbooltrueshowOB
Цвет Bullish OBcolorcolor.new(color.blue, 80)bullishOBColor
Цвет Bearish OBcolorcolor.new(color.red, 80)bearishOBColor
Размер BOS LabelstringsmallbosLabelSize
Показать Pivot High/LowboolfalseshowPivots
Debug: показать размер тела свечиboolfalseshowDebug
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

ICT Equal Highs and Lows

by ArunKBhaskar
575 stars

This overlay indicator finds pivot highs and lows on the price chart and compares the last two highs and the last two lows. When the percentage difference between a pair is below the Equal HL threshold, it treats them as equal levels and draws a box. Left and

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Equal Highs and Lows

DE-tracker

by Allen1212
303 stars

This indicator plots labels on the TradingView price chart to mark ARK Invest's buy and sell trades for the DE stock. Buy transactions appear in green with X1 or X2 multipliers showing the number of ARK ETFs involved on the same day; sells appear in red. The m

Indicator v4 Support & resistanceSMC / ICT / price action
Updated 2 years ago · None stated GitHub repository of DE-tracker

This Pine Script indicator plots a ZigZag on the price chart. It identifies reversal points when price moves more than a set percentage from the last pivot. The script calculates forecasts using zigzag data and labels detected geometric patterns including harm

Indicator v4 TrendSupport & resistance

Golden Bullet Strategy

by TradersPost
218 stars

The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh

Indicator v6 SMC / ICT / price actionSessions & time
Updated 3 months ago · None stated GitHub repository of Golden Bullet Strategy

Open Source Fractal

by cantolab
183 stars

This indicator implements the Fractal Model concept to plot market structure shifts, liquidity sweeps, and Change in State of Delivery (CISD) levels. It overlays custom higher-timeframe candle previews, open prices, and time markers directly on the price chart

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · MIT GitHub repository of Open Source Fractal

Swing Failure Signals

by Ganador1
154 stars

This indicator calculates pivot highs and pivot lows to detect liquidity sweeps and Swing Failure Patterns. It identifies when price breaks past recent key swing highs or lows within a configurable historical window, then looks for a quick reversal or change i

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · Apache-2.0 GitHub repository of Swing Failure Signals

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers