Automating an alert from a "Strategy" on TradingView

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.

 

1. 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\"}")

///Short
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_entry\"}")

// 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.

2. 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

mceclip0.png

 

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

{{strategy.order.comment}}

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

mceclip0.png

 

3. 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 help@mudrex.com

Easily automate your strategies with Mudrex. Get started today!

Was this article helpful?
4 out of 4 found this helpful