OPEN-SOURCE SCRIPT

My Strategy

138
//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)



Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.