Automate TradingView Alerts to Binance USDM

Binance

You can now send TradingView alerts to Binance USDM thanks to the Tradingview to Anywhere tool. The bot uses human-like commands that can be combined with TradingView’s dynamic alert messages.

How to Automate TradingView Script to Binance

  1. Head over to TradingView To Binance and scroll to the step-by-step guide to get started.
  2. Create new Binance API keys and allow Spot, Futures & margin trading permissions.
  3. Bind your API keys to the following IP 34.89.98.97 and submit your API keys on the TradingView To Binance website..
  4. Follow the easy on-screen instructions provided till the end. Once you are done, you can proceed to set up alerts on TradingView as explained below:

Automating TradingView Strategy to Binance USDM
For a strategy with a long and short command only, use {{strategy.order.action}} which returns the string “buy” or “sell” for the executed order.
For a strategy with long, short, and exit/flat commands use {{strategy.market_position}} which returns the current position of the strategy in string form: “long”, “flat”, or “short”.

Specify the exchange, quantity, and account using the TradingView to Anywhere commands provided on the website just below the webhook.

Please note that quantity Q can be passed as either the token amount or as a percentage of your balance.

For Example;

  1. A strategy with long and short commands only.
    Close BTCUSDT A=USDM
    {{strategy.order.action}} BTCUSDT Q=0.02 L=20 A=USDM
    or
    Close BTCUSDT A=USDM
    {{strategy.order.action}} BTCUSDT Q=50% A=USDM

The close command has been applied on the first line to make sure any open positions are closed before opening new ones.

  1. A strategy with long, short, and exit commands,
    {{strategy.market_position}} BTCUSDT Q=0.02 L=10 A=USDM
    or
    *{{strategy.market_position}} BTCUSDT Q=50% A=USDM

In this case, there is no close command since the strategy can generate an exit command before the next order.

Automating TradingView Indicator to Binance UsdM
To automate a TradingView indicator to Binance:

  1. Create an alert from your indicator and choose the long or short option.
  2. Select once per bar close to avoid false signals.
  3. Paste your Webhook URL into the Webhook URL field.
  4. Paste the applicable buy/sell command in the message field.

For example;

  • For a Long condition, the applicable command will be;
    Close BTCUSDT A=USDM
    Buy BTCUSDT Q=0.03 L=5 A=USDM
    or
    Close BTCUSDT A=USDM
    Buy BTCUSDT Q=100% A=USDM

  • For a Sell condition, the applicable command will be;
    Close BTCUSDT A=USDM
    Sell BTCUSDT Q=0.03 L=5 A=USDM
    or
    Close BTCUSDT A=USDM
    Sell BTCUSDT Q=100% A=USDM

The close command is again applied on the first line to make sure that the previous position is closed before opening a new one.
Please note that there is no command for leverage and that the leverage is adjusted manually on the asset you intend to trade.

1 Like