Indicator · Pine Script v6 · Own pane

Fakeout Filter [trugurpala]

by trugurpala

The Fakeout Filter indicator calculates a four-layer signal quality score ranging from 0 to 4 to evaluate trade setups.

View on GitHub

Repaints

GitHub stars4on the repository
Pine versionv6current
Lines of code111
Settings9inputs
LicenceMIT
Last update2 months ago3 Aug 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

111 lines of Pine Script v6 from examples/indicators/18_fakeout_filter.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

18_fakeout_filter.pine
//@version=6
// Fakeout Filter Indicator — 4-Layer Signal Quality
// Author: Ugur Pala · github.com/trugurpala/pinescriptv6
// TradingView: https://tr.tradingview.com/u/trugurpala/
//
// TR: 4 katmanlı sinyal kalitesi filtresi:
//     1. Hacim onayı (Volume Confirmation)
//     2. Bar onayı (Bar Confirmation)
//     3. HTF trend filtresi (Multi-Timeframe Filter)
//     4. ATR gürültü filtresi (ATR Noise Filter)
//     Skor 0-4: 3+ = Güçlü sinyal / 2 = Orta / 0-1 = Zayıf
//
// EN: 4-layer signal quality filter:
//     1. Volume confirmation
//     2. Bar confirmation
//     3. HTF trend filter
//     4. ATR noise filter
//     Score 0-4: 3+ = Strong signal / 2 = Medium / 0-1 = Weak
//
// Önerilen: Bu indikatörü stratejilerinize filtre olarak ekleyin.
// Recommended: Add this indicator as a filter to your strategies.
indicator("Fakeout Filter [trugurpala]", overlay=false, max_bars_back=500)

// ── Inputs ───────────────────────────────────────────────────────────────────
string htfTF    = input.string("60",  "HTF Timeframe",
    options=["15","30","60","240","D"],
    tooltip="Trend yönü için üst TF / Upper TF for trend direction")
int    htfLen   = input.int(50,  "HTF EMA Length",   minval=10)
int    volLen   = input.int(20,  "Volume MA Length",  minval=5)
float  volMult  = input.float(1.5, "Volume Mult",    step=0.1,
    tooltip="Hacim ortalamanın kaç katı olmalı / How many x of volume avg")
int    atrLen   = input.int(14,  "ATR Length",        minval=1)
float  atrMult  = input.float(0.3, "ATR Min Move",   step=0.05,
    tooltip="Minimum hareket (ATR katı) / Min move (ATR multiple)")
int    fastLen  = input.int(9,   "Fast EMA",          minval=1)
int    slowLen  = input.int(21,  "Slow EMA",          minval=1)
int    minScore = input.int(3,   "Min Score to Trade", minval=1, maxval=4,
    tooltip="Kaç filtreden geçmeli / How many filters must pass")

// ── Calculations ─────────────────────────────────────────────────────────────
float fastEma = ta.ema(close, fastLen)
float slowEma = ta.ema(close, slowLen)
float atrVal  = ta.atr(atrLen)
float volAvg  = ta.sma(volume, volLen)

// [1] + lookahead_on is a confirmed HTF pattern only when the requested timeframe is higher than the chart; this code does not enforce that relation.
float htfEma  = request.security(syminfo.tickerid, htfTF,
    ta.ema(close, htfLen)[1], lookahead=barmerge.lookahead_on)

// ── 4 Filtre / 4 Filters ─────────────────────────────────────────────────────
// F1: Hacim / Volume
bool f1_vol    = volume > volAvg * volMult

// F2: HTF Trend
bool f2_htf    = close > htfEma   // genel yön yukarı / general direction up

// F3: ATR Gürültü / Noise
bool f3_atr    = math.abs(close - close[1]) > atrVal * atrMult

// F4: EMA Hizalama / Alignment
bool f4_align  = fastEma > slowEma

// ── Skor / Score ──────────────────────────────────────────────────────────────
int score = (f1_vol   ? 1 : 0)
          + (f2_htf   ? 1 : 0)
          + (f3_atr   ? 1 : 0)
          + (f4_align ? 1 : 0)

bool strongSignal = score >= minScore

// ── Raw Signal ───────────────────────────────────────────────────────────────
bool rawLong  = ta.crossover(fastEma, slowEma)
bool rawShort = ta.crossunder(fastEma, slowEma)

bool filtLong  = rawLong  and strongSignal
bool filtShort = rawShort and (score <= (4 - minScore))  // ters yönde düşük skor

// ── Visuals ──────────────────────────────────────────────────────────────────
// Skor histogram
color scoreCol = score >= 3 ? color.new(color.green,  20)
               : score == 2 ? color.new(color.orange, 20)
               :               color.new(color.red,   40)
plot(score, "Signal Score", scoreCol, style=plot.style_histogram, linewidth=4)

// Filtre çizgileri
hline(minScore, "Min Score",  color.new(color.green, 40), hline.style_dashed)
hline(2,        "Medium",     color.new(color.orange,50), hline.style_dotted)
hline(1,        "Weak",       color.new(color.red,   50), hline.style_dotted)
hline(0,        "Zero",       color.new(color.gray,  60))

