1

I'm trying to send a tradingview webhook to my php server as follows:

condition_alert = (crossunder(rsi, rsi2) and crossunder(rsi, rsi2) and rsiColor1[1] == #0ebb23 and rsiDowntrend)
if (condition_alert)
    alert("condition_alert", alert.freq_once_per_bar_close)
    url = "https://MYserver.com//hook.php"
    webhookdata =  "condition_alert" + syminfo.ticker
    webhookrequest = request.post(url, body=webhookdata)

but am receiving the error: Could not find function or function reference 'request.post'. I'm not sure what the correct syntax is for achieving this. And also believe the '+ syminfo.ticker' might be incorrect.

Thank you in advance.

metokitt
  • 53
  • 7
  • Are you using chatGPT? Due to such poor accuracy Stackoverflow has [banned ChatGPT](https://meta.stackoverflow.com/questions/421831/temporary-policy-chatgpt-is-banned). TradingView has also decided [not to provide support](http://tradingview.com/chart/TRAIA/XwwZ70ar-Our-take-on-AI-generated-Pine-Script/) for ChatGPT. – Gu5tavo71 Apr 27 '23 at 12:31
  • 1
    check [this](https://stackoverflow.com/a/74683757/5577188) – Gu5tavo71 Apr 27 '23 at 12:33
  • No I an Not using chatgpt. I just didn't wish to include the actual ip for the php server in the code. Also I was assuming that pinev4 could send a webhook.. without interacting with the 'alert dialogue' box.. just from pure pine. New to pine, sorry. – metokitt Apr 27 '23 at 13:33

1 Answers1

1

With pinescript you can define the json that will be sent with a POST request by setting an alert manually on the chart screen (this is were you have to give the url of your server also).

You can use something like this :
Replace the values with the informations you server needs, the idea is to show you how to create a json message with pinescrip :

datanew = '{
              "client": client_id, 
              "apiKey": client_API_Key, 
              "secretKey": client_Secret_Key,
              "command": "batch_cancel_active_order",
              "symbol": symbol,
              "side": side,
              "orderCategory" : orderCategory 
              }'
alert(datanew, alert.freq_once_per_bar)
G.Lebret
  • 2,826
  • 2
  • 16
  • 27