有没有办法在价格偏离系列 x% 或 $x 时发出警报?
Is there a way to alert when a price is x% or $x away from a series?
目标:能够添加警报,或在屏幕上弹出 shape/text,当价格接近远离系列的可配置 % 或 $ 数量时,比如 200MA。基本上围绕系列设置动态频道。
有没有办法在 Pine Script 中做到这一点?
是的。使用 label.new()
或 alert()
函数。
//@version=4
study("My Script")
ma = ema(close, 200)
plot(ma)
p = input(100, title="%", step=0.1) / 100
if close*p > ma
alert("Close price" + tostring(close) + "> than" + tostring(ma) + "on" + tostring(p) + "%")
// label.new(bar_index, high, text = "Close price" + tostring(close) + "> than" + tostring(ma) + "on" + tostring(p) + "%")
https://www.tradingview.com/pine-script-docs/en/v4/language/
目标:能够添加警报,或在屏幕上弹出 shape/text,当价格接近远离系列的可配置 % 或 $ 数量时,比如 200MA。基本上围绕系列设置动态频道。
有没有办法在 Pine Script 中做到这一点?
是的。使用 label.new()
或 alert()
函数。
//@version=4
study("My Script")
ma = ema(close, 200)
plot(ma)
p = input(100, title="%", step=0.1) / 100
if close*p > ma
alert("Close price" + tostring(close) + "> than" + tostring(ma) + "on" + tostring(p) + "%")
// label.new(bar_index, high, text = "Close price" + tostring(close) + "> than" + tostring(ma) + "on" + tostring(p) + "%")
https://www.tradingview.com/pine-script-docs/en/v4/language/