Skip to main content
All CollectionsTrading BotsSignal Bot
How to set up a TradingView Bot (Signal bot) in WunderTrading
How to set up a TradingView Bot (Signal bot) in WunderTrading

One TradingView strategy or indicator alert for all commands to execute in WunderTrading

Anna Smith avatar
Written by Anna Smith
Updated over 3 weeks ago

You can now set up TradingView strategies and indicators alerts and automate them through the WunderTrading platform.

Follow this guide to set up your first TradingView strategy/indicator bot alerts.

We recommend using Cross Margin Mode for safer trading. Note that an Isolated Margin, can carry a higher risk of position liquidation.

Strategy alert automation

Step 1

Open your strategy in TradingView. In your pine script, you will have to add comments to your “strategy.entry()”; “strategy.order()”; “strategy.exit()”; “strategy.close()”. Copy your comments from your WunderTrading bot settings.

Example code

/// LONG
strategy.entry("long", true, when = entry_long, comment=" ***INSERT OPEN LONG COMMENT*** ")
strategy.exit("long", when=exit_long, stop=long_stop_level, limit=long_take_level, comment="***INSERT CLOSE LONG COMMENT***")
strategy.close("long", when=exit_long, comment = "***INSERT CLOSE LONG COMMENT***")

/// SHORT
strategy.entry("short", false, when = entry_short, comment="***INSERT OPEN SHORT COMMENT***")
strategy.exit("short", when=exit_short, stop=short_stop_level, limit=short_take_level, comment = "***INSERT CLOSE SHORT COMMENT***")
strategy.close("short", when=exit_short, comment = "***INSERT CLOSE SHORT COMMENT***")

Step 2

Create an alert. This time it would be a single alert that would be triggered, with the appropriate comment, each time when something will occur in your strategy (Entry / Exit / Trailing profits etc).

Step 3

Replace your alert message with a single piece of code: {{strategy.order.comment}} This will ensure that every time the alerts would be triggered the appropriate message would be sent to your WunderTrading bot.

Step 4

Launch your Alerts in TradingView and enable your WunderTrading Bot.


Important!

If you are trading on lower timeframes (1 to 5 minutes) your strategy may have the following error on execution: Error: Maximum number of orders reached (9000) was reached.

Solution: You will have to add a time interval or start date from which the backtest will be starting and put this code before strategy execution.


Code

/// PERIOD /// 
testStartYear = input(2019, "Backtest Start Year")
testStartMonth = input(1, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)

testStopYear = input(2020, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(31, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)

testPeriod() =>
time >= testPeriodStart and time <= testPeriodStop ? true : false

if testPeriod()
strategy.entry()
strategy.close()

Note

You need a TradingView Pro subscription to be able to receive Webhook notifications on WunderTrading.


Problems with Strategy alert

  1. Errors with swing trade signals. If you have Exit Long and Entry Short at the same time, TV sometimes will not send one of these signals.

    Solution: Set separate alerts for your long position and short position.

  2. Error with a log of alerts. Sometimes TV will not show the alert in the log file on TV, however, if you open the script on the graph you would be able to see this signal. Thus, it may appear that WunderTrading would open a position whereas TV does not show it in the log.


Hint: Every change you make on either the code or the alerts. You need to delete the alert and create a brand new one.

Indicator alert automation

How to connect your TradingView Indicator Alerts to WunderTrading?

  1. Convert your Strategy into Alerts. Change the type of your script from strategy to indicator and change your strategy.entry() and strategy.exit() into alertcondition(). Save this as a new indicator.

  2. Apply this indicator to the graph that you want it to work on. Carefully select the trading pair, exchange and timeframe for which you want this alert to work.

  3. Start creating the alert. In the field “Condition” select your alert as labelled in your strategy. In “Alert Conditions” select “Webhook URL” and insert the URL that you see on this page.

  4. Specify the “Message”. For each of your 4 conditions (Enter Long, Exit Long, Enter Short, Exit Short”) you will have a unique message that will trigger the Terminal to execute a trade based on your signals.

Hint: Every change you make on either the code or the alerts. You need to delete the alert and create a brand new one.

Did this answer your question?