//@version=4 strategy(title=“EMA crosses”, overlay=true)
// Inputs priceData = input(title=“Price data”, type=input.source, defval=hl2) ema1Length = input(title=“EMA 1”, type=input.integer, defval=12) ema2Length = input(title=“EMA 2”, type=input.integer, defval=24) ema3Length = input(title=“EMA 3”, type=input.integer, defval=36)
// Compute values ema1 = ta.ema(priceData, ema1Length) ema2 = ta.ema(priceData, ema2Length) ema3 = ta.ema(priceData, ema3Length)
enterLong = ema1 > ema2 and ema2 > ema3 enterShort = ema1 < ema2 and ema2 < ema3
// Plot values plot(series=ema1, color=color.orange, linewidth=2) plot(series=ema2, color=color.maroon, linewidth=2) plot(series=ema3, color=color.blue, linewidth=2)
// Submit orders if (enterLong) strategy.entry(id=“Enter Long”, long=strategy.long)
if (enterShort) strategy.entry(id=“Enter Short”, long=strategy.short)
Hiện tại, trong quá trình thử nghiệm, một lệnh sẽ được đặt ở đầu tiên, và các lệnh khác dường như không được kích hoạt, có một ông chủ nào có thể hướng dẫn cách thực hiện vòng quay chiến lược không, cảm ơn.