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
61 lines of Pine Script v6 from global-markets/05_eurusd_forex.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.
05_eurusd_forex.pine
//@version=6
// EUR/USD Forex Strategy — London + NY Session
// github.com/trugurpala/pinescriptv6 — Author: Ugur Pala
//
// TR: Sembol: FX:EURUSD / OANDA:EURUSD / FXCM:EURUSD
// EN: Symbol: FX:EURUSD / OANDA:EURUSD / FXCM:EURUSD
//
// En Aktif Seanslar / Most Active Sessions:
// London: 08:00–16:00 GMT
// New York: 13:00–21:00 GMT
// Overlap (en iyi): 13:00–16:00 GMT
strategy("EUR/USD Forex Strategy [trugurpala]",
overlay = true,
initial_capital = 10000,
default_qty_type = strategy.percent_of_equity,
default_qty_value = 2,
commission_type = strategy.commission.percent,
commission_value = 0.005, // ~0.5 pip spread
slippage = 1)
// ── 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 slMult = input.float(1.5, "SL Mult", step=0.1)
float tpMult = input.float(2.0, "TP Mult", step=0.1)
// ── London + NY Seans Filtresi ────────────────────────────────────────────────
bool london = not na(time(timeframe.period, "0800-1600", "GMT"))
bool newYork = not na(time(timeframe.period, "1300-2100", "GMT"))
bool inSession = london or newYork
// ── Hesaplamalar ──────────────────────────────────────────────────────────────
float fastEma = ta.ema(close, fastLen)
float slowEma = ta.ema(close, slowLen)
float atrVal = ta.atr(atrLen)
bool bullCross = ta.crossover(fastEma, slowEma) and inSession
bool bearCross = ta.crossunder(fastEma, slowEma) and inSession
// ── 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 ──────────────────────────────────────────────────────────────────
bgcolor(london and newYork ? color.new(color.green, 96) : // Overlap — en aktif
inSession ? color.new(color.blue, 96) :
color.new(color.gray, 97))
plot(fastEma, "Fast", fastEma > slowEma ? color.green : color.red, linewidth=2)
plot(slowEma, "Slow", fastEma > slowEma ? color.lime : color.orange, linewidth=2)
plotshape(bullCross, "Long", shape.triangleup, location.belowbar, color.green)
plotshape(bearCross, "Short", shape.triangledown, location.abovebar, color.red)
Overview
EUR/USD Forex Strategy [trugurpala] enters long when the fast EMA crosses above the slow EMA and short when it crosses below, but only during the London or New York session in GMT. Each entry sets an ATR-based stop and a larger ATR-based limit target. The inputs change EMA lengths, ATR length, and the stop and target multiples. It plots both EMAs, entry markers, and a session background. Signals can change before the live bar closes.
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 Mult
float
1.5
slMult
TP Mult
float
2.0
tpMult
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.
Donald - Test Logic Futures is an overlay strategy designed for intraday futures trading. It combines kernel regression functions with exponential moving averages to evaluate price retracements and entry timing. Trades are filtered by session execution windows
Andean Scalping is a Pine Script v5 strategy template designed for backtesting trading signals. It features session and date-range filtering, directional trade toggles for long and short entries, and optional trend filtering tools including higher-timeframe EM
This strategy trades Nikkei 225 futures during a configurable overnight session, defaulting to 19:00–03:00 ET. It builds long and short trend conditions from an 8/21 EMA pair and a 200-period SMA, with RSI, momentum, an ATR-scaled breakout range, and a volume
This strategy plots a 90-period simple moving average from the daily and four-hour charts plus a daily session VWAP on the price chart. It enters long when VWAP is above the daily average and the four-hour VWAP crosses above its average, and short in the oppos
This strategy trades exponential moving average crossovers designed for NQ and MNQ futures contracts on intraday timeframes. It calculates three EMAs (8, 55, and 165 periods) and generates entry signals during a user-defined trading session when previous day v
This strategy executes trades on 5-minute index futures using Exponential Moving Averages, RSI, ADX, and volume filters across multiple timeframes. It supports trend pullback and VWAP reversion regimes with entry confirmation on breakout of prior high or low p