//@version=6
// Fakeout-Confirmed Strategy — 4 Filter Layers
// Author: Ugur Pala · github.com/trugurpala/pinescriptv6
// TradingView: https://tr.tradingview.com/u/trugurpala/
//
// TR: Dört yapılandırılabilir fakeout filtresi kullanan sinyal stratejisi.
// EN: Signal strategy with four configurable fakeout filters.
// Önerilen TF: 15M, 1H, 4H
// LESSONS_LEARNED kontrol listesi:
// ✅ alertcondition() yok → alert() kullanıldı
// ✅ calc_on_every_tick yok: bar-close calculation setting; fill, data, and cost assumptions remain.
// ✅ barstate.isconfirmed + table → uyarısız, kapanmış barda güncellenir
// ✅ Çok satırlı "and" yok → tek satır
// ✅ [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.
strategy("Fakeout-Confirmed Strategy [trugurpala]",
overlay = true,
initial_capital = 10000,
default_qty_type = strategy.percent_of_equity,
default_qty_value = 5,
commission_type = strategy.commission.percent,
commission_value = 0.1,
slippage = 2)
// ── Inputs — Strateji ─────────────────────────────────────────────────────────
int fastLen = input.int(9, "Fast EMA", minval=1, group="Strateji / Strategy")
int slowLen = input.int(21, "Slow EMA", minval=1, group="Strateji / Strategy")
int atrLen = input.int(14, "ATR", minval=1, group="Strateji / Strategy")
float slMult = input.float(2.0, "SL (ATR×)", step=0.1, group="Strateji / Strategy")
float tpMult = input.float(3.0, "TP (ATR×)", step=0.1, group="Strateji / Strategy")
bool longOnly = input.bool(false, "Long Only", group="Strateji / Strategy")
// ── Inputs — F1: Hacim ───────────────────────────────────────────────────────
bool useVol = input.bool(true, "Hacim Filtresi", group="F1: Hacim / Volume")
int volLen = input.int(20, "Volume MA", minval=5, group="F1: Hacim / Volume")
float volMult = input.float(1.5, "Volume Mult", step=0.1, group="F1: Hacim / Volume")
// ── Inputs — F2: Bar Onayı ───────────────────────────────────────────────────
bool useBar = input.bool(true, "Bar Onayı", group="F2: Bar")
int barConf = input.int(1, "Kaç Bar", minval=1, maxval=5, group="F2: Bar")
// ── Inputs — F3: HTF Trend ───────────────────────────────────────────────────
bool useHTF = input.bool(true, "HTF Filtresi", group="F3: HTF")
string htfTF = input.string("60", "HTF TF", options=["15","30","60","240","D"], group="F3: HTF")
int htfLen = input.int(50, "HTF EMA", minval=10, group="F3: HTF")
// ── Inputs — F4: ATR Gürültü ─────────────────────────────────────────────────
bool useATR = input.bool(true, "ATR Gürültü", group="F4: ATR")
float atrNoise = input.float(0.3, "Min Move (ATR×)", step=0.05, group="F4: ATR")
// ── Hesaplamalar ──────────────────────────────────────────────────────────────
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 ─────────────────────────────────────────────────────────────────
bool f1_vol = not useVol or volume > volAvg * volMult
bool f2_htfL = not useHTF or close > htfEma
bool f2_htfS = not useHTF or close < htfEma
bool f4_noise = not useATR or math.abs(close - close[1]) > atrVal * atrNoise
// ── Ham Sinyaller ─────────────────────────────────────────────────────────────
bool rawLong = ta.crossover(fastEma, slowEma)
bool rawShort = ta.crossunder(fastEma, slowEma)
// ── Bar Onayı ─────────────────────────────────────────────────────────────────
var int barCountL = -1
var int barCountS = -1
if rawLong
barCountL := 0
if rawShort
barCountS := 0
if barCountL >= 0 and barCountL < barConf
barCountL += 1
if barCountS >= 0 and barCountS < barConf
barCountS += 1
bool barConfL = not useBar or (barCountL == barConf and close > slowEma)
bool barConfS = not useBar or (barCountS == barConf and close < slowEma)
// ── Final Sinyaller — LESSONS_LEARNED: tek satır, "and" başta değil ──────────
bool longEntry = (useBar ? barConfL : rawLong) and f1_vol and f2_htfL and f4_noise
bool shortEntry = (useBar ? barConfS : rawShort) and f1_vol and f2_htfS and f4_noise and not longOnly
// ── Girişler ──────────────────────────────────────────────────────────────────
if longEntry and strategy.position_size == 0
strategy.entry("Long", strategy.long)
strategy.exit("Long Exit", "Long",
stop = close - slMult * atrVal,
limit = close + tpMult * atrVal,
comment_loss = "SL",
comment_profit = "TP")
if shortEntry and strategy.position_size == 0
strategy.entry("Short", strategy.short)
strategy.exit("Short Exit", "Short",
stop = close + slMult * atrVal,
limit = close - tpMult * atrVal,
comment_loss = "SL",
comment_profit = "TP")
// ── Alertler — LESSONS_LEARNED: alert() kullan, alertcondition() değil ───────
if longEntry
alert("FC LONG — " + syminfo.ticker + " @ " + str.tostring(close, "#.##"), alert.freq_once_per_bar)
if shortEntry
alert("FC SHORT — " + syminfo.ticker + " @ " + str.tostring(close, "#.##"), alert.freq_once_per_bar)
// ── Görseller ────────────────────────────────────────────────────────────────
plot(fastEma, "Fast EMA", fastEma > slowEma ? color.green : color.red, linewidth=1)
plot(slowEma, "Slow EMA", fastEma > slowEma ? color.lime : color.orange, linewidth=2)
plot(htfEma, "HTF EMA", color.new(color.gray, 40), linewidth=1)
plotshape(longEntry, "Long", shape.triangleup, location.belowbar, color.green, size=size.normal)
plotshape(shortEntry, "Short", shape.triangledown, location.abovebar, color.red, size=size.normal)
plotshape(rawLong and not longEntry, "Raw Long (filtered)", shape.circle, location.belowbar, color.new(color.green, 70), size=size.tiny)
plotshape(rawShort and not shortEntry, "Raw Short (filtered)", shape.circle, location.abovebar, color.new(color.red, 70), size=size.tiny)
// ── Filtre Tablosu — barstate.isconfirmed, 0 warning ────────────────────────
var table ft = table.new(
position.top_right, 2, 6,
bgcolor = color.new(color.black, 70),
border_width = 2,
frame_color = color.new(color.gray, 50),
frame_width = 2)
if barstate.isconfirmed
// Başlık
table.cell(ft, 0, 0, "◈ FİLTRE",
bgcolor=color.new(color.navy, 20), text_color=color.white,
text_size=size.normal, text_halign=text.align_left, width=10)
table.cell(ft, 1, 0, "DURUM",
bgcolor=color.new(color.navy, 20), text_color=color.white,
text_size=size.normal, text_halign=text.align_center, width=7)
// F1 Hacim
table.cell(ft, 0, 1, "F1 Hacim",
bgcolor=color.new(color.gray, 80), text_color=color.white, text_size=size.normal)
table.cell(ft, 1, 1, useVol ? (f1_vol ? " ✓" : " ✗") : " OFF",
text_color=useVol ? (f1_vol ? color.lime : color.red) : color.gray,
bgcolor=color.new(color.gray, 80), text_size=size.large)
// F2 HTF
table.cell(ft, 0, 2, "F2 HTF Trend",
bgcolor=color.new(color.gray, 82), text_color=color.white, text_size=size.normal)
table.cell(ft, 1, 2, useHTF ? (f2_htfL ? " ✓" : " ✗") : " OFF",
text_color=useHTF ? (f2_htfL ? color.lime : color.red) : color.gray,
bgcolor=color.new(color.gray, 82), text_size=size.large)
// F3 Bar
table.cell(ft, 0, 3, "F3 Bar Onayı",
bgcolor=color.new(color.gray, 80), text_color=color.white, text_size=size.normal)
table.cell(ft, 1, 3, useBar ? (barConfL ? " ✓" : " ✗") : " OFF",
text_color=useBar ? (barConfL ? color.lime : color.red) : color.gray,
bgcolor=color.new(color.gray, 80), text_size=size.large)
// F4 ATR
table.cell(ft, 0, 4, "F4 ATR Gürültü",
bgcolor=color.new(color.gray, 82), text_color=color.white, text_size=size.normal)
table.cell(ft, 1, 4, useATR ? (f4_noise ? " ✓" : " ✗") : " OFF",
text_color=useATR ? (f4_noise ? color.lime : color.red) : color.gray,
bgcolor=color.new(color.gray, 82), text_size=size.large)
// Sinyal
string sigText = longEntry ? "▲ LONG" : shortEntry ? "▼ SHORT" : "— BEKLE"
color sigBg = longEntry ? color.new(color.green, 30) : shortEntry ? color.new(color.red, 30) : color.new(color.gray, 60)
color sigFg = longEntry ? color.lime : shortEntry ? color.red : color.silver
table.cell(ft, 0, 5, "◉ SİNYAL",
bgcolor=sigBg, text_color=color.white, text_size=size.large, text_halign=text.align_left)
table.cell(ft, 1, 5, sigText,
text_color=sigFg, bgcolor=sigBg, text_size=size.large, text_halign=text.align_center)
Overview
To reduce false signals, it applies four configurable fakeout filters: volume moving average threshold, consecutive bar confirmation, higher-timeframe EMA trend alignment, and minimum ATR move size. Strategy exits are managed using ATR-multiplier stop loss and take profit targets. Configurable inputs allow users to toggle long-only mode, adjust filter thresholds, and modify EMA lengths.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Fast EMA
int
9
fastLen
Slow EMA
int
21
slowLen
ATR
int
14
atrLen
SL (ATR×)
float
2.0
slMult
TP (ATR×)
float
3.0
tpMult
Long Only
bool
false
longOnly
Hacim Filtresi
bool
true
useVol
Volume MA
int
20
volLen
Volume Mult
float
1.5
volMult
Bar Onayı
bool
true
useBar
Kaç Bar
int
1
barConf
HTF Filtresi
bool
true
useHTF
Show all 16 settings
Setting
Type
Default
Variable
HTF TF
string
60
htfTF
HTF EMA
int
50
htfLen
ATR Gürültü
bool
true
useATR
Min Move (ATR×)
float
0.3
atrNoise
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.
This strategy overlays Supertrend-style ATR trailing stop levels on the price chart alongside multi-period moving averages, volume metrics, and Bollinger Bands. It flags trend direction changes using an ATR offset channel, plotting buy and sell signals directl
This strategy enters long or short when eight conditions align over the last two bars. It requires EMA 10 and EMA 55 alignment on the one-hour, four-hour and daily charts, a positive ADX slope, matching monitor direction, and price relative to a 400-bar point
This overlay strategy combines three distinct SuperTrend levels with multiple moving averages and volume profile analytics on the main price chart. It calculates trend directions using three configurable ATR periods and multipliers alongside SMA, EMA, and HMA
This overlay strategy enters long when a fast EMA crosses above a slow EMA, the candle closes above the fast EMA and above its open, and volume is at least a set multiple of its SMA. Position size defaults to 95 percent of equity with no pyramiding. It exits w
This strategy plots EMA 25 in yellow and EMA 100 in green on the price chart. It generates buy signals on EMA 25 crossing above EMA 100 when ATR length 14 rises over two prior bars and volume exceeds prior bar. It opens a long position of 1 unit on signal. It
The SuperTrend Regime Confluence strategy combines an adaptive SuperTrend indicator with market regime detection to generate trading signals. It computes a composite conviction score using an ADX regime lookback, a trend EMA, and a volume moving average. Trade