How to use TradingView to send trading signals as a Signaler
While sending trading signals through Tradingview may seem complicated, it is actually very easy to implement. There are 2 ways to send signals using Tradingview.
Using Buy and Sell Signals
The first way is to use buy and sell signals separately.
- You first need to select your Exchange, in this example, we chose Binance.
- Then you can select the market, which in our example is BTCUSDT.
- Then the signal type, which in our case is Buy.
- You then have a few optional settings, such as "Take profit at," "Stop-loss percentage," etc. that you can set up.
- When you are done selecting the right settings, click on Generate.
Now go to your TradingView account. For our example, we chose 2 simple moving averages. We want to send a buy signal when the short moving average crosses above the long moving average.
To do this, you need to click on the clock icon in TradingView. It's the icon showing 99 notifications.
Then to make a new alert, click on the + icon.
Then you can select your shorter moving average.
For example, for the buy signal, you can choose crossing up the longer SMA.
Next, we will go back to Cryptohopper and copy the Webhook URL. Then we will paste it under Notifications/Webhook URL.
Then we will go back to Cryptohopper and click on Copy JSON. Then finally, we will paste the JSON created on Cryptohopper on TradingView in the Message section. We will also give a name for the Alert Name and then click on Create.
Using Strategy Order Action
The other way is to use Strategy.order.action. Let’s go with the same example as before, and say you want to enter a long position when the short 5 Simple Moving Average (SMA) crosses above the longer 10 SMA, and then close the long position when the short SMA crosses below the longer 10 SMA.
This is an example of such a strategy that you can add in Pinescript:
//@version=5 strategy('(a) SMA crossover Mihai', overlay=true, initial_capital=3000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1) //Step Two: Parameter Setting fst = input(title='MA_Fast', defval=5) slw = input(title='MA_Slow', defval=10) ma_fast = ta.sma(close, fst) ma_slow = ta.sma(close, slw)
// Calculate start/end date and time condition startDate = input.time(timestamp('1970-01-01T00:00:00')) finishDate = input.time(timestamp('2032-01-01T00:00:00'))
time_cond = time >= startDate and time <= finishDate
//Step Three: Plot plot(ma_fast, color=color.new(color.blue, 0)) plot(ma_slow, color=color.new(color.green, 0))
//Step Four: Strategy Application if ma_fast > ma_slow and time_cond strategy.entry(id='ma_long', direction=strategy.long) if ma_slow > ma_fast and time_cond strategy.close(id='ma_long')
To add this, you will have to click on Pine editor, and paste. After pasting the strategy, you will need to click on Save and save it as a strategy.
Now you can simply add it from the Indicators.
Now we will make a new alert again, by clicking on the clock shape, the one with 99 notifications.
Then to make a new alert click on the + icon.
Once here you will need to select your strategy.
Next, we will go back to Cryptohopper and copy the Webhook URL. Then we will paste it under Notifications/Webhook URL.
Now we go back to Cryptohopper, and we will choose Binance for example with the market BTCUSDT. Then for Signal type, we will choose strategy.order.action. Of course, you can choose an optional Take Profit, Stop-loss percentage, Trailing stop-loss percentage, and Arm trailing stop-loss percentage. Then we will click on Generate, and finally, we will Copy JSON.
And then pasting it in the message. And giving the Alert a name.