// Filtre durumu göstergesi
var table t = table.new(position.top_right, 2, 5, border_width=1)
if barstate.islast
    table.cell(t, 0, 0, "Filter",   text_color=color.gray,  bgcolor=color.new(color.gray, 90))
    table.cell(t, 1, 0, "Status",   text_color=color.gray,  bgcolor=color.new(color.gray, 90))
    table.cell(t, 0, 1, "F1 Volume", text_size=size.small,  bgcolor=color.new(color.gray, 85))
    table.cell(t, 1, 1, f1_vol ? "✓ ON" : "✗ OFF",
        text_color=f1_vol ? color.green : color.red, bgcolor=color.new(color.gray, 85))
    table.cell(t, 0, 2, "F2 HTF",   text_size=size.small,  bgcolor=color.new(color.gray, 85))
    table.cell(t, 1, 2, f2_htf ? "✓ ON" : "✗ OFF",
        text_color=f2_htf ? color.green : color.red, bgcolor=color.new(color.gray, 85))
    table.cell(t, 0, 3, "F3 ATR",   text_size=size.small,  bgcolor=color.new(color.gray, 85))
    table.cell(t, 1, 3, f3_atr ? "✓ ON" : "✗ OFF",
        text_color=f3_atr ? color.green : color.red, bgcolor=color.new(color.gray, 85))
    table.cell(t, 0, 4, "F4 EMA",   text_size=size.small,  bgcolor=color.new(color.gray, 85))
    table.cell(t, 1, 4, f4_align ? "✓ ON" : "✗ OFF",
        text_color=f4_align ? color.green : color.red, bgcolor=color.new(color.gray, 85))

// Alert
alertcondition(filtLong,  "Filtered Long",  "Fakeout Filter: LONG signal — Score: {{plot_0}}")
alertcondition(filtShort, "Filtered Short", "Fakeout Filter: SHORT signal — Score: {{plot_0}}")

Overview

Fakeout Filter [trugurpala] assesses four conditions: volume expansion above a moving average multiple, alignment with a higher timeframe EMA trend, price move exceeding an ATR threshold, and fast versus slow EMA alignment. Plotted in a separate pane below the chart, it highlights strong setups when the score reaches a user-defined threshold. Inputs allow customization of timeframe settings, EMA lengths, ATR multiples, and volume filters. It uses higher-timeframe data with lookahead enabled.

Details

Published by

trugurpala on GitHub

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Trend, Volume, Volatility & bands, Moving averages

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)
  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Topics

aialgorithmic-tradingclaude-codecodexcoding-agentsgithub-copilotopen-sourcepine-scriptpine-script-v6technical-analysis

Settings

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

SettingTypeDefaultVariable
HTF Timeframestring60htfTF
HTF EMA Lengthint50htfLen
Volume MA Lengthint20volLen
Volume Multfloat1.5volMult
ATR Lengthint14atrLen
ATR Min Movefloat0.3atrMult
Fast EMAint9fastLen
Slow EMAint21slowLen
Min Score to Tradeint3minScore
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

Adaptive MA Slope

by capissimo
114 stars

This indicator calculates Kaufman's Adaptive Moving Average (KAMA) on a chosen price source and determines trend direction based on the slope across a configurable lookback window. Signals can be filtered by short-term volatility expansion using ATR comparison

Indicator v4 Moving averagesTrend
Updated 1 year ago · None stated GitHub repository of Adaptive MA Slope
9 stars

This indicator plots a volume-weighted moving average as a central trend baseline and surrounds it with ATR-based volatility bands. It colors the trend and optional price bars according to whether price is on the bullish or bearish side of those bands. Users c

Indicator v6 TrendMoving averages
Updated 4 months ago · MIT GitHub repository of Volume Weighted Trend [QuantAlgo]

EMA System

by eddiebelaval
7 stars

EMA System plots four exponential moving averages on the price chart and marks a long-only pullback setup. It treats price above the 200 EMA and the 21 EMA above the 50 EMA as a valid trend, then flags a buy when price is near the 21 EMA, volume is below its s

Indicator v6 TrendMoving averages
Updated 3 months ago · None stated GitHub repository of EMA System

BOLL-20-50 TARAMA

by gocaman
3 stars

Calculates 50-period and 200-period Exponential Moving Averages alongside standard and wide Bollinger Bands. It generates buy and sell signal labels on the chart when the Bollinger Band basis crosses above or below the 50 EMA. The script also includes volume-w

Indicator v5 Moving averagesVolatility & bands
Updated today · None stated GitHub repository of BOLL-20-50 TARAMA

Kell + Minervini VCP

by mirkothepirko
2 stars

This price-chart indicator combines Oliver Kell moving-average phases with Minervini volatility contraction. It plots EMA 10, 20, 50 and 200 and can require the SMA 50, 150 and 200 trend template. It flags a wedge pop above EMA 10 after an EMA 20 cross, pullba

Indicator v6 TrendMoving averages
Updated 3 months ago · Custom licence GitHub repository of Kell + Minervini VCP
2 stars

The Multi EMA + VWAP Combo indicator consolidates five Exponential Moving Averages (EMAs) and a Volume Weighted Average Price (VWAP) into a single chart overlay. It calculates five configurable EMAs (defaulting to 9, 21, 50, 100, and 200 periods) to track mult

Indicator v6 Moving averagesTrend
Updated 1 year ago · None stated GitHub repository of Multi EMA + VWAP Combo

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