← Back to Library
Strategies

Stoch + EMA Scalper

Trend following scalp v6. Price > EMA 200, enter on Stoch crossover.

Pine Script V6
//@version=6
strategy("Stoch + EMA Scalper [Codon.pro]", overlay=true, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
ema_filter_len = input.int(200, "Trend Filter EMA")
k_len = input.int(14, "Stoch K")
d_len = input.int(3, "Stoch D")
smooth = input.int(3, "Stoch Smooth")
ema200 = ta.ema(close, ema_filter_len)
k = ta.stoch(close, high, low, k_len)
d = ta.sma(k, smooth)
trend_is_up = close > ema200
oversold_cross = ta.crossover(k, d) and k < 20
if trend_is_up and oversold_cross
    strategy.entry("Scalp Long", strategy.long)
if k > 80
    strategy.close("Scalp Long")
plot(ema200, color=color.yellow, linewidth=2, title="Trend Filter")