Signal Commands
Complete reference for all webhook commands, parameters, and usage examples.
PineHook supports 29 webhook commands for opening, closing, and managing trades on your MT5 terminal. This page covers every command with descriptions, accepted parameters, and usage examples.
Concepts explains how a signal is built, the Command Catalog lets you search every command, and the Parameters Reference holds the shared parameter glossary.
Signal Formats#
Every signal requires three core fields: your license key, a command (action), and a symbol. Additional parameters vary by command. Both formats below are auto-detected, so you can use whichever your alert source prefers.
CSV
LICENSE_KEY,action,SYMBOL,param1=value1,param2=value2
JSON
{
"license": "LICENSE_KEY",
"action": "buy",
"symbol": "EURUSD",
"size_lots": 0.1,
"sl_pips": 50,
"tp_pips": 100
}
Field Order
The first three values are positional and must appear in order. Parameters after the symbol can appear in any order and are separated by commas.
Both Formats Work Everywhere
The webhook endpoint auto-detects whether your message is CSV or JSON. You can use either format for any command.
Symbols are 1 to 20 uppercase letters and digits (A-Z, 0-9), for example EURUSD, XAUUSD, or MNQM26. Lowercase input is uppercased automatically. The special value ALL targets every instrument; it is what the account-wide commands (closeall, cancelall, eaon/eaoff) act on when you omit a specific symbol.
Signal Authentication#
Signal Authentication is a per-license switch. Turn it on and set a password, and every webhook alert for that license must include auth=<your password> (CSV) or "auth":"<your password>" (JSON), or the signal is blocked and nothing is executed. This applies to every command with no exceptions. A missing password is blocked and logged with the reason missing_auth; a wrong password is blocked with the reason invalid_auth. Both appear in your Signal Logs. Turn it off and no alert needs auth=: if one is present it is parsed and then ignored. Either way the password is never stored. It is scrubbed from the saved signal record and never forwarded to your EA.
You configure this in your dashboard. Open the License card, go to Signal Authentication, toggle it on, and set a password (8 to 72 characters, case-sensitive). Enabling requires setting a password. There is no per-command selection: the switch covers the whole license.
| Parameter | Type | Description |
|---|---|---|
auth | string | Signal authentication password. Required on every signal when Signal Authentication is enabled on the license, and ignored when it is disabled. Must match the password configured on the license. |
LICENSE,buy,EURUSD,size_lots=0.1,auth=MySecretPass123
{"license":"LIC","action":"buy","symbol":"EURUSD","size_lots":0.1,"auth":"MySecretPass123"}
Recommended
Enable signal authentication on every license. Without it, anyone who knows your license key can send signals to your EA. A password ensures only your TradingView alerts can execute trades on your account.
Command Catalog#
Search for a command by name or description, or filter by category. Click any result to jump to its full reference. Every command links to the shared Parameters Reference below.
29 commands match
- buyOpen a long position at market price
- sellOpen a short position at market price
- buylimitBuy below the current price
- buystopBuy above the current price (breakout)
- selllimitSell above the current price
- sellstopSell below the current price (breakdown)
- buyatBuy at price (auto-selects limit or stop)
- sellatSell at price (auto-selects limit or stop)
- closelongClose all long positions on a symbol
- closeshortClose all short positions on a symbol
- closeallClose all positions on a symbol
- closecancelallClose all positions and cancel all pending orders
- closeallprofitClose all profitable positions
- closealllossClose all losing positions
- closealleaoffClose all positions and disable the EA
- closecancelalleaoffClose all positions, cancel all pending orders, and disable the EA
- modifyModify SL/TP on positions or pending orders
- breakevenMove stop loss to entry price
- trailAdd or update a trailing stop
- notrailRemove a trailing stop (keeps current SL level)
- nobreakevenRemove an auto-breakeven monitor (keeps current SL level)
- cancellongCancel pending buy orders
- cancelshortCancel pending sell orders
- cancelallCancel all pending orders
- clearqueueClear queued delayed signals (renamed from canceldelay)
- eaonEnable trading for a symbol
- eaoffDisable trading for a symbol
- eaoffexceptSwitch to whitelist mode with specified symbols
- eaonexceptSwitch to blacklist mode with specified symbols
Place Orders#
Market Orders#
Market orders execute immediately at the current market price. They do not require a price parameter. All order parameters (position sizing, stop loss, take profit, multi-target TP/SL, slippage protection) apply to market orders.
Open a long position at market price
Opens a long position at the current market price. If no lot size is specified in the signal, the EA uses its configured Default Lot Size.
Open a short position at market price
Opens a short position at the current market price. Accepts the same parameters as buy.
Pending Orders#
Pending orders are placed at a specific price level and execute when the market reaches that price. All pending order commands require the price parameter to specify the entry level. All order parameters (position sizing, stop loss, take profit, multi-target TP/SL, slippage protection) also apply to pending orders.
Pending-specific parameters:
| Parameter | Type | Description |
|---|---|---|
price | float | Entry price for the pending order. Required for all pending order commands. |
expiry | int | Time in seconds until the pending order expires. Set to 0 for good-until-canceled. The EA manages expiration internally. Maximum 86,400 seconds (24 hours) on every plan; values above this are rejected with HTTP 400 and recorded in Signal Logs → Rejected Signals. Trial accounts are further capped at 900 seconds (15 minutes); over-cap on trial returns HTTP 402 with an upgrade prompt. |
expiry_time | string | Exact expiration time in ISO 8601 format. Takes priority over expiry. Interpreted as UTC: a bare (2025-01-15T14:30:00) or Z-suffixed (…Z) timestamp is UTC, and an explicit ±HH:MM offset (…+02:00) is honored and converted to UTC. The EA then converts the resulting UTC instant to broker server time for placement, so it expires at the correct real-world moment on any broker. To express broker-local time, append your broker's UTC offset. See the timezone callout below. |
Buy below the current price
Places a buy order below the current ask price. The order fills when price drops to the specified level. Used for buying on pullbacks or at support.
Buy above the current price (breakout)
Places a buy order above the current ask price. The order fills when price rises to the specified level. Used for breakout entries.
Sell above the current price
Places a sell order above the current bid price. The order fills when price rises to the specified level. Used for selling at resistance.
Sell below the current price (breakdown)
Places a sell order below the current bid price. The order fills when price drops to the specified level. Used for breakdown entries.
Price-targeted entries that auto-select limit or stop based on the current market price.
Price-targeted entries that automatically choose between limit and stop based on the current market price. If the target price is below the current ask, buyat places a buy limit. If it is above, it places a buy stop. The same logic applies to sellat using the bid price.
Useful when you want to enter at a specific level and let the EA determine the correct order type.
Close Positions#
Close and cancel commands ignore Active Hours
The Active Hours time filter gates entry signals only. Every close and cancel command on this page runs regardless of the active window, so you can always exit or adjust an open position after the close hour passes.
Account-wide scope and guaranteed execution
Omit the symbol on a sweep command (closeall, closecancelall, closeallprofit, closeallloss, cancelall, clearqueue, and the closealleaoff variants) and it acts on every instrument instead of one. That is the account-wide emergency brake.
Close commands also always execute. The EA submits them with a wide deviation tolerance (around 5,000 pips, or 50,000 points) so a fill is never blocked by a fast or thin market. If the fill slips far from the expected price the position still closes, and the unusual slippage is disclosed on the signal's row in Signal Logs rather than rejected.
Close Parameters#
| Parameter | Type | Description |
|---|---|---|
close_pct | float | Close a percentage of the original/initial position volume (0-100). For example, close_pct=50 closes 50% of the volume the position was opened with, regardless of prior partial closes. |
close_lots | float | Close a specific lot amount. For example, close_lots=0.5 closes exactly 0.5 lots. |
minprofit | float | Minimum favourable movement in price pips. Used with closeallprofit, which decides whether a position is a winner on net P&L (incl. swap + commission); minprofit is a separate pip-magnitude filter on top of that. |
maxloss | float | Maximum adverse movement in price pips. Used with closeallloss, which decides whether a position is a loser on net P&L (incl. swap + commission); maxloss caps the pip magnitude. |
Use either close_pct for percentage-based closing or close_lots for fixed volume closing (not both). close_pct calculates the close amount based on the position's original/initial volume, not the current remaining volume. This means multiple partial closes sum predictably: two close_pct=50 signals close 50% + 50% = 100% of the original position, not 50% + 25% = 75%. If the calculated amount exceeds the remaining volume, the EA closes the maximum available (effectively a full close).
Automatic Volume Rounding
Partial close volumes are rounded to comply with broker lot requirements. The EA rounds down to the nearest lot step, enforces the minimum lot size, and automatically falls back to a full close if rounding would close the entire position. For example, closing 90% of a 0.01 lot position (0.009 lots) with a 0.01 minimum lot size rounds down below the minimum, triggering a full close.
Symbol Filter Bypass
Close commands (like closeall, closelong, closeshort, etc.) always bypass symbol filters. Even if a symbol is disabled via eaoff or excluded from the whitelist, close commands will still execute. Only new trade commands (buy, sell, pending orders) are subject to symbol filtering.
Close all long or all short positions on a symbol (full or partial).
closelong closes all open buy positions on a symbol. closeshort closes all open sell positions on a symbol.
Both commands support full or partial closing:
- Full close: Omit the close parameters to close all positions
- Partial close (percentage): Use
close_pct=50to close 50% of the original position volume - Partial close (fixed lots): Use
close_lots=0.5to close exactly 0.5 lots
Close all positions on a symbol
Closes all open positions on a symbol, regardless of direction. Supports partial closing.
Close all positions and cancel all pending orders
Closes all open positions on a symbol and cancels all pending orders on that symbol in a single command.
Close only the positions that are net-profitable, or only those at a net loss.
closeallprofit closes only positions whose net P&L is positive — floating (price) profit plus swap and commission. A position that is up on price but underwater once swap and commission are counted is treated as a loss and left open. Use minprofit to add a minimum threshold in price pips (a separate magnitude filter, not net money).
closeallloss closes only positions whose net P&L is negative — so a price-positive position that swap/commission have turned net-negative will be closed. Use maxloss to set a maximum threshold in price pips.
Close all positions and disable the EA
Closes all open positions and then disables the EA with a global emergency-stop latch. This is sticky: only eaon,ALL re-enables trading; a per-symbol eaon, a settings change, or an EA restart will not clear it.
Close all positions, cancel all pending orders, and disable the EA
Closes all open positions, cancels all pending orders, and then disables the EA with a global emergency-stop latch. This is sticky: only eaon,ALL re-enables trading; a per-symbol eaon, a settings change, or an EA restart will not clear it. This is the most comprehensive emergency shutdown command.
Trade Management#
Modify SL/TP on positions or pending orders
The modify action changes the stop loss and/or take profit on open positions or pending orders. It never opens, closes, or resizes a position. Like buy or sell, modify replaces the action in the three mandatory fields of a signal: LICENSE,modify,SYMBOL.
By default, modify targets your open positions on the symbol. To modify pending orders instead, add the order_type parameter (buylimit, buystop, selllimit, or sellstop). It also supports direction filtering, target filtering, and multi-target TP/SL editing.
Base and per-target edits apply together. A single modify can carry both a base SL/TP change (sl_price/sl_pips/tp_price/…) and per-target leg edits (tp1_pips, sl1_price, …) — all of them apply in the one command. The ACK is success:true only if every part applied; an invalid base move (e.g. a stop on the wrong side of price) reports failure with the base error and is never masked by a valid leg edit.
Key parameters:
| Parameter | Type/Values | Description |
|---|---|---|
sl_pips | float (pips) | New stop loss distance in pips from entry |
sl_price | float (price) | New stop loss at exact price level |
sl_pct | float (%) | New stop loss as a percentage distance from entry |
tp_pips | float (pips) | New take profit distance in pips from entry |
tp_price | float (price) | New take profit at exact price level |
tp_pct | float (%) | New take profit as a percentage distance from entry |
direction | long, short | Filter by position direction |
target | sl, tp, both | Which value to modify (default: both) |
order_type | buylimit, buystop, selllimit, sellstop | Target pending orders instead of positions |
magic | integer | Only modify positions/orders with this magic number |
Set an SL or TP value to 0 to remove it entirely.
Move stop loss to entry price
Moves the stop loss to the entry price (breakeven).
Use offset parameters to lock in profit or set a specific SL level. Use trigger parameters (with buy/sell actions) to auto-activate breakeven after a profit threshold.
breakeven has no direction filter. It moves the stop on every matching position for the symbol and magic, including both sides on a hedging account, and each ticket is moved to its own entry price. To change the stop on only one side, use modify with direction=long or direction=short.
Offset types (mutually exclusive; only one allowed):
be_offset_pips: pips from entry. Positive = lock profit, negative = buffer below entry.be_offset_pct: percentage of entry price. Rounded down to nearest tick size.be_offset_price: absolute SL price. Must align with symbol's tick size.
Trigger types (mutually exclusive, only one allowed):
be_trigger_pips: pips of profit before auto-BE activates.be_trigger_pct: % of profit before auto-BE activates.be_trigger_price: price level to trigger auto-BE.
Auto-trigger
When included in a buy/sell signal, the EA monitors the position on every tick. Once profit reaches the trigger level, the SL moves to breakeven (plus offset, if specified). The trigger fires once and is removed. Settings persist across EA restarts. Active triggers are shown on the chart overlay.
Add or update a trailing stop
Registers or updates a trailing stop on open positions. The trailing stop dynamically moves the SL in the direction of profit, maintaining a fixed distance from the best price reached.
Use distance parameters to set how far the SL trails behind price. Use trigger parameters (with buy / sell actions) to delay activation until a profit threshold is reached.
Distance modes (mutually exclusive, only one allowed):
distance_pips: trail distance in pips. Fixed pip-based trailing.distance_pct: trail distance as a percentage of entry price (range: greater than 0, up to 99). Scales with price level.distance_atr: trail distance as a multiple of the ATR indicator (range: 0.1 to 20). Dynamic, volatility-based trailing.
Trigger activation (mutually exclusive, only one allowed):
trail_trigger: pips of profit before trailing activates.trail_trigger_pct: % of profit before trailing activates.trail_trigger_price: price level to trigger trailing.
Step parameters (optional, prevent excessive SL modifications):
trail_step: minimum SL move increment in pips.trail_pct_step: minimum SL move as a percentage of entry price.
ATR configuration (for distance_atr mode):
trail_atr_period: ATR lookback period (2 to 500). Default: 14.trail_atr_timeframe: timeframe for ATR calculation (M1, M5, M15, M30, H1, H4, D1, W1, MN1). Default: the EA's current chart timeframe (whatever chart the EA is attached to). Set it explicitly for deterministic behavior.
Auto-trigger
When included in a buy/sell signal, the EA monitors the position on every tick. Once profit reaches the trigger level, the trailing stop activates and begins moving the SL. Active trails persist across EA restarts. Chart overlay displays trigger levels and current trail status.
Trailing Stop + Breakeven Interaction
Both trailing stop and auto-breakeven triggers can be registered on the same position. They coexist until one fires first. Whichever fires removes the other to prevent conflicting SL modifications. If both triggers resolve to the same price level (within 1 pip), neither is registered and the ACK includes a warning. The trade itself and other features (multi-TP/SL, timed close) are unaffected.
Remove a trailing stop (keeps current SL level)
Removes the trailing stop from open positions on a symbol. The current stop loss level is preserved. Only the trailing behavior is stopped.
Remove an auto-breakeven monitor (keeps current SL level)
Removes auto-breakeven monitors from open positions on a symbol. The current stop loss level is preserved. Only the automated breakeven monitoring is stopped.
This is the counterpart to the auto-breakeven trigger set via be_trigger_pips, be_trigger_pct, or be_trigger_price on buy/sell signals. If you set an auto-breakeven when opening a position but market conditions change, use nobreakeven to cancel the pending trigger without affecting the current SL.
Monitor Removal Only
This command removes the auto-trigger monitor, not an immediate breakeven. To move SL to breakeven right now, use the breakeven command instead.
Cancel Orders#
Cancel pending buy orders, sell orders, or all of them on a symbol.
Cancel pending orders on a symbol. cancellong cancels all pending buy orders (buy limit and buy stop). cancelshort cancels all pending sell orders (sell limit and sell stop). cancelall cancels all pending orders regardless of direction.
Clear queued delayed signals (renamed from canceldelay)
Clears queued delayed signals: signals you sent with the delay parameter that are waiting to fire on the server. This command removes them from the queue before they execute. It operates on the server-side queue only and does not touch pending orders on MT5 (for those, use cancellong / cancelshort / cancelall).
Renamed from
canceldelayfor clarity. The old name is rejected with an actionable error; update your TradingView alerts to useclearqueue. Same parameters, same semantics.
Omit the symbol or use ALL to clear queued signals across all instruments. Specify a symbol to target only that instrument. Optionally filter by magic number.
EA Control#
These commands control which symbols the EA is allowed to trade. Changes persist to the database and survive EA restarts. For a full explanation of blacklist and whitelist modes, see the Symbol Filtering section in the EA Configuration guide.
Enable or disable trading for a symbol (or ALL symbols).
eaon enables trading for a symbol. In blacklist mode, it removes the symbol from the blacklist. In whitelist mode, it adds the symbol to the whitelist.
eaoff disables trading for a symbol. In blacklist mode, it adds the symbol to the blacklist. In whitelist mode, it removes the symbol from the whitelist.
Use ALL as the symbol to enable or disable all trading at once.
Switch to whitelist or blacklist mode with a specified set of symbols.
eaoffexcept switches to whitelist mode and enables only the listed symbols. Every other symbol is disabled.
eaonexcept switches to blacklist mode and disables only the listed symbols. Every other symbol is enabled.
Separate multiple symbols with a semicolon.
At least one symbol is required
Both eaoffexcept and eaonexcept are rejected if sent without any symbols. The rejection appears in Signal Logs → Rejected Signals with the reason:
eaoffexcept(no symbols) → "eaoffexcept requires at least one symbol. Provide a semicolon-separated list (e.g., eaoffexcept=EURUSD;GBPUSD) of symbols to allow."eaonexcept(no symbols) → "eaonexcept requires at least one symbol. Provide a semicolon-separated list (e.g., eaonexcept=XAUUSD;BTCUSD) of symbols to block."
If your intent is to block all trading, use eaoff,ALL instead. If your intent is to enable all trading, use eaon,ALL.
Symbol filter is capped at 100 symbols
The active symbol filter (blacklist or whitelist) cannot contain more than 100 symbols. Any EA control command — eaon, eaoff, eaoffexcept, eaonexcept, or an inline eaon= / eaoff= on a trade command — that would push the filter past 100 entries is rejected with block_reason="filter_list_too_long". The filter is left unchanged when this happens.
The rejection message names the would-be size and suggests the inverse filter mode:
- Blacklist would exceed 100 → "Consider using
eaoffexcept(whitelist mode) to allow only the symbols you want to trade, typically a much shorter list than blacklisting everything else." - Whitelist would exceed 100 → "Consider using
eaonexcept(blacklist mode) to block only the symbols you don't want, typically a much shorter list than whitelisting everything you do want."
If you find yourself approaching the limit on either side, the inverse mode is almost always the cleaner expression of your intent.
EA Control as Inline Parameters
The eaon and eaoff parameters can be attached to any trade command. The ordering rule is eaon before, eaoff after:
eaonis applied before the trade is evaluated. SoLICENSE,buy,EURUSD,eaon=EURUSDre-enables EURUSD first, then evaluates the buy against the new state — re-enable-and-enter works in one signal.eaoffis applied after the trade is queued. SoLICENSE,sell,EURUSD,eaoff=EURUSDexecutes the sell against the still-enabled state, then disables EURUSD for future signals — exit-and-disable also works in one signal.
This ordering means LICENSE,buy,EURUSD,eaoff=EURUSD is a "one final entry, then stop" pattern: the buy executes once, and any subsequent buy on EURUSD is rejected because the symbol is now blacklisted. Close commands always bypass the symbol filter, so closelong,EURUSD,eaoff=EURUSD cleanly closes existing longs and disables the symbol whether or not it was already disabled.
If an inline eaoff= would push the symbol filter past the 100-symbol limit, the trade still executes (the queued Signal row reflects the trade outcome), but the response body includes a filter_warning field naming the rejection reason and the suggested inverse-mode command. The filter is left unchanged.
Parameters Reference#
The parameters below are shared across commands. Each command above links here for the full glossary.
Order Parameters#
These parameters apply to both market orders and pending orders. All parameters are optional unless noted otherwise.
Position Sizing#
| Parameter | Type | Description |
|---|---|---|
size_lots | float | Fixed lot size for the trade (e.g., 0.1, 1.0, 0.01). |
size_pct | float | Risk a percentage of the account balance. Requires a stop loss to calculate the lot size. Range: greater than 0, up to 100. |
If neither is specified, the EA uses its configured Default Lot Size. If both are present, the signal is rejected. Use only one sizing method per signal.
Stop Loss#
| Parameter | Type | Description |
|---|---|---|
sl_pips | float | Stop loss distance in pips from entry price. |
sl_price | float | Stop loss at an exact price level. |
sl_pct | float | Stop loss as a percentage distance from entry price (e.g., 1.5 = 1.5%). |
Use only one format per signal. Specifying multiple formats (e.g., both sl_pips and sl_price) will cause the signal to be rejected with an error.
Take Profit#
| Parameter | Type | Description |
|---|---|---|
tp_pips | float | Take profit distance in pips from entry price. |
tp_price | float | Take profit at an exact price level. |
tp_pct | float | Take profit as a percentage distance from entry price (e.g., 2.0 = 2.0%). |
Use only one format per signal. Specifying multiple formats (e.g., both tp_pips and tp_price) will cause the signal to be rejected with an error.
Multi-Target TP/SL#
Define up to 10 take profit and 10 stop loss levels, each with a partial close amount. When the price hits a target level, the EA closes a portion of the position and moves to the next.
Individual parameter syntax (CSV and JSON):
| Parameter | Description |
|---|---|
tp1_pips through tp10_pips | TP level distance in pips from entry |
tp1_price through tp10_price | TP level at an exact price |
tp1_pct through tp10_pct | TP level as a percentage distance from entry |
tp1_close through tp10_close | Percentage of the original volume to close at this TP level |
tp1_lots through tp10_lots | Fixed lot amount to close at this TP level |
sl1_pips through sl10_pips | SL level distance in pips from entry |
sl1_price through sl10_price | SL level at an exact price |
sl1_pct through sl10_pct | SL level as a percentage distance from entry |
sl1_close through sl10_close | Percentage of the original volume to close at this SL level |
sl1_lots through sl10_lots | Fixed lot amount to close at this SL level |
Use only one format per level. Each level (e.g., TP1, SL2) must use only one distance format: _pips, _price, or _pct. Mixing formats within a single level will cause the signal to be rejected.
You must use either _close (percentage) or _lots (volume) consistently across all levels, not both. Close percentages must sum to exactly 100%. Fixed-lot mode is recommended for whole-unit-step instruments like futures (e.g. MNQM26, where volume_step=1.0) to avoid rounding surprises when percentages don't divide evenly into the position size. In fixed-lot mode the per-level lots are floored to the lot step, raised to the broker minimum, and capped to the cumulative remaining position — they can never sum to more than the position holds (later levels go to 0 and the last affordable level is trimmed).
A single TP/SL cannot coexist with a multi-TP/SL ladder. Sending both a base tp_pips/tp_price/tp_pct and a multi-TP ladder (tp1_*…tp10_*) in one signal is rejected — use one or the other (likewise for SL). Target indices above 10 (tp11_*) are rejected rather than silently ignored; a malformed compact tp_pips/sl_pips string (a bad number, a percentage over 100, or a trailing remainder that resolves to 0%) is rejected rather than silently dropped into a position with no targets (a complete single level like 30:100 is accepted); and every per-level close volume (tpN_lots / JSON close_lots) must be positive and finite. The per-level format-conflict check above is enforced on modify as well as on entry.
No Gaps Allowed
Targets must be numbered sequentially with no gaps. tp1, tp2, tp3 is valid. tp1, tp3, tp5 (skipping TP2 and TP4) will be rejected.
Pro Tip: Compact Multi-Target Syntax (CSV)
Instead of listing tp1_pips, tp1_close, tp2_pips, tp2_close, etc. separately, you can define all targets in a single parameter using semicolons:
LICENSE,buy,EURUSD,size_lots=0.3,tp_pips=30:50;60:30;100,sl_pips=25
How to read it: each semicolon-separated entry is pips:close_pct, so 30:50;60:30;100 means:
- TP1 at 30 pips → close 50% of the position
- TP2 at 60 pips → close 30%
- TP3 at 100 pips → close the remaining 20% (percentage omitted = gets whatever is left)
The compact form is pips + percentage only — it works for tp_pips and sl_pips. For absolute price or percent-distance levels, or for fixed-lot closes, use the individual tpN_*/slN_* parameters or the JSON tp_targets/sl_targets arrays (tp_price=...:... / tp_pct=...:... are not compact and will be rejected).
Fixed-lot variant (CSV): use the per-level tpN_lots parameters when you want exact contract counts instead of percentages. Compact pips:lots semicolon syntax is not supported; list each level explicitly:
LICENSE,buy,EURUSD,size_lots=0.3,tp1_pips=30,tp1_lots=0.1,tp2_pips=60,tp2_lots=0.1,tp3_pips=100,tp3_lots=0.1,sl_pips=25
JSON array format:
The same example using JSON uses tp_targets and sl_targets arrays instead. Each target object accepts either close_pct (percentage of original position) or close_lots (exact volume). Pick one and use it consistently across the array.
Percentage-based:
{
"license": "LICENSE",
"action": "buy",
"symbol": "EURUSD",
"size_lots": 0.3,
"tp_targets": [
{"pips": 30, "close_pct": 50},
{"pips": 60, "close_pct": 30},
{"pips": 100, "close_pct": 20}
],
"sl_targets": [
{"pips": 20, "close_pct": 50},
{"pips": 40, "close_pct": 50}
]
}
Fixed-lot equivalent (close exactly 0.1 lots at each TP and 0.15 lots at each SL):
{
"license": "LICENSE",
"action": "buy",
"symbol": "EURUSD",
"size_lots": 0.3,
"tp_targets": [
{"pips": 30, "close_lots": 0.1},
{"pips": 60, "close_lots": 0.1},
{"pips": 100, "close_lots": 0.1}
],
"sl_targets": [
{"pips": 20, "close_lots": 0.15},
{"pips": 40, "close_lots": 0.15}
]
}
Whole-unit-step example for futures (MNQM26) where each "lot" is one contract. Recommended path because percentages on whole-step instruments can round surprisingly:
{
"license": "LICENSE",
"action": "buy",
"symbol": "MNQM26",
"size_lots": 5,
"tp_targets": [
{"pips": 20, "close_lots": 2},
{"pips": 50, "close_lots": 2},
{"pips": 100, "close_lots": 1}
]
}
Slippage Protection#
| Parameter | Type | Description |
|---|---|---|
marketprice | float | Expected entry price at the time the alert fires. |
maxspread_pips | float | Maximum allowed deviation in pips between marketprice and the current price. If the deviation exceeds this value, the trade is rejected. |
maxspread_pct | float | Maximum allowed spread as a percentage of the current price. If the spread exceeds this percentage, the trade is rejected. Useful for instruments with very different price levels. |
Use marketprice with maxspread_pips together for slippage protection. If maxspread_pips is provided without marketprice, it is compared against the broker spread instead. maxspread_pct works independently of marketprice. If both maxspread_pips and maxspread_pct are specified, both conditions must pass for the trade to execute, allowing stricter control by setting both limits simultaneously.
Trade Identification#
These parameters can be used with any command.
| Parameter | Type | Description |
|---|---|---|
magic | int | Magic number for trade identification. Behavior depends on the Magic Number Mode EA input setting (see below). |
Magic Number Mode
The EA has a Magic Number Mode input setting with two modes:
- Single (default): The signal's
magicparameter is completely ignored. All trades use the EA's Default Magic Number. Close, modify, and cancel commands only affect positions matching the default magic. The EA never touches other EAs' positions. - Multi-Strategy: The signal's
magicis used. Open commands (buy, sell, pending orders) require a concretemagicand are rejected without it. Close/modify/cancel commands filter by the signal's magic number — usemagic=ALLto affect every strategy's positions on the symbol.
Multi-Strategy mode is designed for hedging accounts running multiple strategies on the same symbol. The account-wide brakes stay unfiltered in every mode: symbol-less sweeps (closeall / cancelall sent with no symbol), the EA-toggle commands (eaon / eaoff / eaoffexcept / eaonexcept), and the closealleaoff / closecancelalleaoff kill switches. A symbol-scoped sweep with no magic (e.g. closeall,EURUSD) is ambiguous in Multi-Strategy mode and is rejected with HTTP 400: add magic=N, add magic=ALL for a deliberate cross-strategy sweep on that symbol, or drop the symbol for the account-wide brake.
Magic values: ALL, 0, and N
The magic value has three distinct forms:
magic=N(positive integer) — targets only positions/orders stamped with that exact magic (that one strategy).magic=0— targets only magic-0 trades, i.e. manual trades (MT5 stamps0on trades not opened by an EA).0is a literal magic ID, not a wildcard.magic=ALL— the wildcard: targets every magic (all strategies) on the scope. This is the only way to spell "all magics."- Omitting
magic— uses your default magic (Single mode); on a targeted command in Multi-Strategy mode it is rejected, so be explicit (magic=Normagic=ALL).
Negative magic values (e.g. magic=-1) are rejected. ALL is the only spelling for the wildcard. magic=ALL is only valid on close/cancel/modify commands — an opening command must use a concrete magic.
Time Parameters#
| Parameter | Type | Description |
|---|---|---|
closetime | int | Seconds after entry to automatically close the position. Range: 1 to 2592000 (30 days). Survives EA and server restarts. |
delay | int | Seconds to delay signal execution. The signal is queued on the server and delivered to the EA after the specified time. Range: 0 to 86400 (24 hours). Values above 86,400 are rejected with HTTP 400 and recorded in Signal Logs → Rejected Signals (no silent capping). |
active_start | string | Override the EA's active hours start time for this signal. Format: HH:MM (24-hour). Must be supplied together with active_end — a signal containing only one of the two bounds is rejected with HTTP 400. The override is scoped to the signal's license, not the whole account. |
active_end | string | Override the EA's active hours end time for this signal. Format: HH:MM (24-hour). End is exclusive — 17:00 means the window closes at 17:00:00 sharp, with the last allowed second being 16:59:59. Use 00:00 for "end of day." Must be supplied together with active_start. The override is scoped per-license. |
expiry_time is interpreted as UTC
expiry_time is interpreted as UTC, and the EA converts that instant to your broker's server time for placement — so the order expires at the correct real-world moment no matter what timezone your broker runs on.
- Bare:
2025-01-15T14:30:00→ treated as UTC (14:30 UTC) - UTC marker:
2025-01-15T14:30:00Z→ UTC (same instant as bare) - Explicit offset:
2025-01-15T14:30:00+02:00→ the offset is honored, converted to UTC (here, 12:30 UTC) - Fractional seconds (
…14:30:00.250Z) are ignored.
How to write the time you want (all expire at the 14:30 figure):
| You want it to expire at… | Write it as | Example |
|---|---|---|
| A specific UTC time | bare, or append Z | expiry_time=2025-01-15T14:30:00Z |
| Your broker's server time (the MT5 chart clock) | append your broker's UTC offset | GMT+3 broker → expiry_time=2025-01-15T14:30:00+03:00 |
| A specific local / exchange timezone | append that zone's offset | New York EST (−05:00) → expiry_time=2025-01-15T14:30:00-05:00 |
| A relative duration (no timezone math) | use expiry in seconds | expiry=3600 (1 hour after placement) |
Your broker's offset is its MT5 server time minus UTC (usually GMT+2 or GMT+3 for forex; it can shift ±1h around DST). When in doubt, send UTC or use expiry (seconds), which is offset-independent.
Changed behavior: earlier EA builds stripped the timezone and treated the digits as broker-local time. If you previously sent a bare timestamp expecting broker-local time, it now resolves as UTC — append your broker's offset (e.g. +03:00) to keep the old wall-clock result.
EA Control Inline Parameters#
These parameters can be attached to any trade command to combine a trade action with a symbol filter update in one signal.
| Parameter | Type | Description |
|---|---|---|
eaon | string | Enable trading for the specified symbol (e.g., eaon=EURUSD). |
eaoff | string | Disable trading for the specified symbol (e.g., eaoff=EURUSD). |
Multi-Strategy Mode#
In Multi-Strategy mode (InpMagicMode = Multi), every command that creates or touches a strategy-owned position requires an explicit magic=N parameter. A symbol-less sweep (closeall, cancelall, clearqueue, etc. sent with no symbol) is the intentional cross-strategy emergency brake and runs without a magic. But a symbol-scoped sweep with no magic (e.g. closeall,EURUSD) is ambiguous and is rejected with HTTP 400: add magic=N to act on one strategy, magic=ALL for a deliberate cross-strategy sweep on that symbol, or drop the symbol for the account-wide brake. (The closealleaoff / closecancelalleaoff kill switches are global by design and are exempt.)
In Single-Strategy mode (default), magic is optional. The EA uses its default magic and will only touch positions it opened itself.
The full rule table:
| Symbol | Magic | Mode | ||
|---|---|---|---|---|
| ✓ | ✓ | any | Accept | Accept |
| ✓ | ✗ | Single | Accept | Accept |
| ✓ | ✗ | Multi | Reject — magic required | Reject (magic required; kill switches exempt) |
| ✗ | ✓ | any | Reject — symbol required | Accept (Multi: that magic across all symbols; Single: default magic; ALL = every magic) |
| ✗ | ✗ | Single | Reject — symbol required | Accept (full kill switch) |
| ✗ | ✗ | Multi | Reject — symbol required | Accept (full kill switch) |
Hover the column headers to see which commands belong to each category and example signals for each case.