0

我是 pine 编辑器的新手,我需要你的帮助。我希望我的指示器向我发送我设置的警报。让我举个例子

当我的指标给出一个空头/多头交易时,它会向我发送一个警报,其中包含我设置的 tp、入场价格、sl 价格。如果长信号来了:

硬币=

多头或空头=

tp1=

tp 2=

sl=

我要他们填写警报

你不需要用代码告诉我,如果你只是用示例文章告诉我如何做,它将对你有很大帮助,谢谢:)

4

1 回答 1

0

您可以将alert()函数与str.tostring()for that 一起使用。

这是 Tradingview博客中的一个示例。

//@version=4
study("alert() with multiple symbols")
f_triggerRsi(_ticker)=>
    _r = rsi(close, 7)
    _x = crossover(_r,70)
    _y = crossunder(_r,30)
    _rt = barstate.isrealtime
    [_rsi, _co, _cu, _rt_bar] = security(_ticker, timeframe.period, [_r, _x, _y, _rt])
    _msg = _ticker + ", " + timeframe.period + ": "
    if _co and _rt_bar
        _msg := _msg + "RSI (" + tostring(_rsi) + ") crossing up 70 level"
        alert(_msg,  alert.freq_once_per_bar_close)
    else if _cu and _rt_bar
        _msg := _msg + "RSI (" + tostring(_rsi) + ")  crossing down 30 level"
        alert(_msg,  alert.freq_once_per_bar_close)

plot(rsi(close, 7), "RSI", color=#8E1599)
band1 = hline(70, "Upper Band", color=#C0C0C0)
band0 = hline(30, "Lower Band", color=#C0C0C0)
fill(band1, band0, color=color.new(#9915FF,90), title="Background")

f_triggerRsi(syminfo.tickerid)
f_triggerRsi("NASDAQ:MSFT")
f_triggerRsi("FX:EURUSD")
f_triggerRsi("NASDAQ:TSLA")
f_triggerRsi("NASDAQ:PYPL")
于 2022-01-31T07:41:45.077 回答