TvWebhookReceiver
=== 1.) Start ngok reverse proxy ========================================
TvWebhookReceiver
=== 1.) Start ngok reverse proxy ========================================
Open PowerShell (Administrator)
cd "D:\Projects\TvWebhookReceiver"
ngrok http 127.0.0.1:5000
=== 2.) Start TbWebHookReceiver ==========================================
Open PowerShell (Administrator)
cd "D:\Projects\TvWebhookReceiver"
dotnet run
=== 3.) Test POST with Invoke-RestMethod =================================
cd "D:\Projects\TvWebhookReceiver"
Open PowerShell (Administrator)
$uri = "https://chevronwise-megaphonically-jule.ngrok-free.dev/tv"
$body = '{"secret":"CHANGE_ME_TO_SOMETHING_LONG","ticker":"AAPL","price":150}'
Invoke-RestMethod -Method Post -Uri $uri -ContentType "application/json" -Body $body
=== 4.) Add WEBHOOK script to TradingView ================================
//@version=6
indicator("BASIC_WEBHOOK_TEST", overlay=true)
if barstate.isconfirmed
json = '{"secret":"Test","ticker":"' + syminfo.ticker + '","exchange":"' + syminfo.prefix + '","timeframe":"' + timeframe.period + '","price":' + str.tostring(close) + ',"time":' + str.tostring(time) + ',"strategy":"BASIC_WEBHOOK_TEST"}'
alert(json, alert.freq_once_per_bar_close)
=== 5.) Add Alert to trigger WEBHOOK script
After adding the script:
Click Alerts
Set:
Condition: BASIC_WEBHOOK_TEST → Any alert() function call
Webhook URL: https://chevronwise-megaphonically-jule.ngrok-free.dev/tv
Frequency: Once per bar close
Important: Script alerts only fire when Pine executes alert() So you must wait for a bar to close on a live chart.