Webhook Data - Sending data within Webhooks
Last updated February 10, 2024
Webhook Endpoints can also accept other data you wish to send them as part of your strategies. For example, a BUY signal is good in itself, but you might also want to send information to support the trade, such as a take-profit or stop-loss value, or even a trading lot size. This is where TradeStory gets extremely powerful, giving you a way to accept external data, and execute Stories to process it and decide to make trades or run other actions based on the content of the data!
To do this, simply ensure the Webhook alert payload sent to your endpoints contains valid JSON data in the following format:
{
"data": {
}
}
Example: Sending stop-loss and take-profit levels as part of a webhook alert.
{
"data": {
"take_profit": 17660.50,
"stop_loss": 17600.50,
"lots": 10
}
}
In TradingView you can add dynamic values in your alerts: (See Tradingview docs for more info).
{
"data": {
"take_profit": {{plot("tp")}},,
"stop_loss": {{plot("sl")}},
"lots": {{strategy.position_size}}
}
You can access these values within your Stories using the Webhook Data item: