Untitled

 avatar
unknown
plain_text
a year ago
967 B
16
Indexable
//@version=5
indicator("EMA and SMA strategija", overlay=true)

// Parametrai
emaLength = input.int(100, title="EMA Length")
smaLength = input.int(20, title="SMA Length")

// EMA ir SMA skaičiavimai
ema = ta.ema(close, emaLength)
sma = ta.sma(close, smaLength)

// Nustatymai pozicijų atidarymui
longCondition = ta.crossunder(ema, sma)
shortCondition = ta.crossover(ema, sma)

// Grafinis atvaizdavimas
plot(ema, color=color.red, title="EMA")
plot(sma, color=color.green, title="SMA")

// Pozicijų žymėjimas grafike
plotshape(series=longCondition, title="Long Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="LONG")
plotshape(series=shortCondition, title="Short Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SHORT")

// Alergijos
alertcondition(longCondition, title="Long Alert", message="LONG!")
alertcondition(shortCondition, title="Short Alert", message="SHORT!")
Editor is loading...
Leave a Comment