//@version=5 strategy(title="3ATR EMA Basic", shorttitle="3ATR-Basic", overlay=true, currency=currency.USD, initial_capital=10000, commission_type=strategy.commission.percent, commission_value=0.1) // Inputs ema_length = input.int(21, "EMA Length") atr_multiplier = input.float(3.0, "ATR Multiplier") // Calculations ema = ta.ema(close, ema_length) atr = ta.atr(ema_length) upper_band = ema + (atr * atr_multiplier) lower_band = ema - (atr * atr_multiplier) // Entry Condition bullish_entry = (close < ema) and (close[1] <= lower_band[1]) and (close > close[1]) // Exit Condition (when price crosses upper band) bullish_exit = close > upper_band // Trade Execution if bullish_entry strategy.entry("Long", strategy.long) if bullish_exit strategy.close("Long") // Visualization plot(ema, "EMA", color=color.new(#4A90E2, 0)) plot(upper_band, "Upper", color=color.orange) plot(lower_band, "Lower", color=color.green) plotshape(bullish_entry ? low : na, style=shape.triangleup, location=location.belowbar, color=color.new(#00FF00, 0), size=size.small, title="Bull Entry") plotshape(bullish_exit ? high : na, style=shape.triangledown, location=location.abovebar, color=color.new(#FF0000, 0), size=size.small, title="Bull Exit")