5 EMA Short
5 EMA Short
-- Input
emaLength = input.int(5, "EMA Length", minval=1)
riskRewardRatio = input.float(3.0, "Risk-Reward Ratio", minval=1.0, step=0.1)
-- Calculate 5 EMA
ema5 = ta.ema(close, emaLength)
-- Entry condition
entryCondition = isAlertCandle[1] and low <= low[1]
-- Plot 5 EMA
plot(ema5, color=color.blue, linewidth=1, title="5 EMA")
-- Plot entry, stop loss, and target only when a trade is triggered
plotshape(series=tradeEntry, title="Entry", location=location.absolute,
color=color.yellow, style=shape.circle, size=size.tiny)
plotshape(series=tradeSL, title="Stop Loss", location=location.absolute,
color=color.red, style=shape.circle, size=size.tiny)
plotshape(series=tradeTarget, title="Target", location=location.absolute,
color=color.green, style=shape.circle, size=size.tiny)