Pine script 伦科图上带箭头的2EMA

Pine script 伦科图上带箭头的2EMA,pine-script,Pine Script,我不熟悉Pine脚本,我只是尝试创建一个小脚本,但是失败了,我不明白为什么 //@version=3 study(title="2EMA cross", shorttitle="2EMA cross", overlay=true) EMA1 = input(2, minval=1, title="EMA1") EMA2 = input(5, minval=1, title="EMA2"), long = EMA1[1] > EMA2[1] short = EMA2[1] > EMA

我不熟悉Pine脚本,我只是尝试创建一个小脚本,但是失败了,我不明白为什么

//@version=3
study(title="2EMA cross", shorttitle="2EMA cross", overlay=true)
EMA1 = input(2, minval=1, title="EMA1")
EMA2 = input(5, minval=1, title="EMA2"),

long = EMA1[1] > EMA2[1]
short = EMA2[1] > EMA1[1]

//Use these alerts to create server-side alerts (right-click on one of the buy or sell arrows on the chart and choose "add alert")
alertcondition(long, title='Buy Call', message='EMA long reversal')
alertcondition(short, title='Buy Put', message='EMA short reversal')

//EMA COLORS
plot(ema(close, EMA1), color=green, linewidth=2)
plot(ema(close, EMA2), color=red, linewidth=2)


//Use this to customize the look of the arrows to suit your needs.
plotshape(long, location=location.belowbar, color=lime, style=shape.arrowup, text="Call")
plotshape(short, location=location.abovebar, color=red, style=shape.arrowdown, text="Put")
这是我得到的信息:

line 14: Cannot call `ema` with arguments (series, series[integer]); available overloads: ema(series, integer) => series;
line 15: Cannot call `ema` with arguments (series, series[integer]); available overloads: ema(series, integer) => series
我所要做的就是:绿色箭头向上+快速均线穿过慢速均线后调用下一块砖上的文本,另一种方法是放置文本+红色箭头向下

有人知道我做错了什么吗?

请参阅代码中的注释:

//@version=3
study(title="2EMA cross", shorttitle="2EMA cross", overlay=true)
// These are only your ema periodds—not the emas themselves.
EMA1 = input(2, minval=1, title="EMA1")
EMA2 = input(5, minval=1, title="EMA2")

// Create the two ema calculations here and then use the results to detect signals and plot.
ema1    = ema(close, EMA1)
ema2    = ema(close, EMA2)

// Detect only the moment when the 2 emas cross, otherwise you would be getting one of the two signals at any given moment.
// Note that detecting occurs at the bar following the actual cross.
long    = crossover(ema1, ema2)
short   = crossunder(ema1, ema2)

// Use these alerts to create server-side alerts (right-click on one of the buy or sell arrows on the chart and choose "add alert")
alertcondition(long, title='Buy Call', message='EMA long reversal')
alertcondition(short, title='Buy Put', message='EMA short reversal')

// EMA COLORS
plot(ema1, color=green, linewidth=2)
plot(ema2, color=red, linewidth=2)


// Use this to customize the look of the arrows to suit your needs.
plotshape(long, location=location.belowbar, color=lime, style=shape.arrowup, text="Call")
plotshape(short, location=location.abovebar, color=red, style=shape.arrowdown, text="Put")

使用1分钟的伦科棒并没有使用更长的时间段那么糟糕,但仍然有风险。这些链接可能有助于理解原因: