You can automate your TradingView strategy or indicators to Coinbase Futures by creating alerts on your TradingView chart using a Webhook and setting the alert message according to the commands below.
You can also trade using our Alert Detector Chrome extension to send your alerts to the webhook you created.
For strategies, you can generate the action automatically when your alert is fired using TradingView’s placeholders, such as:
{{strategy.market_position}} {{strategy.order.action}} {{strategy.alert_message}}
See more about generating dynamic alerts here.
Command Format
The structure of commands used to automate trades is as follows:
[command] [symbol] [param]=[value]
Where:
- command: Specifies the action to be executed, such as ‘buy’ or ‘sell’.
- symbol: Indicates the trading pair or instrument, like ‘BTC/USDT’.
- param: Defines specific parameters for the trade, such as quantity, leverage, or stop-loss.
- value: Assigns the value to the specified parameter.
Parameters
Several parameters can be customized within commands to control trade execution:
- Q: Quantity of the asset to trade (in tokens or as a % of balance). Example: Q=0.01 or Q=50%. Default is Q=100%.
- OQ & CQ: Opening Quantity and Closing Quantity used in some cases to override Q.
P: * P: Entry price for limit orders. Either as an actual price or as a percentage. Example: P=1.2345 or P=2%.
C: The symbol category to trade (SPOT or FUTURES). - B: Check your account balance. Either the total or the free balance.
Important Notes
-
Case Sensitivity
Symbol names are case-sensitive and must be typed as they appear on Coinbase. You can obtain the correct format from the symbol’s Web URL. -
Parameters Formatting
A single space should separate the parameters.- Correct:
Q=0.5 Quantity=0.5
- Incorrect:
Q = 0.5 Quantity = 0.5
- Correct:
-
Multi-Commands
You can include up to 5 commands in a single alert. Each command should start on a new line for clarity. Example:
balance B=Total
CLOSE ET-31OCT25-CDE Q=0.05 C=FUTURES
SELL SOL-31OCT25-CDE Q=0.01 C=FUTURES
BUY XLM-31OCT25-CDE Q=100 C=FUTURES
Supported Commands
1. Open an Order
The actions Buy, Long, or 1 open a buy trade, while Sell, Short, or -1 open a sell trade.
Optional Parameters
-
Quantity (Q) – Size of the order, either as a fixed token amount or as a percentage of your balance.
Can also be sent as Opening Quantity (OQ).
Example:Q=0.01,Q=50%,OQ=0.01
Default:Q=100% -
Price (P) – Entry price for limit orders, given as an actual price or a percentage offset from the market.
Example:P=1.2345orP=2% -
Category (C) – The trading category. Options:
SPOTorFUTURES.
Default:C=SPOT
Examples
buy XLM-31OCT25-CDE q=25% C=FUTURES
Buys XLM using 25% of your available balance in your futures account.
{{strategy.market_position}} DOG-31OCT25-CDE q=12 p=3% c=futures
Places a limit order to buy or sell 12 DOGE tokens in your futures account,
at a target price 3% higher or lower than the market, depending on the strategy direction.
{{strategy.order.action}} BIT-31OCT25-CDE q=0.01 C=FUTURES
Places a trade worth 0.01 BTC in your futures account according to the strategy signal.
2. Close a Futures Order
Actions: Close, Flat, or 0 exit open futures trades.
Required Parameter
- Category (C) – Must specify the trade category. Example:
C=FUTURES
Optional Parameter
- Quantity (Q) – Amount to close (in tokens or %).
Can also be sent as Closing Quantity (CQ).
Default:Q=100%
Examples
CLOSE ET-31OCT25-CDE q=100% c=futures
Closes 100% of the open ETHUSD futures trade.
flat SOL-31OCT25-CDE C=FUTURES
Closes all open SOL positions in the futures account.
3. Cancel a Limit Order
Actions: Cancel or Exit cancel any pending limit order.
Required Parameter
- Category (C) – Specify the trading category. Example:
C=FUTURES
Examples
Cancel BIT-31OCT25-CDE C=Futures
Cancels all BTC limit orders in your futures account.
4. Balance Check
Actions: Balance, Bal, or Funds request account balance information.
Optional Parameters
-
Balance (B) – Type of balance to query. Options:
Free– Available funds not in open positions
Total– Total account balance
Default:B=Free -
Category (C) – Trading category. Options:
SPOT,FUTURES
Default:C=SPOT
Examples
Balance
Returns the total balance of all assets.
Balance b=Free c=futures
Returns the free balance of all assets in your futures account.
You’re now ready to automate your TradingView alerts directly to Coinbase futures using TradingView to Coinbase.
Set up your webhook, connect your account, and let your strategies trade automatically in real time.
Need help? Contact our support team or start a live chat on TradingView.to.