Trading View Automation
  • Introduction
  • Setting Up Local Server
    • Setting Up HashiCorp Vault + EthSigner
    • Setting Up HashiCorp Vault (dev) + EthSigner
  • Setting Up Google Cloud Run
    • Setting Up Google KMS
  • Setting Up Heroku
  • Setting Up Env Vars
  • Setting Up Trading View Alert
  • Testing With sendAlert.js
  • Setting Up Google Sheets
  • Setting Up Telegram Notifications
  • Using Tmux
  • Using Git
Powered by GitBook
On this page

Setting Up Trading View Alert

To create an alert on Trading View, click on a Trading View ticker, then click "New Alert". In the webhook URL field under Notifications, enter your Ngrok, Google Cloud Run, or Heroku HTTPS URL. In the message field under Settings, enter a JSON message like the ones below.

For CEX trades (market trades only):

{
"exchange": "binancetest",
"side": "buy",
"ticker": "{{ticker}}",
"amount": "0.1",
"price": "{{close}}",
"alertName": "crossing up",
"password": "anypassword",
}

For DEX trades:

{
"exchange": "matcha",
"side": "buy",
"ticker": "{{ticker}}",
"network": "Polygon",
"amount": "0.1",
"price": "{{close}}",
"slippage1": "1",
"slippage2": "1",
"alertName": "crossing up",
"password": "anypassword",
}

An incorrectly typed JSON data will trigger a warning on the UI.

The message parameters are:

  • exchange: "binancetest", "binance", "coinbasetest", "coinbase", "coinbasepro", or "matcha"

    • coinbase is the Coinbase Advanced exchange

    • coinbasepro is either CoinbasePro or CoinbasePrime (it is not clear) and is only available for Coinbase Business Account holders

    • we highly suggest you select a ticker on Trading View that corresponds to the exchange used

    • for binancetest and binance, only a ticker ending in USDT is allowed

    • for coinbasetest, coinbase, and coinbasepro, only a ticker ending in USD is allowed

  • side: "buy" or "sell"

  • ticker: "{{ticker}}" is a placeholder for the name of the ticker associated with the alert (e.g., ETHUSDT), so do not change this

    • IMPORTANT: only certain tickers can be used for each exchange

      • if exchange is "binance" or "binancetest", the ticker must end in "USDT"

      • if exchange is "coinbasetest", "coinbase", or "coinbasepro", the ticker must end in "USD"

      • if exchange is "matcha", the ticker must end in "USDC" or "WETH"

  • amount: amount of base token, it can be any number in quotes

    • in a BTC/USDT pair, the base token is BTC, while the quote token is USDT

  • price: "{{close}}" is a placeholder for the closing price of the ticker, so not change this

  • alertName: any string

  • password: any string. Because anyone can submit a POST request to your webhook, the “password” ensures that no code is executed if the password is incorrect. Keeping your webhook URL secret will add additional security.

If exchange is "matcha", the additional parameters are:

  • network: "Ethereum", "Arbitrum", "Optimism", "Polygon", "BSC", "Base", or "Avalanche"

  • slippage1: any number in quotes. The number denotes a percentage ("1" = 1%). Slippage1 is the maximum difference between the "soft price" obtained from the Matcha API and the {{close}} price from Trading View. A favorable difference for you will not trigger a stoppage of execution.

  • slippage 2: any number in quotes. The number denotes a percentage ("1" = 1%). Slippage2 is the maximum difference between the "firm price" obtained from the Matcha API and the "guaranteed price". This is the slippage you enter in the Matcha UI. Exact calculations are handled in the Matcha backend.

PreviousSetting Up Env VarsNextTesting With sendAlert.js

Last updated 7 months ago