OPEN-SOURCE SCRIPT

My Strategy

137
//version=5
strategy("My Strategy", overlay = true)

// Create Indicator's
ema1 = ta.ema(close, 8)
ema2 = ta.ema(close, 18)
ema3 = ta.ema(close, 44)

//plot the Indicators

plot(ema1, title = "EMA1", color = color.blue, linewidth = 2)
plot(ema2, title = "EMA2", color = color.red, linewidth = 2)
plot(ema3, title = "EMA3", color = color.black, linewidth = 2)

// Specify crossover conditions

Enterlong = ta.crossover(ema2, ema3)
Exitlong = ta.crossunder(ema1,ema2)

Entershort = ta.crossunder(ema2, ema3)
Exitshort = ta.crossover(ema1,ema2)

//Execution Logic - Placing Orders

strategy.entry("Long", strategy.long, 1, when = Enterlong)
strategy.close("Long", when = Exitlong)

strategy.entry("Short", strategy.short, 1, when = Entershort)
strategy.close("Short", when = Exitshort)



免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。