Skip to main content

Send Custom Volume in TradingView Alert

Tutorial on how to send Custom Volume in TradingView Alert to WunderTrading.

Ben Ross avatar
Written by Ben Ross
Updated over a month ago

If you want to send a custom volume with each TradingView alert, you can turn on this option in the bot settings. Once enabled, your TradingView alert details will update automatically.


Setup your volume in TradingView's PineCode

Insert the quantity parameter in the strategy.entry() function. In the example below, we set the quantity equal to 50. If you want your quantity to change dynamically you can define a variable in your code that will recalculate the amount you would like to send with each entry.

// Fixed amount example
strategy.entry("Long", strategy.long, qty=50,comment="Insert Enter Long Comment")


// Variable amount example
amount = x
// where "x" is your calculation how you would like to calculate the amount
strategy.entry("Long", strategy.long, qty=amount,comment="Insert Enter Long Comment")

Setup the Alert

1. Select Condition – Select the strategy for which you would like to create an alert.

2. Insert code – Insert the code block into your alert message box.

Set up the alert and enter the following code in the alert message box. Also, identify the type of amount ("amountPerTradeType") you are entering.

{
"code": "{{strategy.order.comment}}",
"amountPerTrade": "{{strategy.order.contracts}}",
"amountPerTradeType": "quote"
}

If you have just 1 trading pair in your bot then the "amountPerTradeType" options for you are:

Parameter

Comment

"percents"

This will interpret the amount you provide as a percentage of your exchange balance.

"base"
* for spot market


"contracts"
for futures markets

This will consider the amount you enter as the number of base currency coins or contracts. For example, in the BTC/USDT pair, BTC is the base currency, so you pass the number of BTC you want to buy.

"quote"

This will take the amount you enter as the number of quote currency. In the BTC/USDT pair, the quote currency is USDT, so you need to enter the amount in dollars you want to spend.

If you have Multiple trading pairs in your bot then the "amountPerTradeType" options for you are:

Parameter

Comment

"percents"

This will interpret the amount you provide as a percentage of your exchange balance.

"$"

This will treat the amount that you are passing as the fixed amount in USDT.

3. Open Notifications Tab – Navigate to the Notifications section.

4. Paste Webhook URL – Insert the Webhook URL from WunderTrading.

5. Create Alert – Click Create / Save to finalize the alert.

Did this answer your question?