When you trade on margin, you want to catch both price rises and drops. With Trading View custom signals and two bots, you can change position from long to short or short to long:

  • You can do this on something simple like when price crosses $10000.
  • Use the enormous library of technical indicators, something like when RSI drops below 20.
  • Write custom solutions with Pine Script for conditions on multiple indicators or even private strategies.

The only thing that limits you is the time you want to invest in learning these tools. 

Create two bots, one short and one long

Some tips:

  • If you don't need additional buys, set the 'max safety trades count' setting to 0.
  • To prevent the bot from closing deals too early, set take profit to 50% from total volume.
  • There's no need to start anything manually. If a close message comes to the bot while it has no active position, it'll just ignore it.

Use webhooks, not email-to-sms

When creating alerts on Trading View, choose 'Webhook URL' then paste the link: https://3commas.io/trade_signal/trading_view

Create the first alert when you want to go long

Assume you want to close short position and open long one when RSI drops below 20:

Open your short bot information by clicking its name and get the message to close order at market price which looks like this:

{"message_type": "bot",  "bot_id": 756065,  "email_token": "d98895d9-adc5-4852-94o0-de67ad25923b",  "delay_seconds": 0,  "action": "close_at_market_price"}

And the message for deal start signal for the long bot:

{"message_type": "bot",  "bot_id": 820763,  "email_token": "d98895d9-adc5-4852-94o0-de67ad25923b",  "delay_seconds": 0}

Exchanges might take some time to close your previous position, to avoid conflicting with this, use delay_seconds with values near 4-10 on the open message. Considering this, the message for deal start signal for the long bot will be:

{"message_type": "bot",  "bot_id": 820763,  "email_token": "d98895d9-adc5-4852-94o0-de67ad25923b", "delay_seconds": 6}

The final thing you should to do with these messages is to combine them. The general syntax is as below. 

[message 1, message 2]

Do it with our messages:

[{"message_type": "bot",  "bot_id": 820763,  "email_token": "d98895d9-adc5-4852-94o0-de67ad25923b",  "delay_seconds": 0}, {"message_type": "bot",  "bot_id": 820763,  "email_token": "d98895d9-adc5-4852-94o0-de67ad25923b", "delay_seconds": 6}]

Additional new lines and spaces don't matter but make sure all other symbols are in place. Miss one bracket or comma, and it won't work. There's a simple way to validate your message is correct: https://jsonformatter.curiousconcept.com/. Paste the message, then click 'process,' and as long as you get the green message VALID, you're fine.

Paste the final combined message to your alert. If you're curious what's the hell it's, it's a JSON array. :)

Create the second alert when you want to go short

It's almost the same process as with the long:

  • Take the message to close order at market price the long bot.
  • Take the message for deal start signal for the short bot.
  • Set delay_seconds on the message for deal start signal for the short bot.
  • Combine messages and validate the result.
  • Put combined messages into your alert. 

Test with Paper Trading when you're not sure

If you're not up to take any risk with live trading, switch to paper trading and do the check everything USDT_BTC pair.

Did this answer your question?