This strategy allows you to execute your strategy defined in TradingView using the webhook. Opening and closing positions are realized using market orders, so your strategy must count with that.
How to create bot
- Create your strategy in TradingView that will call the API of ChainTerminal platform.
- Create TradingView bot in ChainTerminal platform
- Select name of your bot
- Select what will be the Quote Asset of futures markets
- Select the quantity (cost) of your position that will be opened when the signal comes. Quantity can be set as one of the:
- Fixed – absolute value
- % – percentage of your available balance (so the absolute value can vary for every signal incoming as your available balance fluctuates)
- Select Type of TradingView bot:
- Long – for bull trending market
- Short – for bear trending market
- Copy Webhook url that was generated specially for your bot and use it in TradingView
- In TradingView the call to ChainTerminal API should meet this requirements:
Type: POST
Url: copied url from TradingView bot
Message body type: JSON
Message body structure:- baseAsset: string
- side: BUY / SELL
Example:
{
“baseAsset”: “BTC”,
“side”: “BUY”
}
How Does It Work
Long Type
ChainTerminal receives a signal and validates it (if bot is running, if market exists, etc.).
Then it checks your position on that market (if is open, if is short/long).
Depending on the signal it executes order or ignores the signal.
Possible cases:
Position status | Signal side | Outcome |
Not opened | BUY | Open position (place market buy) |
Long | BUY | Increase position by selected quantity (place market buy) |
Long | SELL | Close position (place market sell) |
All other cases are ignored.
Short Type
ChainTerminal receives a signal and validates it (if bot is running, if market exists, etc.).
Then it checks your position on that market (if is open, if is short/long).
Depending on the signal it executes order or ignores the signal.
Possible cases:
Position status | Signal side | Outcome |
Not opened | SELL | Open position (place market sell) |
Short | SELL | Increase position by selected quantity (place market sell) |
Short | BUY | Close position (place market buy) |
All other cases are ignored.