向 pine 脚本指标添加警报的正确方法是什么

问题描述 投票:0回答:0

如何向这个 pine 脚本(v5)添加警报,例如。买/卖条件,警报是买或卖

buy = s > the 2 ma's 卖出 = s < the 2 ma's

alertcondition(buy or sell, "text")

The plots for the 2 ma's are not straight forward, so I have failed to incorporate them into the alert condition.

Any ideas will be appreciated - Thanks

indicator(title='TBA Test', shorttitle='TBA')
src = close
rsi_length = input(14, title='RSI Length')
rsi_mom_length = input(30, title='RSI Momentum Length')
rsi_ma_length = input(9, title='RSI MA Length')
ma_length = input(6, title='SMA Length')
fastLength = input(23)
slowLength = input(50)

r = ta.rsi(src, rsi_length)
rsidelta = ta.mom(r, rsi_mom_length)
rsisma = ta.sma(ta.rsi(src, rsi_ma_length), ma_length)
s = rsidelta + rsisma

plot(s, color=color.new(#e7c7e7, 0), linewidth=2)
plot(ta.sma(s, fastLength), linewidth=1, color=color.new(#FFFF00, 0))
plot(ta.sma(s, slowLength), linewidth=1, color=color.new(#FF0000, 0))

// 我已经尝试过交叉和 < >,但是 pine 不喜欢我描述这两个 sma 的方式。

pine-script alerts
© www.soinside.com 2019 - 2024. All rights reserved.