Automated Trading Overview

Quick Start Guide

A short step by step guide to getting started with automated trading on FTX, BitMEX, Deribit and Bybit.

Adding the trading bot integration

  1. Create a new group to filter out alerts that will contain orders. In the video below, we create a group called Trading Bot and set it up so only alerts containing #bot will be sent into the group. You can pick any name or filter keywords you like though.
  2. Choose to add an integration to your new group.
  3. From the list of options, pick the Trading integration by clicking Add and configure.

Adding API Keys

Next up, we'll need some API keys for the exchange we want to trade on. We have separate guides for each of the supported exchanges...

All API keys are stored encrypted, but if you'd rather not give us your API keys you can use the open source version of the automated trading bot. For more details of this check here.

Some example orders

Now you have a trading bot up and running, you can start adding commands to your alerts.

Adding #bot and a command to an alert in TradingView
Adding #bot and a command to an alert in TradingView

Here is the text from that alert in the picture...

Long Entries Strat: Go Long #bot

test(XBTUSD) { limit(side=buy, amount=100, offset=5); }

There are some things to notice here...

  • The alert message contains the text #bot. This will cause it to be sent into the Trading Bot group we created at the start. This group is where our trading bot is installed. You don't have to set things up like this, but it can help to keep the bot commands separate from other alerts.
  • The last line contains the order commands...
    • test(XBTUSD) tells the bot to use the API keys called test, which we linked to some BitMEX API keys. We've included the ticker symbol of the instrument we want to trade with as well (XBTUSD in this case). This has to go in brackets after the name of the API keys.
    • In between the { and the } are all the commands we'd like to execute (just one in this case, though we could have more if we wanted). All the commands will be executed on the exchange the API keys relate to, on the symbol given (BitMEX XBTUSD in this example).
    • limit(...) is the actual command. In this example the command is asking to place a single Limit Order to Buy 100 contracts. The order will be placed $5 below the current price (at the time the command is executed). You can learn more about the limit order command here.

For a bit more about the basic details of sending commands, check out our guide to the basic concepts.

More example command sequences

A simple market order

Learn about the market order here

apiKeysName(XBTUSD) {
    market(side=buy, amount=100);

Go long and set a stop loss

The stop-loss order will be placed $50 below the current price.

Commands used: market order and stopMarket order

apiKeysName(XBTUSD) {
    market(side=buy, amount=100);
    stopMarket(side=sell, amount=100, offset=50)

Aggressive long entry, take profit and stop loss

Attempt to enter a long position (100 contracts) by placing a limit order right at the top of the order book. The limit order will constantly be moved to the top of the book until it is filled. Once it's filled, we'll place a pair of orders. A limit sell order (reduce only and post only) is placed $100 above the current price, and a stop market order is placed $50 below the current price. Both orders will be monitored until one of them is filled, at which point the remaining order will be cancelled.

If all goes well, you'll enter a position using only limit orders, and take your profit also with a limit order (collecting maker rebates both times).

Commands used: aggressiveEntry order and stopOrTakeProfit order

apiKeysName(XBTUSD) {
    aggressiveEntry(side=buy, amount=100);
    stopOrTakeProfit(side=sell, amount=100, tp=100, sl=50);

Scaled order to sell 1000 contracts

Place a scaled order to sell 1000 contracts, made up of 30 separate limit orders, over a $500 range from $19500 to $20000. Notice this used @20000 for the offset, which means use the absolute price instead of an offset. See the documentation for more ways to specify the offset to use.

Commands used: scaled order

apiKeysName(XBTUSD) {
    scaled(side=sell, amount=1000, from=@19500, to=@20000, orderCount=30);

For even more examples, take a look at the examples section of the documentation.

Some images from Unsplash


Your TradingView alerts, with charts, PM'd to you.

Get all your alerts from TradingView, sent to Telegram, Discord, Slack, Email or webhooks, with a chart snapshot attached.

Capture Charts

See a high quality chart with every alert, captured at the moment the alert was triggered. See exactly what the market was doing and make informed decisions.

Automate Trading

Trigger orders on popular cryptocurrency exchanges and trade 24/7. Access powerful algorithmic orders to maximise your profits.


Connect your alerts to Telegram (channels, groups and private chats), Discord, Slack, email or send push notifications to other services with webhooks.

Easy To Setup

Nothing to install and no browser extensions. Captures alerts 24/7, even with your computer switched off. Be up and running in seconds.