How to Automate a TradingView Script to KuCoin Futures

kucoin
TradingView to Anywhere gives you the ability to automate any TradingView script to Kucoin Futures in 3 simple steps.

  1. Create your Tradingview to Kucoin Futures Webhook as shown here
  2. Create and submit your Kucoin Futures API keys as shown in this video
  3. Connect the Webhook to your TradingView alerts, and add our supported commands in the message field of the alert.

Done! You are now ready to automate your first script to KuCoin futures

Automating TradingView Strategy to Kucoin Futures

Where your strategy generates long, short, and exit commands, use {{strategy.market_position}}* - which returns the current position of the strategy in string form: “long”, “flat”, or “short”. For a strategy with long and short commands only, use {{strategy.order.action}} - which returns the string “buy” or “sell” for the executed order.

Go to your Webhook on TradingView to Anywhere website, select Manage, and just below your webhook, use the command provided to specify the asset to trade followed by the quantity, leverage, and the account. Quantity can be expressed either as a percentage of your balance, or the number of contracts.

The instrument symbol can easily be derived directly from the KuCoin futures chart link as shown. This link https://www.kucoin.com/futures/trade/XBTUSDTM takes you to the BTCUSDT chart on KuCoin, and from the last part of the link, we can see that the symbol name for this asset pair is XBTUSDTM. All other symbol names are derived the same way.

Example:

  1. A strategy with long, short, and exit commands:
    {{strategy.market_position}} XBTUSDTM Q=1 L=5 A=Futures
    or
    {{strategy.market_position}} XBTUSDTM Q=50% L=5 A=Futures

  2. A strategy with long and short commands only
    Close XBTUSDTM A=FUTURES
    {{strategy.order.action}} XBTUSDTM Q=1 L=5 A=Futures
    or
    Close XBTUSDTM A=FUTURES
    {{strategy.order.action}} XBTUSDTM Q=50% L=5 A=Futures
    This command will first close any open positions of XBTUSDTM before opening either a long or a short as per the strategy.

Visit TradingView’s strategy commands to learn more about the strategy commands.

Automating TradingView Indicator to KuCoin Futures
To automate a TradingView Indicator to Kucoin Futures, you need two alerts as follows

  1. The Buy alert with the buy condition selected. Paste the buy command in the message field of the alert.
  2. The Sell alert with the sell condition selected. Paste the buy command in the message field of the alert.

Example:

  1. Buy Alert; Paste the following command:
    Close XBTUSDTM A=Futures
    Buy XBTUSDTM Q=1 L=5 A=Futures
    This command will ensure any previous open position for XBTUSDTM is closed before going long.

  2. Buy Alert; Paste the following command:
    Close XBTUSDTM A=Futures
    Sell XBTUSDTM Q=1 L=5 A=Futures
    This command will ensure any previous open position for XBTUSDTM is closed before going short

You can add other parameters such as P to convert it to a limit order. Example: Sell XBTUSDTM Q=1 L=5 P=25000 A=Futures, will place a sell limit order at 25000.

That’s all, it is that simple! :slight_smile:

1 Like