//@version=6
// USD/JPY — Carry Trade Trend Following Strategy
// Author: Ugur Pala · github.com/trugurpala/pinescriptv6
// TradingView: https://tr.tradingview.com/u/trugurpala/
//
// TR: USD/JPY için özel carry trade trend stratejisi.
// Tokyo ve Londra seanslarında çalışır.
// BOJ müdahalelerine karşı geniş ATR stop kullanır.
// Hızlı trend değişimlerinde pozisyon kapatır.
// EN: Carry trade trend strategy specific to USD/JPY.
// Active during Tokyo and London sessions.
// Wide ATR stop as protection against BOJ interventions.
// Exits on fast trend reversal signals.
//
// Sembol / Symbol: FX:USDJPY / OANDA:USDJPY
// Önerilen TF / Recommended TF: 1H, 4H
strategy("USD/JPY Carry Trend [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,
slippage = 1)
// ── Inputs ───────────────────────────────────────────────────────────────────
int fastLen = input.int(9, "Fast EMA", minval=1)
int slowLen = input.int(21, "Slow EMA", minval=1)
int trendLen = input.int(100, "Trend EMA", minval=20)
int rsiLen = input.int(14, "RSI", minval=1)
float rsiMid = input.float(50, "RSI Mid", minval=40, maxval=60)
int atrLen = input.int(14, "ATR", minval=1)
float slMult = input.float(2.5, "SL Mult (wide/BOJ)", step=0.1)
float tpMult = input.float(3.0, "TP Mult", step=0.1)
// ── Tokyo + London Seans ──────────────────────────────────────────────────────
bool tokyo = not na(time(timeframe.period, "0000-0900", "GMT"))
bool london = not na(time(timeframe.period, "0800-1600", "GMT"))
bool inSession = tokyo or london
// ── Calculations ─────────────────────────────────────────────────────────────
float fastEma = ta.ema(close, fastLen)
float slowEma = ta.ema(close, slowLen)
float trendEma = ta.ema(close, trendLen)
float rsi = ta.rsi(close, rsiLen)
float atrVal = ta.atr(atrLen)
bool upTrend = close > trendEma and fastEma > slowEma
bool downTrend = close < trendEma and fastEma < slowEma
bool longEntry = ta.crossover(fastEma, slowEma)
and upTrend and rsi > rsiMid
and inSession and strategy.position_size == 0
bool shortEntry = ta.crossunder(fastEma, slowEma)
and downTrend and rsi < rsiMid
and inSession and strategy.position_size == 0
// ── Entries ──────────────────────────────────────────────────────────────────
if longEntry
strategy.entry("Long", strategy.long)
strategy.exit("Long Exit", "Long",
stop = close - slMult * atrVal,
limit = close + tpMult * atrVal)
if shortEntry
strategy.entry("Short", strategy.short)
strategy.exit("Short Exit", "Short",
stop = close + slMult * atrVal,
limit = close - tpMult * atrVal)
// Trend bozulunca kapat / Close on trend break
if strategy.position_size > 0 and ta.crossunder(fastEma, slowEma)
strategy.close("Long", comment="Trend Break")
if strategy.position_size < 0 and ta.crossover(fastEma, slowEma)
strategy.close("Short", comment="Trend Break")
// ── Visuals ──────────────────────────────────────────────────────────────────
plot(fastEma, "Fast", fastEma > slowEma ? color.green : color.red, linewidth=1)
plot(slowEma, "Slow", fastEma > slowEma ? color.lime : color.orange, linewidth=2)
plot(trendEma, "Trend", color.new(color.gray, 30), linewidth=2)
bgcolor(tokyo and london ? color.new(color.purple, 93) :
inSession ? color.new(color.blue, 96) :
color.new(color.gray, 97))
plotshape(longEntry, "Long", shape.triangleup, location.belowbar, color.green, size=size.normal)
plotshape(shortEntry, "Short", shape.triangledown, location.abovebar, color.red, size=size.normal)
// ── Alerts (alert() — strategy içinde çalışır) ───────────────────────────────
if longEntry
alert("USD/JPY Carry Trend Long — " + str.tostring(close, "#.###"), alert.freq_once_per_bar)
if shortEntry
alert("USD/JPY Carry Trend Short — " + str.tostring(close, "#.###"), alert.freq_once_per_bar)
Overview
USD/JPY Carry Trend [trugurpala] enters long when the fast EMA crosses above the slow EMA while price is above the trend EMA and RSI is above its midpoint, and it enters short on the opposite cross. Position size is two percent of equity. Exits place an ATR stop and a wider ATR take profit from the entry close. The main settings change EMA lengths, the RSI midpoint, ATR length, and the stop and target multiples. It only enters while flat and inside those sessions.
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
Trend EMA
int
100
trendLen
RSI
int
14
rsiLen
RSI Mid
float
50
rsiMid
ATR
int
14
atrLen
SL Mult (wide/BOJ)
float
2.5
slMult
TP Mult
float
3.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.
This intraday strategy enters positions based on an alignment of trend, momentum, and oscillator indicators. It triggers long entries when the Commodity Channel Index is above a positive threshold, a fast Relative Strength Index crosses above a slow RSI, price
This strategy calculates smoothed Heikin-Ashi candles alongside a moving average of the Relative Strength Index to enter trend reversals. It triggers long entries when smoothed Heikin-Ashi turns bullish while RSI trades above its moving average, and short entr
This session-based strategy triggers long entries at the start of the New York trading session when trend and momentum conditions align. It calculates a 38-period Exponential Moving Average and a 14-period RSI. A long position is taken at session open if the c
This intraday trading strategy combines fast, slow, and trend exponential moving averages with MACD, RSI, and ADX filters to generate trade signals during active trading sessions. It enters long positions when the fast EMA crosses above the slow EMA above the
2 EMA/SMA + RSI Strategy [Alorse] combines three configurable moving averages with a short-period Relative Strength Index filter. It plots fast, slow, and trend moving averages on the price chart. Long entries trigger when the fast moving average is above the
This strategy plots on the price chart and opens long or short positions when a weighted score from MACD, Stochastic RSI, RSI, Supertrend and a moving-average crossover exceeds a user-set trigger. Each component has its own weight and candle delay. Entries can