Sending a trading alert/signal from TradingView from a "Strategy"

Tradingview allows users to send webhook based alerts to any external system. Using Mudrex, you can now automate the alerts and send signals directly to an external signal-based strategy.

Make sure your Pine script is in Version 4

Pine script has multiple versions and sending comments is only supported in pine scripts with version 4. So pls make sure your pine code is in version 4

Add comments to your order

Tradingview recently launched strategy alerts that let you set up an alert whenever the strategy places an order. Hence to send a message to Mudrex, you will need to send the correct comment in the pine script code.


Open your strategy in TradingView. In your pine script, you will have to add comments in the correct JSON format to your “strategy.entry()”; “strategy.order()”; “strategy.exit()”; “strategy.close()”. Copy the comment message as shown in the example below.

/// LONG
strategy.entry("long", comment="{\"id\" : \"<Insert your signal id here>\", \"action\" : \"long_entry\"}")
strategy.exit("long", comment="{\"id\" : \"<Insert your signal id here>\", \"action\" : \"long_exit\"}")

strategy.entry("short", comment="{\"id\" : \"<Insert your unique strategy id here>\", \"action\" : \"short_entry\"}")
strategy.exit("short", comment="{\"id\" : \"<Insert your unique strategy id here>\", \"action\" : \"short_exit\"}")
// long-short
strategy.entry("short to long", comment="{\"id\" : \"<Insert your signal id here>\", \"action\" : \"reverse_short_to_long\"}")
strategy.entry("long to short", comment="{\"id\" : \"<Insert your signal id here>\", \"action\" : \"reverse_long_to_short\"}")



The ' \" ' is used so that pinescript can accept quotes correctly in the message.


Setting up alerts using the TradingView alert dialog

You need to click on the 'Alert' icon. This icon shows up in multiple places. Here is how it shows up in the top panel



On clicking the add alert icon, a dialog box will open up. In the dialog box all you now need to do is set the URL correctly and in the message box enter


This will make sure that the comments we added earlier are passed on the Mudrex correctly!



Go live!

Once you create an alert and save it, Mudrex will be ready and waiting for the alert to come in. You can now either let the alerts accumulate or start a paper/live run.


If you need any help using Mudrex then please feel free to write to us at

Start building your trading strategy using external signals with Mudrex today.

Was this article helpful?
5 out of 8 found this helpful