//@version=6
// Crude Oil (CL) — ATR Momentum + Session Filter
// Author: Ugur Pala · github.com/trugurpala/pinescriptv6
// TradingView: https://tr.tradingview.com/u/trugurpala/
//
// TR: Yüksek ATR momentum ile yön kırılması üzerine işlem yapar.
// Çarşamba EIA stok verisi saatlerinden kaçınır (10:30 ET).
// Seans sonu tüm pozisyonlar kapatılır.
// EN: Trades directional breakout on high ATR momentum.
// Avoids Wednesday EIA inventory release (10:30 ET).
// All positions closed at session end.
//
// Sembol / Symbol: NYMEX:CL1!
// Önerilen TF / Recommended TF: 5M, 15M
strategy("CL Crude Oil Momentum [trugurpala]",
overlay = true,
initial_capital = 10000,
default_qty_type = strategy.fixed,
default_qty_value = 1,
commission_type = strategy.commission.cash_per_contract,
commission_value = 5.0,
slippage = 2)
// ── Inputs ───────────────────────────────────────────────────────────────────
int fastLen = input.int(9, "Fast EMA", minval=1)
int slowLen = input.int(21, "Slow EMA", minval=1)
int atrLen = input.int(14, "ATR", minval=1)
float momMult = input.float(1.2, "ATR Momentum Mult", step=0.1)
float slMult = input.float(2.0, "SL Mult", step=0.1)
float tpMult = input.float(2.5, "TP Mult", step=0.1)
bool avoidEIA = input.bool(true, "Avoid EIA Window (Wed 10:00-11:00 ET)")
// ── En Aktif Seans: 09:00–14:30 ET ──────────────────────────────────────────
bool inSession = not na(time(timeframe.period, "0900-1430", "America/New_York"))
bool sesEnd = inSession[1] and not inSession
if sesEnd
strategy.close_all(comment="Session End")
// EIA penceresi — Çarşamba 10:00-11:00 ET
bool eiaWindow = avoidEIA
and dayofweek == dayofweek.wednesday
and not na(time(timeframe.period, "1000-1100", "America/New_York"))
// ── Calculations ─────────────────────────────────────────────────────────────
float fastEma = ta.ema(close, fastLen)
float slowEma = ta.ema(close, slowLen)
float atrVal = ta.atr(atrLen)
float atrAvg = ta.sma(atrVal, 20)
bool highMom = atrVal > atrAvg * momMult
bool bullCross = ta.crossover(fastEma, slowEma) and highMom and inSession and not eiaWindow
bool bearCross = ta.crossunder(fastEma, slowEma) and highMom and inSession and not eiaWindow
// ── Entries ──────────────────────────────────────────────────────────────────
if bullCross
strategy.entry("Long", strategy.long)
strategy.exit("Long Exit", "Long",
stop = close - slMult * atrVal,
limit = close + tpMult * atrVal)
if bearCross
strategy.entry("Short", strategy.short)
strategy.exit("Short Exit", "Short",
stop = close + slMult * atrVal,
limit = close - tpMult * atrVal)
// ── Visuals ──────────────────────────────────────────────────────────────────
plot(fastEma, "Fast", fastEma > slowEma ? color.green : color.red, linewidth=2)
plot(slowEma, "Slow", fastEma > slowEma ? color.lime : color.orange, linewidth=2)
bgcolor(eiaWindow ? color.new(color.red, 88) : na, title="EIA Window")
bgcolor(not inSession ? color.new(color.gray, 96) : na, title="Off Hours")
plotshape(bullCross, "Long", shape.triangleup, location.belowbar, color.green, size=size.small)
plotshape(bearCross, "Short", shape.triangledown, location.abovebar, color.red, size=size.small)
// ── Alerts (alert() — strategy içinde çalışır) ───────────────────────────────
if bullCross
alert("CL Crude Oil Long — " + str.tostring(close, "#.##"), alert.freq_once_per_bar)
if bearCross
alert("CL Crude Oil Short — " + str.tostring(close, "#.##"), alert.freq_once_per_bar)
Overview
CL Crude Oil Momentum [trugurpala] enters long or short positions when a fast exponential moving average crosses a slow exponential moving average, provided that current Average True Range exceeds its moving average by a specified multiplier. Entries are restricted to active trading hours between 09:00 and 14:30 ET and optionally filter out Wednesday EIA inventory release times. Positions use ATR-based stop loss and take profit orders, and any remaining open trades are automatically closed at the end of the session.
Exponential moving average crossover signals
ATR momentum volatility filter
Session time window with automatic close at session end
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
ATR Momentum Mult
float
1.2
momMult
SL Mult
float
2.0
slMult
TP Mult
float
2.5
tpMult
Avoid EIA Window (Wed 10:00-11:00 ET)
bool
true
avoidEIA
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 executes long and short trades on the price chart by combining multi-timeframe smoothed Heikin-Ashi trends, higher-timeframe Hull Moving Average variations, and an ATR-based trailing stop. Users can adjust timeframes, smoothing lengths, Hull form
This strategy draws two moving averages on the price chart and uses their bias to open long or short trades. It places the stop beyond a swing high or low using an ATR risk multiple, then sets a limit exit from the reward-to-risk ratio. An optional ATR trail c
The IBKR Safe Forex Strategy is a Pine Script v6 strategy that trades forex pairs using crossovers of 10-period and 50-period EMAs, filtered by a 200-period EMA and restricted to London or New York session overlap. It enters long positions on fast EMA above sl
This Pine Script v6 strategy uses multi-timeframe analysis to identify intraday trends and generate trading signals. It requests higher-timeframe data for trend context via EMAs and Supertrend direction. On the local timeframe it plots EMA cross signals for lo
This strategy template provides a modular foundation for building TradingView v6 backtests. It uses a placeholder Exponential Moving Average crossover signal combined with customizable filters for higher-timeframe trend alignment, volatility regime thresholds,
This mean-reversion strategy plots Bollinger Bands and a long-term moving average directly on the price chart. It enters trades when price candles penetrate the outer Bollinger Bands beyond a user-defined body percentage, anticipating a price reversal. Entries