为何Postman可用的Webhook在TradingView警报中无法工作?
问题:TradingView Webhook 无法写入 Google Sheet?
我用Postman发送POST请求时,能成功把「Hello World」写入Google Sheet,请求地址如下:
https://script.google.com/macros/s/AKfycbwXdAoAnggrOL2NXhyIi7L2uQKKv4bmZjg_Z67VYi6jUuNp5HmiTw78ARGVZWSHYaM7/exec?gid=2061&Message=Hello World
尝试将以下URL作为TradingView警报的Webhook地址:
https://script.google.com/macros/s/AKfycbwXdAoAnggrOL2NXhyIi7L2uQKKv4bmZjg_Z67VYi6jUuNp5HmiTw78ARGVZWSHYaM7/exec?
并在Pine脚本中通过alert函数传入gid和Message参数,但始终无法写入Google Sheet,代码如下:
if DiffCloseMA > 0 alert ("gid=2061&Message=Buy", alert.freq_once_per_bar) else if DiffCloseMA < 0 alert ("gid=2061&Message=Sell", alert.freq_once_per_bar)
有没有人解决过类似问题?感谢!
已解决
改用以下Pine脚本,配合对应的Webhook URL即可实现成功写入:
//@version=5 indicator("My script", overlay = true) DiffCloseMA = close-ta.sma(close,10) datanew = '{"Message": "Hello World"}' if DiffCloseMA > 0 alert (datanew, alert.freq_once_per_bar) else if DiffCloseMA < 0 alert (datanew, alert.freq_once_per_bar) plot(ta.sma(close,5))
对应的Webhook URL:
https://script.google.com/macros/s/AKfycbzqdmXRkOQ5HiBegwKnQMg_kO7o5OFGmdM_aW8IRapSD-5k-wVGLeMG7mAwJ6A/exec
内容的提问来源于stack exchange,提问作者Paddy
相关产品推荐
相关产品推荐

