Boost Your Possibilities: Learn How to Connect TradingView to a 360 Trading Platform.

SmartLever
4 min readFeb 27, 2023

Ninety-nine percent of the time, the key is not to reinvent the wheel but to leverage existing solutions intelligently. Our long-term survival depends on how well we can connect the dots and use different technologies together.

Meet Annie, Annie was an old trader who had been in the game for over a decade. Annie spends most of his days glued to his computer screen, analyzing charts and executing trades. Despite her years of experience, Annie was struggling to keep up with the fast-paced and ever-changing nature of the financial markets. She’s always on the lookout for tools and strategies that can help him gain an edge and stay ahead of the competition. Annie found a new way to combine technologies one day, which changed his trading game for good. ¿Sound familiar?.

Connect the dots to leverage

TradingView is a platform that many people use to chart and analyze the financial markets in real time. On the other hand, SmartBots is a Python-based trading platform that allows traders to automate their trading operations. When used together, these two services can be very useful for traders who want to use TradingView alerts to automatically make trades on the market. Traders can respond to changes in the market and make trades quickly and efficiently by using the automation features of SmartBots.

At the end of this article, you will find a comprehensive example of transmitting an order created in TradingView to a cryptocurrency exchange . The approach, however, can also be simply used with other exchanges or financial instruments. In today’s competitive trading environment, where things move quickly, the combination of TradingView and SmartBots provides traders with a powerful survival toolkit to help them stay ahead of the competition. This platform mix can help you develop trading strategies.

The magical steps connecting TradingView and SmartBots:

  1. Install docker and Docker-Compose.

2. Clone the Project

  • Via HTTPS: git clone <https://github.com/SmartLever/SmartBots.git>
  • via SSH: git clone <https://github.com/SmartLever/SmartBots.git>

3. Navigate into the project’s folder:

cd SmartBots/docker

4. Change the configuration data in the SmartBots/docker/compose.env file: WEBHOOKS_TRADINGVIEW_KEY=test (Note: It is important to match the one from TradingView alerts to prevent false alerts.). BROKER_CRYPTO=kucoin CONF_PORTFOLIO=config_webhook, the configuration of the strategy to be run with the producer. ASSET_TYPE=crypto

Exchanges Keys:

API_KUCOIN_API_KEYS=your_info_here API_KUCOIN_API_SECRET=your_info_here API_KUCOIN_API_PASSPHRASE=your_info_here

5. Adjust the strategy’s configuration in the config webhook, file located in src/application/bots/config_portfolios/config_webhook.yaml

Important: If quantity_from_hook is 0, the quantity of contacts for buying and selling will be set based on the quantity value.

6. Run basic services.

 docker compose -f docker-compose_basic.yml --env-file ./compose.env up -d

7. Start the webhook service, which will receive TradingView alerts:

docker compose -f docker-compose_webhook.yml --env-file ./compose.env up -d webhook

8. Launch the producer service, which will process the alert after it is received from the webhook, extract the pertinent data, such as the price, direction, ticker, quantity and transmit it to the broker service:

docker compose -f docker-compose_crypto.yml --env-file ./compose.env up bot_crypto_trading1

9. Start the broker service, which will accept orders and send them to the exchange:

docker compose -f docker-compose_crypto.yml --env-file ./compose.env up -d broker_crypto1

10. In the path http://your_ip/:9000, you will find running the Portainer service that will allow you to see the previously executed Dockers.

11. To connect TradingView and SmartBots, an alert must be set up in the TradingView platform. This procedure is straightforward and consists of the following steps:

11.1) Log into the TradingView platform and select the chart you wish to monitor.

11.2) Click on the “Create Alert” button in the upper right corner.

11.3) Select the condition for the alert and set the Trigger → EveryTime.

11.4) Customize the alert parameters to meet your needs, such as the indicator to use, the alert name, and the message.

11.5) Copy this format into the message box.:

{"exchange":"{{exchange}}","price": {{strategy.order.price}} ,"key":"test","type":"strategy","ticker":"{{ticker}}","name":"MA2","action":"{{strategy.order.action}}" ,"contracts":{{strategy.order.contracts}},"interval":"{{interval}}","position_size":{{strategy.position_size}},"market_position":"{{strategy.market_position}}","prev_market_position":"{{strategy.prev_market_position}}"}

The webhook service will convert this message format into a webhook event. You must change the parameters key and name to fit your strategy.

11.6) Click on the notification section, then point to the webhook URL and enter your url.

11.7) Lastly, to save the alert, click the “Create” button.

That’s all. Have fun trading 😃. Please keep in mind that you must open the webhook port on your server.

Main Takeaways

  • It’s crucial to use new technologies if you want to keep your competitive advantage.
  • In the exponential world we live in, staying current with trends and embracing new technology are essential.
  • Don’t reinvent the wheel. Using SmartBots to make trades along with commercial platforms that generate signals, like TradingView, may be very helpful.

Subscribe to all our news here.

The train is in the station, and you can’t miss it, so join us on this journey. We are an open community and if you want to collaborate with us, please send us an email: andres@smartlever.tech

Sign up to discover human stories that deepen your understanding of the world.

SmartLever
SmartLever

Written by SmartLever

Leverage your options with technology.

Responses (2)

Write a response