1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
Source Code
94 lines of Pine Script v6 from global-markets/22_dax_gap_fade.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
22_dax_gap_fade.pine
//@version=6
// DAX / FDAX Germany — Gap Fade + Xetra Session Strategy
// Author: Ugur Pala · github.com/trugurpala/pinescriptv6
// TradingView: https://tr.tradingview.com/u/trugurpala/
//
// TR: DAX'ın güniçi boşlukları (gap) kapatma eğiliminden faydalanır.
// Xetra seansında (09:00-17:30 CET) çalışır.
// NYSE açılışı volatilitesinden kaçınmak için 15:00 CET'te kapat.
// EN: Exploits DAX's strong tendency to fill intraday gaps.
// Active during Xetra session (09:00-17:30 CET).
// Positions closed at 15:00 CET to avoid NYSE open volatility.
//
// Sembol / Symbol: XETR:DAX / EUREX:FDAX1!
// Önerilen TF / Recommended TF: 5M, 15M
strategy("DAX Gap Fade [trugurpala]",
overlay = true,
initial_capital = 25000,
default_qty_type = strategy.fixed,
default_qty_value = 1,
commission_type = strategy.commission.cash_per_contract,
commission_value = 5.0,
slippage = 2)
// ── Inputs ───────────────────────────────────────────────────────────────────
float gapMult = input.float(0.3, "Min Gap (ATR mult)", step=0.1)
float atrMult = input.float(1.5, "SL ATR Mult", step=0.1)
float rrRatio = input.float(1.5, "R:R Ratio", step=0.1)
bool closeEarly = input.bool(true, "Close at 15:00 CET (before NYSE)")
// ── Xetra Seans: 09:00–17:30 CET ─────────────────────────────────────────────
bool inXetra = not na(time(timeframe.period, "0900-1730", "Europe/Berlin"))
bool xetraOpen = not na(time(timeframe.period, "0900-0902", "Europe/Berlin"))
bool preNYSE = closeEarly and not na(time(timeframe.period, "1500-1501", "Europe/Berlin"))
bool xetraClose = inXetra[1] and not inXetra
if xetraClose or preNYSE
strategy.close_all(comment="Session End")
// ── Gap Hesapla / Calculate Gap ───────────────────────────────────────────────
var float prevClose = na
var bool gapUp = false
var bool gapDown = false
float atrVal = ta.atr(14)
float minGap = gapMult * atrVal
// Gün başında gap belirle
if xetraOpen
float gapSize = open - nz(prevClose, open)
gapUp := gapSize > minGap
gapDown := gapSize < -minGap
else if not inXetra
gapUp := false
gapDown := false
// Önceki kapanışı sakla
if barstate.isconfirmed
prevClose := close
// ── Sinyaller ────────────────────────────────────────────────────────────────
// Gap Up → Short (gap kapanacak, fiyat aşağı gelecek)
bool shortSignal = gapUp and xetraOpen and strategy.position_size == 0
// Gap Down → Long (gap kapanacak, fiyat yukarı gelecek)
bool longSignal = gapDown and xetraOpen and strategy.position_size == 0
// ── Entries ──────────────────────────────────────────────────────────────────
if longSignal
float sl = open - atrMult * atrVal
strategy.entry("Long", strategy.long)
strategy.exit("Long Exit", "Long",
stop = sl,
limit = open + rrRatio * (open - sl))
if shortSignal
float sl = open + atrMult * atrVal
strategy.entry("Short", strategy.short)
strategy.exit("Short Exit", "Short",
stop = sl,
limit = open - rrRatio * (sl - open))
// ── Visuals ──────────────────────────────────────────────────────────────────
plot(not na(prevClose) ? prevClose : na, "Prev Close",
color.new(color.gray, 40), linewidth=1, style=plot.style_linebr)
bgcolor(gapUp ? color.new(color.red, 90) : na, title="Gap Up")
bgcolor(gapDown ? color.new(color.green, 90) : na, title="Gap Down")
bgcolor(not inXetra ? color.new(color.gray, 96) : na, title="Off Hours")
plotshape(longSignal, "Long", shape.triangleup, location.belowbar, color.green, size=size.normal)
plotshape(shortSignal, "Short", shape.triangledown, location.abovebar, color.red, size=size.normal)
// ── Alerts (alert() — strategy içinde çalışır) ───────────────────────────────
if longSignal
alert("DAX Gap Down Fade Long — " + str.tostring(close, "#.##"), alert.freq_once_per_bar)
if shortSignal
alert("DAX Gap Up Fade Short — " + str.tostring(close, "#.##"), alert.freq_once_per_bar)
Overview
At the 09:00 CET market open, it measures the opening price against the previous close relative to an ATR threshold. If a gap exceeds the threshold, it fades the move by going short on gaps up or long on gaps down. Trades use an ATR-based stop loss and take profit defined by a risk-to-reward ratio. An optional setting closes all positions at 15:00 CET prior to the NYSE open.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Min Gap (ATR mult)
float
0.3
gapMult
SL ATR Mult
float
1.5
atrMult
R:R Ratio
float
1.5
rrRatio
Close at 15:00 CET (before NYSE)
bool
true
closeEarly
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 the price chart to trade DAX futures during European market hours. It calculates exponential and simple moving averages, RSI, MACD, Bollinger Bands, ATR, and realized volatility to simulate VIX levels. Trades execute when session time fi
This strategy plots Bollinger bands and a simple moving average on the price chart. It opens a short when price crosses above the upper band while below the average, and a long when price crosses below the lower band while above the average. Entries are allowe
This strategy plots entry signals, stop loss, take profit levels, and an information panel directly on the price chart. It combines a relative strength index mean reversion model with ATR percentile thresholds to filter trades based on volatility conditions. T
The FTB Strategy is a short-only overlay strategy targeting EURUSD during the European session from 0200-0700. It enters short positions when filters confirm RSI overbought, a bullish prior bar close, or a high price level within lookback bars, combined with a
This mean-reversion trading strategy targets XAUUSD during the Asian trading session. It generates buy signals when price touches the lower Bollinger Band and RSI is oversold, and sell signals when price reaches the upper band and RSI is overbought. Trades are
This strategy draws Bollinger Bands on the price chart and enters long when both the open and the close are below the lower band. Mode S1 exits the same day at a 20 percent take profit or forces a close if that target is missed. Mode S2 can hold for a set numb