Table of Contents
Introduction
Earlier we have seen how to integrate external signals in Growlonix via Telegram bot and Email Alerts
In this article we are going to look at how to integrate custom signals using webhook which is the most efficient method out of all the 3 modes of signal connection. This is because there is no third party server involved as in the case of email and telegram causing minor delay and an additional hop in the whole process. This method of connection can be used to automate alerts from Tradingview as well as any other app or your own code (if you are a developer) can be used to trigger trades.
Just like other methods of signal automation. This method also requires 3 steps.
- Create Signal Template in Growlonix
- Configure Trigger
- Send data to webhook URL from Tradingview or any other app.
1. Create Signal Template
Most common used template is Custom-OSO where a signal contains entry price, profit targets, and stop loss price. Other templates could be Market buy, market Sell, or any of the available order types as per the requirement.
Primary Order – Here in Stop Buy I have entered 0.002 BTC per trade as buy amount. So whenever a new signal is detected bot will buy that signal coin equivalent to 0.002 BTC. I have entered a random stop price which will later be replaced with buy price mentioned in signal. (Stop price should be less than current price for LTE)
Secondary Order – I have selected OCO sell as my secondary order. Click on Auto-Vol at the bottom of form to automatically populate sell volume based on buy volume. Enter some random value in stop loss stop price (less than current price), then enter any random value in take profit stop price (greater than current price). These prices will later be replaced with actual prices from signal.
2. Configure Trigger options
In the primary order click on Triggers button which will open up Trigger configuration form as shown below.
- Select trigger type as Webhook
- In Configuration type dropdown select “Generate new provider” if you are setting up a new signal configuration. you can also use “Enter existing provider” if you wish to copy same signals in multiple accounts.
- Enter any value in signal name field and click on save. System will auto generate two values which will be shown later how to use. First is provider Id and second is authentication key. Provider id is only needed if you wish to copy same signal in multiple accounts otherwise it can be ignored. Authentication key has to be passed as a json key value pair in the webhook request payload. we will demonstrate in later steps.
Signal Count field denotes for how many signals to use this trigger config. you can put fairly large number like 10000 to continuously keep opening trades based on same config. Fill other trigger parameters as per need or you can keep them empty. Hover on i icon to see help text along side each input box.
3. Send data to webhook
This section will describe how you can prepare different combination of json parameters to achieve different results. and will also guide how to connect tradingview.
Webhook Signal API format:
Request Type : POST
URL : https://www.Growlonix.com/api/signal
HEADER: “Content-Type: application/json”
Request Payload:
{
"key": "XXXXXXX-XXXXX-XXXXX",
"exchange_name": "binance", // tradingview variable {{exchange}}
"market": "USDT/AAVE", // tradingview variable {{ticker}}
"action": "create", // possible value - create,edit,close,cancel,exit
"algorithm": "day_trade",
"buyTarget": "-20%, -31%, -41%",
"buyTargetWeight": "25, 24, 51",
"takeProfit": "12%, 21%, 33%",
"takeProfitWeight": "51, 30, 29",
"stopLoss": "-30%",
"tsbTrailing" : 0.3,
"tslTrailing" : 0.4,
"sbTrailing" : 0.251,
"tpTrailing" : 0.351,
"slTrailing" : 0.3,
"clientSignalId": "1237877676567910150"
}
“key” : replace this with authentication key that you copied/saved in previous step.
“clientSignalId” : (optional) random number given by user to be used later to perform action on trades opened by this particular signal
“algorithm” : This field can be used to configure multiple strategies. While setting up trigger template there is a field containsAny and containsAll. Those two fields are used to only accept signal if it contains a set of whitelisted keywords. For example. put containsAny = “swing trades”. now signal must contain this keyword in order to execute any action. So we must pass this in our JSON as algorithm = “swing trades” for it to trigger the configured trades.
JSON keys marked in bold in above example are mandatory fields. (key, exchange_name, market, action)
There is no need to pass all the values given above. You only need to pass the keys you are using other than mandatory fields
Success response:
{
"success": true,
"data": "Signal Successfully Processed",
"id": "61179b5eb188730584f968d5"
}
Error response:
{
"status": false,
"msg": "Invalid Signal Provider"
}
Tradingview alert setup:
While creating alert in tradingview. Put https://www.growlonix.com/api/signal in webhook URL field. and Put JSON from previous step in Message box. It is marked with red arrow in above pic.
Examples of common use cases:
Create Orders Signal
This is used to open trades for all users who has configured trigger template and configured your webhook signal provider.
Trailing Stop Buy + Take profit
{
"api_key": "sensitive_info",
"exchange_name": "binance",
"market": "USDT/BNB",
"action": "create",
"tsbTrailing" : 0.3,
"takeProfit": "380,401",
"takeProfitWeight": "50,50",
"tslTrailing" : 0.4,
"clientSignalId": "12378776_any_random_number"
}
Stop Buy + OCO Sell
{
"api_key": "sensitive_info",
"exchange_name": "binance",
"market": "USDT/BNB",
"action": "create",
"buyTarget" : "380,385", // "-1%,-3%",
"buyTargetWeight": "50,50",
"sbTrailing" : 0.251,
"takeProfit": "400,420", // "3%,5%"
"takeProfitWeight": "50,50",
"tpTrailing" : 0.351,
"stopLoss": "350", // "-10%"
"slTrailing" : 0.3,
"clientSignalId": "12378776_any_random_number"
}
This signal format is same as create signal format and can be used to update any or all of the supported fields. One thing worth noting here is you must pass same slientSignalId in update call that you sent in create signal api.
Update Orders Signal
In case of any order having multiple targets. When you are sending update target info then it must contain price of already filled targets for that order. You can only change targets which are not yet filled.
Trailing Stop Buy + Take profit
{
"api_key": "sensitive_info",
"exchange_name": "binance",
"market": "USDT/BNB",
"action": "edit",
"tsbTrailing" : 0.3,
"takeProfit": "380,401",
"takeProfitWeight": "50,50",
"tslTrailing" : 0.4,
"clientSignalId": "12378776_any_random_number"
}
Stop Buy + OCO Sell
{
"api_key": "sensitive_info",
"exchange_name": "binance",
"market": "USDT/BNB",
"action": "edit",
"buyTarget" : "380,385",
"buyTargetWeight": "50,50",
"sbTrailing" : 0.251,
"takeProfit": "400,420",
"takeProfitWeight": "50,50",
"tpTrailing" : 0.351,
"stopLoss": "350",
"slTrailing" : 0.3,
"clientSignalId": "12378776_any_random_number"
}
This action can be used to cancel the entire trade group but only applicable if primary order is not yet filled. In case primary order is already filled then cancel signal will be ignored.
Cancel Orders Signal
{
"api_key": "sensitive_info",
"exchange_name": "binance",
"market": "USDT/BNB",
"action": "cancel",
"clientSignalId": "12378776_any_random_number"
}
This action can be used to force exit the secondary order in case primary order is already filled and secondary order is OPEN state. If primary order is not yet filled then this signal will be ignored.
Exit Orders Signal
{
"api_key": "sensitive_info",
"exchange_name": "binance",
"market": "USDT/BNB",
"action": "exit",
"clientSignalId": "12378776_any_random_number"
}
This is a combination of “exit” and “cancel” both the actions in either or condition.
If the primary order is still pending then the entire trade group will be cancelled. If primary is filled and secondary order is Open then it will force exit the secondary order.
Close Orders Signal
{
"api_key": "sensitive_info",
"exchange_name": "binance",
"market": "USDT/BNB",
"action": "close",
"clientSignalId": "12378776_any_random_number"
}
Our system identifies which trade to edit,close,exit,cancel based on clientSignalId from create signal. If multiple create signal has same clientSignalId then all other actions will be performed on last opened trade having same clientSignalId and matching coin pair.
Debug execution issues
First step to debug any signal related issue is click on logs button inside the triggers table corresponding to the trigger setup you are trying to debug.
Once the signal logs page opens. It will contain last 1000 signals received. Have a look at identified info column to cross check which info has been picked successfully by the system.
If you are a channel admin and have large user base contact us for more info about whitelabeled bot solutions that we offer and other admin features for Signal admin.
For any query do reach out to us on our support mail.
the request payload box do I copy and past this to my message box in tradingview platform?
Yes. JSON data should go in message box inside tradingview. We have updated our article have a look.