OPEN-SOURCE SCRIPT
My script

//version=5
strategy("15-Min EMA + RSI Pullback Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === INPUTS ===
emaShort = input.int(9, title="EMA Short")
emaLong = input.int(21, title="EMA Long")
rsiPeriod = input.int(14, title="RSI Period")
rsiBuyThresh = input.int(40, title="RSI Buy Threshold")
rsiSellThresh = input.int(60, title="RSI Sell Threshold")
sl_pct = input.float(1.0, title="Stop Loss %", minval=0.1)
tp_pct = input.float(2.0, title="Take Profit %", minval=0.1)
// === CALCULATIONS ===
emaFast = ta.ema(close, emaShort)
emaSlow = ta.ema(close, emaLong)
rsi = ta.rsi(close, rsiPeriod)
// === CONDITIONS ===
// Long setup
bullTrend = emaFast > emaSlow
pullbackLong = close > emaSlow and close < emaFast
rsiLongCond = rsi > rsiBuyThresh
bullSignal = bullTrend and pullbackLong and rsiLongCond
// Short setup
bearTrend = emaFast < emaSlow
pullbackShort = close < emaSlow and close > emaFast
rsiShortCond = rsi < rsiSellThresh
bearSignal = bearTrend and pullbackShort and rsiShortCond
// === ENTRIES ===
if bullSignal
strategy.entry("Long", strategy.long)
strategy.exit("TP/SL Long", from_entry="Long", stop=close * (1 - sl_pct / 100), limit=close * (1 + tp_pct / 100))
if bearSignal
strategy.entry("Short", strategy.short)
strategy.exit("TP/SL Short", from_entry="Short", stop=close * (1 + sl_pct / 100), limit=close * (1 - tp_pct / 100))
// === PLOT INDICATORS ===
plot(emaFast, color=color.orange, title="EMA 9")
plot(emaSlow, color=color.blue, title="EMA 21")
strategy("15-Min EMA + RSI Pullback Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === INPUTS ===
emaShort = input.int(9, title="EMA Short")
emaLong = input.int(21, title="EMA Long")
rsiPeriod = input.int(14, title="RSI Period")
rsiBuyThresh = input.int(40, title="RSI Buy Threshold")
rsiSellThresh = input.int(60, title="RSI Sell Threshold")
sl_pct = input.float(1.0, title="Stop Loss %", minval=0.1)
tp_pct = input.float(2.0, title="Take Profit %", minval=0.1)
// === CALCULATIONS ===
emaFast = ta.ema(close, emaShort)
emaSlow = ta.ema(close, emaLong)
rsi = ta.rsi(close, rsiPeriod)
// === CONDITIONS ===
// Long setup
bullTrend = emaFast > emaSlow
pullbackLong = close > emaSlow and close < emaFast
rsiLongCond = rsi > rsiBuyThresh
bullSignal = bullTrend and pullbackLong and rsiLongCond
// Short setup
bearTrend = emaFast < emaSlow
pullbackShort = close < emaSlow and close > emaFast
rsiShortCond = rsi < rsiSellThresh
bearSignal = bearTrend and pullbackShort and rsiShortCond
// === ENTRIES ===
if bullSignal
strategy.entry("Long", strategy.long)
strategy.exit("TP/SL Long", from_entry="Long", stop=close * (1 - sl_pct / 100), limit=close * (1 + tp_pct / 100))
if bearSignal
strategy.entry("Short", strategy.short)
strategy.exit("TP/SL Short", from_entry="Short", stop=close * (1 + sl_pct / 100), limit=close * (1 - tp_pct / 100))
// === PLOT INDICATORS ===
plot(emaFast, color=color.orange, title="EMA 9")
plot(emaSlow, color=color.blue, title="EMA 21")
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.