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
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 KeyThe 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.
Open a position
This is the simplest webhook possible. It buys BTC using 50% of your balance:
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
Add a stop loss (protect yourself)
Never trade without protection. Add sl off 2% directly on the same line:
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.
The off keyword is required. Writing sl 2% without off will give you an error.
Add a take profit
Same idea. Add tp off 5% to lock in profits:
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.
Try it now!
Go to the Signal Factory, paste your webhook, and hit Execute. You'll see the result in real-time.
Open Signal FactoryBeyond 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:
BTCUSDT on MyApiKey
market long 50%
stoploss off 2%
takeprofit 50%p off 5%When to use which?
Simple case: one SL and one TP at entry. Quick and clean.
When you need more control: partial closes (e.g. 50%p), multiple TP levels, or different trigger types:
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 sellOCO: 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):
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:
stoploss 2%- missing prefix
stoploss off 2%- 2% away from current price
stoploss at 95000- at exact price $95,000
stoploss off e2%- 2% from entry price
Webhook structure
Every webhook follows the same format:
SYMBOL on ApiKeyLabel
command1 parameters
command2 parametersSYMBOL= 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%p100% of open position
0.01exact 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 95000at exact price $95,000
off e2%2% from entry price