Issue with Tradingview webhook

If my indicator generates both Buy and Sell signals then I can’t use below JSON.

In order type, I cannot put Buy or Sell. I am using free version of Tradingview and a script that will generate both Buy and Sell signal. I am not using paid version where I can put two alerts separate for Buy and Sell.

As per me , if I put “transactionType”:"{{strategy.order.action}}"
it can output “transactionType”:“Buy” or “transactionType”:“Sell”

Please suggest.

Hi @vtikam

The webhook alert feature is present only in paid version on
If you want to generate both Buy & Sell signal, you have to put two different alerts with respective logics/condition.

The JSON object should exactly what is generated in JSON generator on

Hope this helps

Hi @vtikam
I faced a similar issue and had to change my code in pinescript and call a comment instead of {{strategy.order.action}}

I’ve used the following within the alert:- “transactionType”: “{{strategy.order.comment}}”

In the pinescript code, I had to add a piece of ‘comment’ so that I get ‘B’ and ‘S’ rather than ‘Buy’/‘Sell’
strategy.entry(‘Buy’, strategy.long, when=Buy, qty=buyQnt, comment=“B”)
strategy.close(‘Buy’, when=exitBuy, comment=‘S’)

Hope this helps

1 Like