Skip to content
Sign In
5 min read

Your First Webhook

Learn the message format, then connect an account when you are ready to execute.

BY THE END OF THIS PAGE, YOU'LL KNOW HOW TO:

Write a webhook that opens a trade

Add stop loss and take profit protection

Review it in Signal Factory before choosing an execution environment

0

Connect your exchange

Before you can send webhooks, you need to add an API key from your exchange (Binance, ByBit, OKX, or any supported exchange). Create one in your exchange's API management settings, then add it here:

Add API Key

The API Keys page shows the required IP whitelist for each exchange. Use Bybit Demo or a supported exchange Testnet with matching credentials. Signal Factory executes on the selected account; it is not a simulator.

1

Open a position

This is the simplest webhook possible. It buys BTC using 50% of your balance:

Smart Syntax
BTCUSDT on MyApiKey
market long 50%
BTCUSDT

= the trading pair (BTC against USDT)

on MyApiKey

= which exchange account to use (your API key label)

market long 50%

= buy now, at market price, using 50% of your total USDT balance converted to order quantity

2

Add a stop loss (protect yourself)

Never trade without protection. Add sl off 2% directly on the same line:

Smart Syntax
BTCUSDT on MyApiKey
market long 50% sl off 2%

This requests a stop loss 2% below the entry reference. Fill price, supported order types and protection placement depend on the exchange; inspect the execution result.

3

Add a take profit

Same idea. Add tp off 5% to lock in profits:

Smart Syntax
BTCUSDT on MyApiKey
market long 50% sl off 2% tp off 5%

Now you have a complete trade: entry + stop loss + take profit, all in 2 lines.

4

Try it now!

Go to the Signal Factory, paste your webhook, and hit Execute. You'll see the result in real-time.

Open Signal Factory

Beyond the basics

Inline vs separate lines

What you wrote above uses inline SL/TP (everything on the market line). You can also write them on separate lines:

Smart Syntax
BTCUSDT on MyApiKey
market long 50%
stoploss off 2%
takeprofit 50%p off 5%

When to use which?

inline

Simple case: one SL and one TP at entry. Quick and clean.

separate

When you need more control: partial closes (e.g. 50%p), multiple TP levels, or different trigger types:

Smart Syntax
BTCUSDT on MyApiKey
// For an existing long position; quantities are read at placement
if posLong continue
stoploss off e2%
// Two limit exits and one trigger exit, where supported
takeprofit-limit 50%p off e2%
takeprofit-limit 30%p rr2
takeprofit 20%p off e6%
smart-oco sell

OCO: cancel one when the other fills

With separate stoploss and takeprofit, both orders exist independently. If one fills, the other stays open.

Use sl-or-tp to make them cancel each other automatically (OCO = One Cancels Other):

Smart Syntax
BTCUSDT on MyApiKey
market long 50%
sl-or-tp short 100%p sl off 2% tp off 5%

short 100%p = sell 100% of position. Native linkage or the standard OCO monitor handles cleanup where supported. Cancellation is not an atomic or instantaneous guarantee.

Most common mistake

Price offsets always need a prefix keyword. Here's what works and what doesn't:

wrongstoploss 2%

- missing prefix

correctstoploss off 2%

- 2% away from current price

correctstoploss at 95000

- at exact price $95,000

correctstoploss off e2%

- 2% from entry price

Webhook structure

Every webhook follows the same format:

Smart Syntax
SYMBOL on ApiKeyLabel
command1 parameters
command2 parameters
SYMBOL

= the trading pair (BTCUSDT, ETHUSDT, SOLUSDT...)

ApiKeyLabel

= the label you gave your API key (e.g. "Binance-Main")

commands

= one or more trading commands, one per line

Amount & offset cheat sheet

Amounts

50%

50% of total balance; use 50%% for free balance

100%p

100% of open position

0.01

exact amount (e.g. 0.01 BTC)

Offsets (for SL/TP/limit)

off 2%

2% away from current price

off 100

$100 away from current price

at 95000

at exact price $95,000

off e2%

2% from entry price