TradingView Webhook Commands

Last updated: 2026-10-07

Find a command#

If you want PineHook to skip opposite entries while an existing trade keeps running, turn Allow Hedging off or add hedging=false to the alert, and if you would rather state the final long, short, or flat volume you want to hold, use setposition.

Use id= for each alert

Give every alert a fresh id= value each time it fires, whatever your account type. TradingView sometimes resends an alert, and PineHook ignores any copy that arrives within 12 seconds of an identical one. Without a changing ID, a second pyramiding entry with the same message gets ignored too. A real resend repeats the old ID and is still caught.

PineHook uses the ID only for this check. It never reaches your broker or your notes, so change it instead of comment=. Partial closes and setposition targets skip the duplicate check unless you add id=.

If you have access to your strategy's Pine Script, we recommend generating the ID in the script. If you don't, you can add an ID in the alert dialog instead.

Your alert syntax

Try a task

Describe a task to find a command

Choose your syntax#

Default Mode is PineHook's starting syntax, though you can select PineConnector compatibility for existing alerts. On MT5, Settings Source determines where you choose Signal Syntax Mode: the dashboard when set to Dashboard, or the EA inputs when set to MetaTrader. Reconnect after changing the EA input. On cTrader, choose Signal Syntax Mode under Signal syntax in dashboard settings. Each license reads one syntax at a time.

The choice changes how some commands behave as well as which parameters they accept. Default Mode closeall can target one symbol, but in PineConnector mode it closes positions and cancels pending orders across the account even if you name a symbol. Check that scope before sending a live alert.

PineHook syntax#

Default Mode is PineHook's native syntax for MT5 and cTrader. Each command has an example you can adapt, with its relevant parameters nearby. If you are writing your first alert, start with the formats below and use the finder to jump to the action you need.

Signal formats#

An alert begins with your license key and an action, followed by a symbol unless you are using an account-wide sweep command. Add the parameters that action needs. PineHook detects CSV and JSON automatically, so use whichever format your alert source supports.

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
}

CSV field order

In CSV, put the license key and action first, followed by the symbol when required. After that, separate parameters with commas in any order.

Symbols are 1 to 20 characters long and may contain A-Z, 0-9, and ., -, or _ between groups, as in EURUSD.pro, US30-CFD, or BTC_USD. PineHook uppercases lowercase input and rejects separators at either end or next to each other. Use ALL with eaon or eaoff to control every instrument, since omitting the symbol is rejected. Sweep commands such as closeall and cancelall do accept an omitted symbol for account-wide action.

An alert can be at most 2,048 bytes. TradingView receives HTTP 413 for anything longer and PineHook never reads it, so keep comment= and other text short.

Signal authentication#

Signal Authentication applies to each license separately. Once you enable it, every webhook alert for that license must include auth=<your password> in CSV or "auth":"<your password>" in JSON, regardless of the command. PineHook blocks a missing or incorrect password before execution and records missing_auth or invalid_auth in Signal Logs. When authentication is off, PineHook ignores any auth= value. In either case, it removes the password from the saved alert and never sends it to the EA.

In Dashboard > Licenses, open a license's menu, choose Signal Authentication, then enable it and set a case-sensitive password of 8 to 72 characters. Repeat this for each license you want to protect. There is no account-wide switch or per-command selection.

LICENSE,buy,EURUSD,size_lots=0.1,auth=MySecretPass123

Protect your alerts

Enable Signal Authentication on each license you use for alerts. A license key alone is enough to submit an alert when authentication is off, so keep the separate password private and include it only in alerts you intend to authorize.

Place orders#

Market orders#

Market orders use the current market price, so they do not need price=. The shared order parameters just below the commands cover sizing, stops, targets, and entry filters.

buy

Market#

Open a long position at market price

Opens a long position at the current market price. Your alert must include a sizing parameter.

ExampleCSV
Buy with stop loss and take profit in pips
LICENSE,buy,EURUSD,size_lots=0.1,sl_pips=50,tp_pips=100
More examples and formats
CSV
Buy with multi-TP targets, percentage scale-out
LICENSE,buy,EURUSD,size_lots=0.3,tp_pips=30:50;60:30;100,sl_pips=25
Buy with auto-breakeven after 30 pips profit, locking 5 pips
LICENSE,buy,EURUSD,size_lots=0.1,sl_pips=50,tp_pips=100,be_trigger_pips=30,be_offset_pips=5
JSON
Buy with SL and TP
{"license":"LIC","action":"buy","symbol":"EURUSD","size_lots":0.1,"sl_pips":50,"tp_pips":100}
Multi-TP targets with JSON arrays (percentage)
{
  "license": "LIC",
  "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_pips": 25
}
Multi-TP targets with JSON arrays (fixed lots)
{
  "license": "LIC",
  "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_pips": 25
}
View related parameters →

sell

Market#

Open a short position at market price

Opens a short position at the current market price and accepts the same parameters as buy.

ExampleCSV
Sell with stop loss and take profit
LICENSE,sell,GBPUSD,size_lots=0.2,sl_pips=40,tp_pips=80
More examples and formats
JSON
Sell with ATR trailing stop
{"license":"LIC","action":"sell","symbol":"XAUUSD","size_lots":0.1,"distance_atr":1.5,"trail_atr_period":14}
View related parameters →

Order parameters#

buy, sell, pending orders, and the opening leg of a compound command share these options. Choose the ones your trade needs, then open a topic below for its rules and examples.

SetParametersRule
Position sizesize_lots, size_pct, size_pct_equity, size_dollar, size_margin_pct, size_balance_lots_pctRequired: choose exactly one. An alert with none is rejected.
Stop losssl_pips, sl_price, sl_pctChoose one format.
Take profittp_pips, tp_price, tp_pctChoose one format or use a multi-target ladder.
Other controlsminbalance, minequity, minfreemargin, minmarginlevel, marketprice, maxspread_pips, maxspread_pct, hedgingSet only the filters you want to enforce.
Allow or skip opposite entries

Allow Hedging is a setting for hedging accounts that skips a new entry while a position or pending order on the same symbol points the other way, and hedging=false or hedging=true overrides it for a single alert without changing your saved setting. Hedging entry protection explains where to set it, what it leaves alone, and what to check with your broker.

Skip a sell while EURUSD has a long or buy entry order
LICENSE,sell,EURUSD,size_lots=0.1,magic=42,hedging=false
Allow hedging for this alert only
{"license":"LIC","action":"buy","symbol":"EURUSD","size_lots":0.1,"magic":42,"hedging":true}
Position sizing and risk-based methods
ParameterTypeDescription
size_lotsfloatFixed lot size for the trade (e.g., 0.1, 1.0, 0.01).
size_pctfloatRisk a percentage of account balance. Requires a stop loss. Range: greater than 0, up to 100.
size_pct_equityfloatRisk a percentage of account equity instead of balance. Requires a stop loss. Range: greater than 0, up to 100.
size_dollarfloatRisk a fixed cash amount. The EA sizes the trade so that hitting your stop loses roughly this much. Requires a stop loss.
size_margin_pctfloatCommit a percentage of balance as margin. Does not use the stop distance, so no stop loss is required. Range: greater than 0, up to 100.
size_balance_lots_pctfloatScale lot size to your balance: one standard lot per 10,000 of account currency at a value of 1. No stop loss required.

Every opening alert must include exactly one sizing parameter. An alert with none, or with more than one, is rejected with HTTP 400 and the EA's Default Lot Size is never used as a fallback.

Which sizing method?

Use size_lots for an exact volume, or choose size_pct, size_pct_equity, or size_dollar when you want PineHook to calculate volume from the amount you are willing to lose. Those three risk-based methods need a stop loss to establish the risk distance. By contrast, size_margin_pct and size_balance_lots_pct derive volume from account value and do not require a stop.

size_balance_lots_pct is denominated in your account currency

The 10,000 reference uses your account currency without conversion. For example, a value of 1 produces a much larger position on an account denominated in JPY than on one denominated in USD. Check the resulting size against your own balance before using it.

Stop loss formats and limits
ParameterTypeDescription
sl_pipsfloatStop loss distance in pips from entry price.
sl_pricefloatStop loss at an exact price level.
sl_pctfloatStop loss as a percentage distance from entry price (e.g., 1.5 = 1.5%).

Choose one stop-loss format per alert. PineHook rejects an alert containing both sl_pips and sl_price, for example.

Take profit formats and limits
ParameterTypeDescription
tp_pipsfloatTake profit distance in pips from entry price.
tp_pricefloatTake profit at an exact price level.
tp_pctfloatTake profit as a percentage distance from entry price (e.g., 2.0 = 2.0%).

Choose one take-profit format per alert. PineHook rejects an alert containing both tp_pips and tp_price, for example.

Multiple take-profit and stop-loss levels

You can define up to 10 take-profit levels and 10 stop-loss levels, each with an amount to close. When price reaches a level, the EA closes that portion of the position and continues to the next target.

Individual parameter syntax (CSV and JSON):

ParameterDescription
tp1_pips through tp10_pipsTP level distance in pips from entry
tp1_price through tp10_priceTP level at an exact price
tp1_pct through tp10_pctTP level as a percentage distance from entry
tp1_close through tp10_closePercentage of the original volume to close at this TP level
tp1_lots through tp10_lotsFixed lot amount to close at this TP level
sl1_pips through sl10_pipsSL level distance in pips from entry
sl1_price through sl10_priceSL level at an exact price
sl1_pct through sl10_pctSL level as a percentage distance from entry
sl1_close through sl10_closePercentage of the original volume to close at this SL level
sl1_lots through sl10_lotsFixed lot amount to close at this SL level

Each level, such as TP1 or SL2, must use one distance format: _pips, _price, or _pct. PineHook rejects an alert that mixes formats within a level.

Use _close for percentages or _lots for fixed volume throughout a ladder; do not mix them. Close percentages must total exactly 100%. For whole-unit instruments such as MNQM26, where volume_step=1.0, fixed lots avoid rounding surprises when a percentage does not divide evenly into the position. The EA rounds each fixed-lot close down to the broker's step, raises it to the minimum when possible, and caps it at the remaining volume. The total cannot exceed the original position, so later levels may receive zero lots and the last affordable level may be trimmed.

A single take-profit or stop-loss value cannot share an alert with a ladder of the same type. For example, PineHook rejects tp_pips alongside tp1_* through tp10_*; choose one form for take profit and one for stop loss. It also rejects an index above 10, a malformed compact value, a percentage over 100, or a trailing remainder that resolves to 0%. A complete single level such as 30:100 is valid. Every per-level close volume, including tpN_lots and JSON close_lots, must be positive and finite; the same per-level format check applies to modify.

Number targets without gaps

Number targets in order without gaps. tp1, tp2, and tp3 work, while tp1, tp3, and tp5 are rejected because levels 2 and 4 are missing.

Compact multi-target syntax (CSV)

You can put several targets in one parameter instead of listing each tpN_pips and tpN_close pair. Separate the levels with semicolons:

LICENSE,buy,EURUSD,size_lots=0.3,tp_pips=30:50;60:30;100,sl_pips=25

Each level is pips:close_pct, so 30:50;60:30;100 reads as follows:

  • 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 pips:close_pct shorthand works only in tp_pips and sl_pips. Both tp_price and tp_pct expect a single number, so a colon-separated value in either field is invalid. To set several targets by absolute price or percentage distance, use individual tpN_* or slN_* parameters, or JSON tp_targets and sl_targets arrays. Use those same formats for fixed-lot closes.

For an exact contract count in CSV, use a separate tpN_lots parameter at each level. Compact pips:lots syntax is not supported, so list the levels 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:

In JSON, put the levels in tp_targets or sl_targets arrays. Each target uses either close_pct, a percentage of the original position, or close_lots, an exact volume; keep the same choice throughout an 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}
  ]
}

For futures such as MNQM26, where one "lot" is one contract, fixed-lot targets give you exact contract counts without percentage rounding:

{
  "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}
  ]
}
Account filters for entries

Account filters let you skip an entry if a balance, equity, free-margin, or margin-level threshold is no longer met when the alert executes. The EA checks current account values rather than values from when the alert fired, and every filter you include must pass.

ParameterTypeDescription
minbalancefloatOnly enter if account balance is at least this.
minequityfloatOnly enter if account equity is at least this.
minfreemarginfloatOnly enter if free margin is at least this.
minmarginlevelfloatOnly enter if margin level (%) is at least this.

If a filter blocks an entry, Signal Logs shows the alert as skipped and gives the reason.

minmarginlevel on an idle account

With no open positions, margin level reads as zero because no margin is in use. PineHook applies this filter only once margin is in use, so it does not block the first trade on an idle account.

Spread and slippage protection
ParameterTypeDescription
marketpricefloatPrice your alert saw when it fired, used as a reference for the entry check.
maxspread_pipsfloatMaximum price movement from marketprice, or maximum broker spread when no reference price is supplied, measured in pips.
maxspread_pctfloatThe same limit measured as a percentage. With marketprice, it checks price movement; without it, it checks the broker spread.

Set marketprice to compare the live buy or sell price with the price your alert saw. You can limit that movement with maxspread_pips, maxspread_pct, or both. Without marketprice, the limits check the live broker spread instead. When both limits are greater than zero, both checks must pass before PineHook submits the trade.

Pending orders#

Pending orders wait for price to reach an entry level. Each license can hold up to 50 unfilled pending orders, or 5 on Trial, and a slot frees when an order fills, is cancelled or expires. Choose a command below, then use its pending entry parameters to set the price and expiry. The order parameters for sizing, stops, and targets also apply.

buylimit

Pending#

Buy below the current price

Places a buy order below the current ask and waits for price to fall to your chosen level, which suits a pullback or support entry.

ExampleCSV
Buy limit at 1.0800 with 0.1 lots
LICENSE,buylimit,EURUSD,price=1.0800,size_lots=0.1
More examples and formats
CSV
Buy limit with expiry in 4 hours (14400 seconds)
LICENSE,buylimit,EURUSD,price=1.0800,size_lots=0.1,sl_pips=30,tp_pips=60,expiry=14400
JSON
Buy limit with expiry
{"license":"LIC","action":"buylimit","symbol":"EURUSD","price":1.08,"size_lots":0.1,"expiry":14400}
View related parameters →

selllimit

Pending#

Sell above the current price

Places a sell order above the current bid and waits for price to rise to your chosen resistance level.

ExampleCSV
Sell limit at 1.1000 (resistance level)
LICENSE,selllimit,EURUSD,price=1.1000,size_lots=0.2
More examples and formats
CSV
Sell limit with 2-hour expiry
LICENSE,selllimit,GBPUSD,price=1.2800,size_lots=0.1,sl_pips=30,tp_pips=60,expiry=7200
JSON
Sell limit with SL and TP
{"license":"LIC","action":"selllimit","symbol":"EURUSD","price":1.10,"size_lots":0.2,"sl_pips":40,"tp_pips":80}
View related parameters →

buystop

Pending#

Buy above the current price (breakout)

Places a buy order above the current ask and waits for price to rise to your chosen level, as it would during a breakout.

ExampleCSV
Buy stop at 1.1000 for a breakout entry
LICENSE,buystop,EURUSD,price=1.1000,size_lots=0.1
More examples and formats
CSV
Buy stop with SL, TP, and 1-hour expiry
LICENSE,buystop,EURUSD,price=1.1000,size_lots=0.1,sl_pips=30,tp_pips=90,expiry=3600
JSON
Buy stop with SL and TP
{"license":"LIC","action":"buystop","symbol":"EURUSD","price":1.10,"size_lots":0.1,"sl_pips":30,"tp_pips":90}
View related parameters →

sellstop

Pending#

Sell below the current price (breakdown)

Places a sell order below the current bid and waits for price to fall to your chosen level, as it would during a breakdown.

ExampleCSV
Sell stop at 1.0700 for a breakdown entry
LICENSE,sellstop,EURUSD,price=1.0700,size_lots=0.1
More examples and formats
CSV
Sell stop with 30-minute expiry
LICENSE,sellstop,GBPUSD,price=1.2500,size_lots=0.1,expiry=1800
JSON
Sell stop with SL and TP
{"license":"LIC","action":"sellstop","symbol":"EURUSD","price":1.07,"size_lots":0.1,"sl_pips":25,"tp_pips":50}
View related parameters →

buyatsellat

Pending#

Price-targeted entries that auto-select limit or stop based on the current market price.

buyat and sellat choose a limit or stop order by comparing your target with the live market price. For buyat, a target below the ask becomes a buy limit and one above it becomes a buy stop; sellat makes the equivalent choice against the bid.

ExampleCSV
Buy at 1.0900 (EA decides limit or stop)
LICENSE,buyat,EURUSD,price=1.0900,size_lots=0.1,sl_pips=30,tp_pips=60
More examples and formats
CSV
Sell at price with expiry
LICENSE,sellat,GBPUSD,price=1.2650,size_lots=0.1,sl_pips=25,tp_pips=50,expiry=7200
JSON
Buy at price
{"license":"LIC","action":"buyat","symbol":"EURUSD","price":1.09,"size_lots":0.1,"sl_pips":30,"tp_pips":60}
Sell at price with expiry
{"license":"LIC","action":"sellat","symbol":"GBPUSD","price":1.265,"size_lots":0.1,"expiry":7200}
View related parameters →
Pending order entry#

Set one entry level. buyat and sellat require an absolute price= so the EA can choose between a limit and a stop order, while the other pending commands also accept a distance from the market.

ParameterTypeDescription
pricefloatAbsolute entry price. Required for buyat and sellat.
price_pipsfloatDistance in pips from the current market price.
price_pctfloatDistance as a percentage of the current market price.
expiryintTime in seconds until the pending order expires. Set to 0 for good-until-canceled. The EA manages expiration internally. Maximum 315,360,000 seconds (10 years) on every plan; longer values are rejected with HTTP 400 and recorded in Signal Logs → Rejected Signals.
expiry_timestringExact expiration time in ISO 8601 format. Takes priority over expiry; a bare timestamp means UTC. Add an explicit offset for broker-local time.
How pending entry offsets work

The order type decides the side, not the sign

Offsets express distance, with the command deciding which side of the market to use. For buystop, price_pips=20 means 20 pips above the market; for buylimit, it means 20 pips below. Use a positive distance in either case.

The EA calculates an offset from the live market price when it executes the alert. buyat and sellat work differently: they compare your chosen entry with that price to select limit or stop, which is why they require an absolute price.

Expiry time zones and examples

expiry_time is interpreted as UTC

The EA reads expiry_time as UTC unless you supply an offset, then converts that instant to your broker's server time when placing the order. This keeps the intended expiration time consistent across brokers.

  • 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 asExample
A specific UTC timebare, or append Zexpiry_time=2025-01-15T14:30:00Z
Your broker's server time (the MT5 chart clock)append your broker's UTC offsetGMT+3 broker → expiry_time=2025-01-15T14:30:00+03:00
A specific local / exchange timezoneappend that zone's offsetNew York EST (−05:00) → expiry_time=2025-01-15T14:30:00-05:00
A relative duration (no timezone math)use expiry in secondsexpiry=3600 (1 hour after placement)

Your broker's offset is its MT5 server time minus UTC, often GMT+2 or GMT+3 for forex and sometimes changing with daylight saving time. If you are unsure of the offset, send UTC or use expiry in seconds.

Label strategies and trades (magic, ticket, new_ticket)

Use these labels when later alerts must manage a specific strategy or trade. magic= names a strategy. On hedging accounts, ticket= selects a position, pending order, or reusable setposition group, while new_ticket= names a compound command's replacement. Netting and exchange accounts manage combined positions by symbol and must omit both ticket parameters, or PineHook rejects the alert.

ParameterTypeDescription
magicint or ALLStrategy ID. Omit it to use Default Magic, use a number for one strategy, or use ALL on supported management commands.
ticketstringHedging accounts only. PineHook ID for a position or pending order, or a reusable setposition group.
new_ticketstringHedging accounts only. Define the replacement created by a compound close/open or cancel/replace command.

Tickets are for hedging accounts

ticket= only works on hedging accounts, where your broker lets you hold several separate positions on the same symbol. Check with your broker which account type you have, because netting and exchange accounts combine everything on a symbol into one position, and PineHook rejects alerts that carry ticket= there.

Without a ticket, a command acts on every position and pending order that matches its symbol, direction and magic number, and if you leave out magic=, your Default Magic is used. Add ticket= when you want to act on just one position, one pending order, or one setposition group.

If an entry has no ticket=, PineHook creates one and shows it in Signal Logs. In commands that close or cancel and then open, ticket= picks the existing trade and new_ticket= names its replacement. You may also see generated tickets on netting and exchange accounts, but you manage those positions by symbol. See Hedging and netting accounts.

Magic values: ALL, 0, and N

  • magic=N selects that exact strategy.
  • magic=0 selects the exact zero-magic group. MT5 often uses zero for manual trades.
  • magic=ALL selects every strategy allowed by a supported management command.
  • Omitting magic= uses Default Magic.

Negative values are rejected. magic=ALL cannot be used on an entry.

Send the same alert twice (id)

PineHook drops an alert that is byte-for-byte identical to one it received in the last 12 seconds, because that is how a TradingView retry looks. Add id= with a value that changes on every firing when you mean to send the same alert twice.

ParameterTypeDescription
idstringDeduplication nonce. Recognized on every command, parsed into nothing, and never sent to the broker. It exists only to vary the payload so two otherwise-identical alerts can both fire inside the ~12-second duplicate window. See the callout below.

Use id= for each alert

Give every alert a fresh id= value each time it fires, whatever your account type. TradingView sometimes resends an alert, and PineHook ignores any copy that arrives within 12 seconds of an identical one. Without a changing ID, a second pyramiding entry with the same message gets ignored too. A real resend repeats the old ID and is still caught.

PineHook uses the ID only for this check. It never reaches your broker or your notes, so change it instead of comment=. Partial closes and setposition targets skip the duplicate check unless you add id=.

If you have access to your strategy's Pine Script, we recommend generating the ID in the script. If you don't, you can add an ID in the alert dialog instead.

Target positions#

setposition

Manage#

Reach a signed final position volume

Sets the final size you want to hold, instead of placing an order of a given size. PineHook compares the target with what you hold now and trades only the difference, so repeating a target you have already reached places no new trade.

You holdAlertWhat PineHook does
0.10 lots longtarget=0.30Opens 0.20 lots more
0.30 lots longtarget=-0.20Closes the 0.30 long, then opens 0.20 short
Any positiontarget=0Closes the selected positions

A positive target means long, a negative one means short, and zero means flat.

ExampleCSV
Set a hedging group to 0.30 lots long
LICENSE,setposition,EURUSD,target=0.30,magic=42,ticket=strategy-a
More examples and formats
CSV
Reverse the same group to 0.20 lots short
LICENSE,setposition,EURUSD,target=-0.20,magic=42,ticket=strategy-a
Flatten the group and retain its reusable ticket
LICENSE,setposition,EURUSD,target=0,magic=42,ticket=strategy-a
JSON
Set the whole netting position
{"license":"LIC","action":"setposition","symbol":"EURUSD","target":0.30}

Which positions it changes. On a hedging account, add ticket= to manage one named group of positions. The group keeps its ticket even after you close or reverse it, so later alerts can reuse it. Without a ticket, the target covers every position on that symbol with the alert's magic number, or your Default Magic if you leave magic= out. On netting and exchange accounts, leave out ticket=, since the target always applies to the symbol's one combined position.

What you can include.

  • target replaces size_*, close_lots and close_pct. Your lot conversion and any copier multiplier still apply to it.
  • You can add one stop loss and one take profit, plus entry filters such as maxspread_pips and hedging=.
  • PineHook rejects delay, expiry, pending-order fields, new_ticket, magic=ALL, SL/TP ladders, and inline trailing or breakeven settings. You can still send trail or breakeven as a separate alert once the target completes.

After you send it. PineHook reaches the target once and does not maintain it, so a later stop or manual close is not undone. When a target reverses your position, PineHook closes the old direction first and then opens the new one, so if a check such as Active Hours or a position limit blocks the new side, you can end up flat and Signal Logs shows the result as Partial. Check that result before you retry, and see the full setposition reference for stops, broker volume limits and recovery.

Reversing with Allow Hedging off

With Allow Hedging off or hedging=false in the alert, PineHook won't open the new side of a reversal while anything else on the same symbol is still open in the opposite direction. The old side is already closed by then, so you end up flat and Signal Logs shows Partial. This usually happens when:

  • another strategy or ticket group is open in the opposite direction on that symbol
  • a pending order on that symbol points the opposite way, since setposition doesn't cancel pending orders
  • you have a manual trade, or another EA's trade, open on that symbol

To avoid it, check the symbol for other open trades and cancel opposite pending orders before you reverse.

View related parameters →
Delay and timed close
ParameterTypeDescription
closetimeintSeconds after entry to automatically close the position. Range: 1 to 2592000 (30 days). Survives EA and server restarts.
delayintSeconds to delay alert execution. The alert 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).

Close positions#

Close and cancel commands ignore Active Hours

Active Hours limits entries, but it does not block close or cancel commands. You can still exit or adjust an open position after the entry window closes.

Account-wide scope and close execution

To sweep every instrument, omit the symbol on closeall, closecancelall, closeallprofit, closeallloss, cancelall, clearqueue, or a closealleaoff variant. Include a symbol when you want one instrument instead.

Close commands bypass entry-only limits and allow a wide price deviation, around 5,000 pips or 50,000 points, to reduce rejections during fast moves. Your broker can still reject an order or leave it unfilled, so check Signal Logs and the broker account for the outcome. Signal Logs also discloses extreme slippage on a successful close.

closelongcloseshort

Close#

Close all long or all short positions on a symbol (full or partial).

Use closelong to close buy positions on a symbol or closeshort to close sell positions on that symbol.

Both commands support full or partial closing:

  • Full close: Omit the close parameters to close all positions
  • Partial close (percentage): Use close_pct=50 to close 50% of the original position volume
  • Partial close (fixed lots): Use close_lots=0.5 to close exactly 0.5 lots
ExampleCSV
Close all long positions on EURUSD
LICENSE,closelong,EURUSD
More examples and formats
CSV
Close all short positions on GBPUSD
LICENSE,closeshort,GBPUSD
Close 50% of long position volume
LICENSE,closelong,EURUSD,close_pct=50
Close 0.3 lots from long positions
LICENSE,closelong,EURUSD,close_lots=0.3
JSON
Close all longs
{"license":"LIC","action":"closelong","symbol":"EURUSD"}
Close 50% of longs
{"license":"LIC","action":"closelong","symbol":"EURUSD","close_pct": 50}
View related parameters →

closeall

Close#

Close all positions on a symbol

Closes positions in either direction on a symbol and also accepts the partial-close parameters below.

ExampleCSV
Close all positions on EURUSD (longs and shorts)
LICENSE,closeall,EURUSD
More examples and formats
CSV
Close 50% of all positions on EURUSD
LICENSE,closeall,EURUSD,close_pct=50
JSON
Close all positions
{"license":"LIC","action":"closeall","symbol":"EURUSD"}
Close 50% with magic filter
{"license":"LIC","action":"closeall","symbol":"EURUSD","close_pct": 50,"magic":12345}
View related parameters →

closecancelall

Close#

Close all positions and cancel all pending orders

Closes every open position and cancels every pending order that matches the command's symbol and magic scope. This is a sweep command, so it does not accept ticket=.

Alert scopeWhat it affects
Symbol and magic=NThat strategy on the specified symbol.
Symbol and magic=ALLEvery magic on the specified symbol, including manual positions and orders and those created by other software.
Symbol without magic=The license's Default Magic on that symbol.
magic=N without a symbolThat strategy across all symbols.
No symbol and no magic=The entire linked account, across all symbols and magic numbers.
ExampleCSV
Close and cancel the Default Magic on EURUSD
LICENSE,closecancelall,EURUSD
More examples and formats
CSV
Close and cancel every magic on EURUSD
LICENSE,closecancelall,EURUSD,magic=ALL
Close and cancel the entire linked account
LICENSE,closecancelall
JSON
{"license":"LIC","action":"closecancelall","symbol":"EURUSD"}

closeallprofitcloseallloss

Close#

Close only the positions that are net-profitable, or only those at a net loss.

closeallprofit closes positions with positive net P&L after price movement, swap, and commission. A position can be up on price yet still have a net loss, in which case this command leaves it open. Add minprofit if you also want a minimum favorable move in price pips, separate from the net-money test.

closeallloss closes positions with negative net P&L, even when price has moved favorably but swap and commission outweigh the gain. Use maxloss to limit the move in price pips.

ExampleCSV
Close all profitable EURUSD positions
LICENSE,closeallprofit,EURUSD
More examples and formats
CSV
Close all losing EURUSD positions
LICENSE,closeallloss,EURUSD
JSON
Close profitable with min profit filter
{"license":"LIC","action":"closeallprofit","symbol":"EURUSD","minprofit":20}
Close losers with max loss filter
{"license":"LIC","action":"closeallloss","symbol":"EURUSD","maxloss":30}
View related parameters →

closealleaoff

Close#

Close all positions and disable the EA

Closes all open positions, then disables new entries with a persistent account-wide stop. Only eaon,ALL re-enables trading; a symbol-specific eaon, a settings change, or an EA restart will not clear it.

ExampleCSV
Close everything and shut down the EA
LICENSE,closealleaoff,EURUSD

closecancelalleaoff

Close#

Close all positions, cancel all pending orders, and disable the EA

Closes all open positions, cancels pending orders, and disables new entries across the account. The stop persists through settings changes and EA restarts, and only eaon,ALL re-enables trading; a symbol-specific eaon will not clear it.

ExampleCSV
Close all positions, cancel all pending orders, and shut down the EA
LICENSE,closecancelalleaoff,EURUSD
More examples and formats
CSV
Same command with magic filter
LICENSE,closecancelalleaoff,EURUSD,magic=12345
JSON
{"license":"LIC","action":"closecancelalleaoff","symbol":"EURUSD"}

Close parameters#

ParameterTypeDescription
close_pctfloatClose 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_lotsfloatClose a specific lot amount. For example, close_lots=0.5 closes exactly 0.5 lots.
minprofitfloatMinimum 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.
maxlossfloatMaximum 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.
be_remainderflagAfter a partial close, move the remaining position's stop to entry. Only available in PineConnector compatibility mode, where it is what sl=0 translates to. See PineConnector syntax for its setup and commands.

Choose close_pct for a percentage or close_lots for a fixed volume; do not use both. PineHook calculates close_pct from the position's original volume, so two close_pct=50 alerts close 50% plus 50% of that original amount, rather than 50% plus 25% of what remains. If the requested amount exceeds the remaining volume, the EA closes what is left.

Automatic Volume Rounding

The EA rounds partial closes down to the broker's lot step and respects its minimum size. If rounding leaves less than the minimum, it closes the full position instead. For example, 90% of a 0.01-lot position is 0.009 lots; with a 0.01-lot minimum, that request becomes a full close.

Symbol Filter Bypass

Symbol filters restrict new entries, including buy, sell, and pending orders. They do not block close commands, so you can still close a position on a symbol disabled by eaoff or excluded from a whitelist.

Close and open in one alert#

A compound command handles both legs in one alert: it closes or cancels first, then places the new order. The opening leg accepts the same order parameters as any other entry.

The close always runs first

If the close leg fails outright, no new order is opened, because reversing while the original exposure is still live would double it. A partial cancel (on the cancel-and-replace compounds) still proceeds and is reported on the ACK; the close leg of a reversal always closes matched positions in full.

closelongopenlongcloselongopenshortcloseshortopenlongcloseshortopenshortcloselongshortopenlongcloselongshortopenshort

Market#

Close longs, then open a long

Closes existing positions on one or both sides before opening a new market position, which needs sizing like any other entry.

ExampleCSV
Reverse a long into a short
LICENSE,closelongopenshort,EURUSD,size_lots=0.1,sl_pips=50
More examples and formats
CSV
Close longs, open a new long (re-entry)
LICENSE,closelongopenlong,EURUSD,size_lots=0.1
Flatten both sides, then go long
LICENSE,closelongshortopenlong,EURUSD,size_lots=0.1,tp_pips=80
View related parameters →

cancellongbuystopcancellongbuylimitcancelshortsellstopcancelshortselllimit

Pending#

Cancel buy pendings, place a new Buy Stop

Cancels pending orders on one side before placing their replacement, which needs sizing and an entry level.

ExampleCSV
Replace a buy stop at a new level
LICENSE,cancellongbuystop,EURUSD,size_lots=0.1,price=1.0850
More examples and formats
CSV
Replace using an offset from market
LICENSE,cancelshortselllimit,EURUSD,size_lots=0.1,price_pips=30
View related parameters →

Trade management#

modify

Manage#

Modify SL/TP on positions or pending orders

Use modify to change a stop loss or take profit on an open position or pending order, without opening, closing, or resizing the position. Put it in the action field just as you would buy or sell: LICENSE,modify,SYMBOL.

By default, modify acts on open positions for the symbol. Add order_type (buylimit, buystop, selllimit, or sellstop) to target pending orders instead. You can also filter by position direction or edit individual TP/SL levels.

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, …). They apply in 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:

ParameterType/ValuesDescription
sl_pipsfloat (pips)New stop loss distance in pips from entry
sl_pricefloat (price)New stop loss at exact price level
sl_pctfloat (%)New stop loss as a percentage distance from entry
tp_pipsfloat (pips)New take profit distance in pips from entry
tp_pricefloat (price)New take profit at exact price level
tp_pctfloat (%)New take profit as a percentage distance from entry
directionlong, shortFilter by position direction
order_typebuylimit, buystop, selllimit, sellstopTarget pending orders instead of positions
magicintegerOnly modify positions/orders with this magic number

Set an SL or TP value to 0 to remove it entirely.

ExampleCSV
Open positions (default, no order_type)
Set SL and TP on all open EURUSD positions
LICENSE,modify,EURUSD,sl_price=1.0750,tp_price=1.0950
More examples and formats
CSV
Modify SL only (leave TP unchanged)
LICENSE,modify,EURUSD,sl_price=1.0750
Modify TP only (leave SL unchanged)
LICENSE,modify,EURUSD,tp_price=1.0950
Move the base stop AND a TP leg together (both apply)
LICENSE,modify,EURUSD,sl_price=1.0800,tp1_pips=80
Change TP2 price and SL1 distance at the same time
LICENSE,modify,EURUSD,tp2_price=1.1050,sl1_pips=30
Use percent-based targets
LICENSE,modify,EURUSD,tp1_pct=1,tp2_pct=2

breakeven

Manage#

Move stop loss to entry price

Moves the stop loss to the position's entry price, or to an offset from that price if you provide one.

Offsets let you lock in profit or set a specific stop level. On a buy or sell alert, add a trigger if the move to breakeven should wait until the position reaches a profit threshold.

breakeven applies to both buy and sell positions matching your symbol and magic number, using each position's own entry price. To change stops on only one side, use modify with direction=long for buys or direction=short for sells.

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 you include a trigger in a buy or sell alert, PineHook monitors price updates and moves the SL to breakeven, plus any specified offset, when the threshold is reached. The trigger fires once and is removed, while pending trigger settings survive restarts. On MT5, active triggers appear in the chart overlay.

ExampleCSV
Move SL to entry on all EURUSD positions
LICENSE,breakeven,EURUSD
More examples and formats
CSV
Move SL to entry + 5 pips (lock 5 pips profit)
LICENSE,breakeven,EURUSD,be_offset_pips=5
Move SL to entry + 0.5% of entry price
LICENSE,breakeven,EURUSD,be_offset_pct=0.5
Move SL to exact price level
LICENSE,breakeven,EURUSD,be_offset_price=1.0955
Buy and move SL to entry after 30 pips profit
LICENSE,buy,EURUSD,size_lots=0.1,sl_pips=50,tp_pips=100,be_trigger_pips=30,be_offset_pips=0
JSON
Basic breakeven
{"license":"LIC","action":"breakeven","symbol":"EURUSD"}
With percentage offset
{"license":"LIC","action":"breakeven","symbol":"EURUSD","be_offset_pct":0.5}
Buy and move SL to entry after 30 pips profit
{"license":"LIC","action":"buy","symbol":"EURUSD","size_lots":0.1,"sl_pips":50,"tp_pips":100,"be_trigger_pips":30,"be_offset_pips":0}

trail

Manage#

Add or update a trailing stop

Registers or updates a trailing stop on open positions. As price moves in your favor, PineHook tightens the stop to keep your chosen distance behind it, without moving an existing stop backward.

Set a trailing distance, and, on a buy or sell alert, add a trigger if trailing should begin only after the trade reaches a profit threshold.

Distance modes (mutually exclusive, only one allowed):

  • distance_pips: trail distance in pips. Fixed pip-based trailing.
  • distance_pct: calculate the trailing gap from a percentage of entry price, greater than 0 and up to 99. PineHook then uses that fixed gap to move the stop behind favorable market prices.
  • distance_atr: trail distance as a multiple of the ATR indicator (range: 0.1 to 20). Dynamic, volatility-based trailing.

For a buy entered at 10,000, distance_pct=1 sets the gap to 100 price points. Once trailing is active, a market price of 10,300 gives a proposed stop at 10,200, while 10,400 gives one at 10,300. The entry stays at 10,000 throughout, but the stop rises with the market and never moves back down. For a sell, the same calculation follows falling prices and tightens the stop downward.

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: use with distance_pips to set the minimum stop improvement in pips.
  • trail_pct_step: use with distance_pct to calculate the minimum stop improvement as a percentage of entry price.

After activation, a proposed stop must improve the existing SL by more than the step before it is updated. For example, trail_step=5 waits for an improvement greater than 5 pips, while trail_pct_step=0.1 on an entry at 10,000 means more than 10 price points. The step controls how often the stop moves, while the distance controls its gap from the market.

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 saved ATR timeframe, or H1 on both MT5 and cTrader if none is saved. Set it explicitly for deterministic behavior.

Auto-trigger

When you include a trailing trigger in a buy or sell alert, PineHook monitors price updates and activates the trail when the threshold is reached. The stop then follows favorable price moves, subject to your distance and step settings, and active trails survive restarts. On MT5, the chart overlay shows trigger levels and 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.

ExampleCSV
Simple 20-pip trailing stop
LICENSE,trail,EURUSD,distance_pips=20
More examples and formats
CSV
Trail with pips trigger: activate after 30 pips of profit
LICENSE,trail,EURUSD,distance_pips=20,trail_trigger=30
20-pip gap, with stop updates after more than 5 pips of improvement
LICENSE,trail,EURUSD,distance_pips=20,trail_step=5
1% of entry as the gap, with updates after more than 0.1% of entry
LICENSE,trail,NAS100,distance_pct=1,trail_pct_step=0.1
Buy: activate a 20-pip trail at 30 pips profit, with a 5-pip step
LICENSE,buy,EURUSD,size_lots=0.1,sl_pips=50,distance_pips=20,trail_trigger=30,trail_step=5
ATR-based trail: 2x ATR on the H1 timeframe with 14-period lookback
LICENSE,trail,EURUSD,distance_atr=2.0,trail_atr_period=14,trail_atr_timeframe=H1
JSON
Pip trail with trigger
{"license":"LIC","action":"trail","symbol":"EURUSD","distance_pips":20,"trail_trigger":30}
20-pip gap, with stop updates after more than 5 pips of improvement
{"license":"LIC","action":"trail","symbol":"EURUSD","distance_pips":20,"trail_step":5}
1% of entry as the gap, with updates after more than 0.1% of entry
{"license":"LIC","action":"trail","symbol":"NAS100","distance_pct":1,"trail_pct_step":0.1}
Buy: activate a 20-pip trail at 30 pips profit, with a 5-pip step
{"license":"LIC","action":"buy","symbol":"EURUSD","size_lots":0.1,"sl_pips":50,"distance_pips":20,"trail_trigger":30,"trail_step":5}
ATR-based trail
{"license":"LIC","action":"trail","symbol":"EURUSD","distance_atr":2.0,"trail_atr_period":14,"trail_atr_timeframe":"H1"}

notrail

Manage#

Remove a trailing stop (keeps current SL level)

Removes trailing behavior from open positions on a symbol while leaving their current stop-loss levels in place.

ExampleCSV
Remove trailing stop from EURUSD positions
LICENSE,notrail,EURUSD
More examples and formats
CSV
Remove trailing stop with magic filter
LICENSE,notrail,EURUSD,magic=99999

nobreakeven

Manage#

Remove an auto-breakeven monitor (keeps current SL level)

Removes auto-breakeven monitors from open positions on a symbol while leaving their current stop-loss levels in place.

Use nobreakeven to cancel a trigger set with be_trigger_pips, be_trigger_pct, or be_trigger_price on a buy or sell alert. It leaves the current stop loss alone even if market conditions have changed since entry.

Monitor Removal Only

nobreakeven cancels the pending monitor. To move the stop to breakeven now, send breakeven instead.

ExampleCSV
Remove auto-breakeven monitors from all EURUSD positions
LICENSE,nobreakeven,EURUSD
More examples and formats
CSV
Remove auto-breakeven with magic filter
LICENSE,nobreakeven,EURUSD,magic=12345
Remove auto-breakeven from XAUUSD positions
LICENSE,nobreakeven,XAUUSD

Cancel orders#

cancellongcancelshortcancelall

Cancel#

Cancel pending buy orders, sell orders, or all of them on a symbol.

These commands cancel pending orders on a symbol: cancellong removes buy limits and buy stops, cancelshort removes sell limits and sell stops, and cancelall removes both sides.

ExampleCSV
Cancel all pending buy orders on EURUSD
LICENSE,cancellong,EURUSD
More examples and formats
CSV
Cancel all pending sell orders on GBPUSD
LICENSE,cancelshort,GBPUSD
Cancel all pending orders on EURUSD
LICENSE,cancelall,EURUSD
JSON
Cancel all pending buy orders
{"license":"LIC","action":"cancellong","symbol":"EURUSD"}
Cancel all with magic filter
{"license":"LIC","action":"cancelall","symbol":"EURUSD","magic":12345}

clearqueue

Cancel#

Clear queued delayed alerts (renamed from canceldelay)

clearqueue cancels pending alerts scheduled with delay= for the license in your message. Other licenses in your account are unaffected. On both MT5 and cTrader, alerts waiting for an offline connection remain in the delivery queue, even if they originally used delay= and have already reached their scheduled time. Alerts already being processed are also unaffected.

To cancel pending broker orders, use cancellong, cancelshort, or cancelall.

Omit the symbol or use ALL to clear pending delayed alerts across that license's instruments, or specify a symbol to limit the scope. You can also filter by magic number.

ExampleCSV
Clear delayed alerts for EURUSD
LICENSE,clearqueue,EURUSD
More examples and formats
CSV
Clear delayed alerts for all symbols
LICENSE,clearqueue,ALL
JSON
Clear all delayed alerts for this license
{"license":"LIC","action":"clearqueue","symbol":"ALL"}

EA control#

Use these commands to control which symbols a license can trade. The settings persist when the platform reconnects, and Trading settings explains how the symbol filter works.

These commands change the filter of the license that receives the alert, never your global filter or your other licenses. A copier key is the exception, since it passes the command to every license on the copier. A symbol has to pass both the license filter and the global filter to trade, so a license whitelist of BTCUSD combined with a global whitelist of SOLUSD blocks everything. If a license was saved with Use global settings ticked, its own filter is stored but not used, and these commands change nothing until you untick it.

Also applies to cTrader

Although their names contain "ea", eaon, eaoff, eaonexcept, and eaoffexcept apply the same symbol-filtering rules to MT5 and cTrader licenses.

eaoneaoff

EA Control#

Enable or disable trading for a symbol (or ALL symbols).

eaon allows entries on a symbol by removing it from a blacklist or adding it to a whitelist. eaoff does the reverse, adding the symbol to a blacklist or removing it from a whitelist. Use ALL when you want to enable or disable entries across every symbol.

ExampleCSV
Disable trading for EURUSD
LICENSE,eaoff,EURUSD
More examples and formats
CSV
Re-enable trading for EURUSD
LICENSE,eaon,EURUSD
Disable ALL trading (switches to whitelist mode with empty list)
LICENSE,eaoff,ALL
Re-enable ALL trading (switches to blacklist mode with empty list)
LICENSE,eaon,ALL
JSON
Disable trading
{"license":"LIC","action":"eaoff","symbol":"EURUSD"}
Re-enable all trading
{"license":"LIC","action":"eaon","symbol":"ALL"}

eaoffexcepteaonexcept

EA Control#

Switch to whitelist or blacklist mode with a specified set of symbols.

eaoffexcept switches to a whitelist that allows only the symbols you list; eaonexcept switches to a blacklist that blocks only those you list. Separate symbols with semicolons in either command.

ExampleCSV
Only allow EURUSD, GBPUSD, and USDJPY (whitelist mode)
LICENSE,eaoffexcept=EURUSD;GBPUSD;USDJPY
More examples and formats
CSV
Block only XAUUSD and BTCUSD, allow everything else (blacklist mode)
LICENSE,eaonexcept=XAUUSD;BTCUSD
JSON
Whitelist multiple symbols
{"license":"LIC","action":"eaoffexcept","symbols":"EURUSD;GBPUSD;USDJPY"}
Blacklist specific symbols
{"license":"LIC","action":"eaonexcept","symbols":"XAUUSD;BTCUSD"}

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. PineHook rejects an eaon, eaoff, eaoffexcept, eaonexcept, or inline eaon= / eaoff= command that would push the filter past 100 entries, 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:

  • eaon is applied before the trade is evaluated. So LICENSE,buy,EURUSD,eaon=EURUSD re-enables EURUSD first, then evaluates the buy against the new state. You can re-enable and enter in one alert.
  • eaoff is applied after the trade command is queued. For example, LICENSE,closelong,EURUSD,eaoff=EURUSD queues the close command, then disables EURUSD for future entries, so you can close your long positions and disable the symbol in one alert.

With LICENSE,closelong,EURUSD,eaoff=EURUSD, you can close your long positions and block future entries on EURUSD in one alert. Close commands bypass the symbol filter, so the close is allowed even if EURUSD is already disabled.

If an inline eaoff= would push the symbol filter past the 100-symbol limit, the trade still executes (the queued Alert row reflects the trade outcome), but the response includes a warning explaining why the filter change was rejected and suggesting the inverse-mode command. The filter is left unchanged.

Use eaon= and eaoff= with a trade command
ParameterTypeDescription
eaonstringEnable trading for the specified symbol (e.g., eaon=EURUSD).
eaoffstringDisable trading for the specified symbol (e.g., eaoff=EURUSD).

PineConnector syntax#

PineConnector compatibility accepts alerts written in PineConnector syntax. Before sending them to a live account, match the unit settings below to your previous setup and test any command that can affect more than one position.

PineHook is independent of PineConnector, and compatibility with its alert format does not imply a partnership or endorsement. PineConnector may change how its alerts behave, so this documentation may occasionally fall behind those changes. If you are migrating from PineConnector, always test your alerts on a demo account first. We also recommend taking the time to adapt your alerts to PineHook’s native syntax.

Set up compatibility mode#

  1. Change the license ID in your alert messages to your PineHook license key.
  2. Point the webhook at PineHook's endpoint.
  3. Select PineConnector mode. On MT5 with Settings Source set to Dashboard, choose PineConnector under Trading → Signal syntax in dashboard settings. With Settings Source set to MetaTrader, choose it in the EA’s Signal Syntax Mode input and reconnect. On cTrader, select PineConnector under Signal syntax in dashboard settings.

Your EA settings come with you

PineConnector's risk=, sl=, tp=, and pending= values have no units of their own; their meaning comes from your syntax settings. Match PineHook's PineConnector Syntax settings to your previous setup so the same alert values retain their meaning.

The five settings below show what each value controls. For MT5 in Dashboard mode and for cTrader, set global defaults or per-license overrides under Signal syntax. MT5 in MetaTrader mode reads all five values from the EA Inputs.

InputControlsOptions
risk= meanshow risk= is sizedLots · Dollar Amount · % Balance Lots · % Balance Margin · % Balance Loss · % Equity Loss
sl= / tp= meanhow targets are readPips · Price · Percentage
pending= meanspending order entryPips from market · Specified price · Percentage from market
accfilter= checkswhich account metricBalance · Equity · Free Margin · Margin Level %
closelongpct closespartial close size10% · 20% · 25% · 34% · 50%

These are only read in PineConnector mode

These settings apply only to PineConnector alerts because native PineHook parameters specify their units directly. If you copy a PineConnector alert to several licenses, each license uses its own settings to read the values. For example, sl=50 could mean 50 pips on one license and a stop at price 50 on another. Match the settings across destination licenses if you want consistent units. Each destination’s lot multiplier then scales its calculated order size.

PineConnector commands#

The tables below show what each supported command does, though broker rules and platform behavior still apply. On cTrader, stepped trailing needs the bridge online; native continuous trailing keeps running after activation if the bridge disconnects.

Market orders#

CommandDoes
buy · long · bull · bullishOpens a long at market
sell · short · bear · bearishOpens a short at market
LICENSE,buy,EURUSD,risk=1,sl=50,tp=100
LICENSE,long,EURUSD,risk=1,sl=50

Parameters for PineConnector entries#

These parameters follow the PineConnector unit settings above. Choose one sizing method, then add a stop or target if your strategy calls for it.

SetParametersRule
Sizerisk=, vol_lots=, vol_dollar=, vol_pct_bal_loss=, vol_pct_eq_loss=, vol_pct_bal_margin=Loss-based sizes need a stop loss.
Stop and targetsl=, tp=, or explicit sl_pips=, tp_price=, and other unit-specific formssl= and tp= follow your Target Type setting.
Entry controlsbetrigger=, beoffset=, trailtrig=, traildist=, spread=, accfilter=Add only the controls your alert needs.
Hedging on or off

PineHook's hedging=true/false parameter also works with PineConnector-format entries. It overrides Allow Hedging for one command. With hedging=false, any opposite position or entry order on the same broker symbol blocks the new entry on a hedging account, whatever its Magic Number, while the existing trade keeps its SL and TP.

Skip an opposite PineConnector entry
LICENSE,sell,EURUSD,risk=0.1,magic=42,hedging=false

This example reads risk=0.1 through your Volume Type setting, and same-direction entries remain subject to your other limits. Once a close/cancel compound passes admission and readiness checks, it performs its close or cancel before checking the new entry. Standalone management commands reject hedging=, and netting and exchange accounts behave as they always have. See hedging entry protection.

PineConnector sizing methods
ParameterMeaning
risk=Read through your Volume Type setting
vol_lots=Fixed lot size
vol_dollar=Cash amount risked to the stop
vol_pct_bal_loss=Percentage of balance risked
vol_pct_eq_loss=Percentage of equity risked
vol_pct_bal_margin=Percentage of balance committed as margin

Loss-based sizing needs a stop loss, which provides the distance used to calculate volume.

PineConnector stop and target formats
ParameterMeaning
sl= · tp=Read through your Target Type setting
sl_pips= · tp_pips=Distance in pips
sl_price= · tp_price=Absolute price
sl_pct= · tp_pct=Percentage from entry
Breakeven and trailing parameters
ParameterMeaning
betrigger=Pips of profit before breakeven arms
beoffset=Pips beyond entry to place the stop
trailtrig= · atrtrigger=Pips of profit before trailing starts
traildist=Trailing distance in pips
trailstep=Pips of movement before the stop moves again
atrtimeframe=ATR timeframe in minutes (1, 5, 15, 30, 60, 240, 1440)
atrperiod=ATR averaging period
atrmultiplier=ATR multiple for the trail distance (defaults to 1)
Filters, authentication, and comments
ParameterMeaning
spread=Only enter if the spread is at or below this, in pips
accfilter=Only enter if the account metric meets this value
secret=Your alert authentication password
comment=A note shown in your Signal Logs

comment= appears in your dashboard

PineHook shows comment= in Signal Logs instead of writing it to the MT5 order comment. That broker field holds identifiers PineHook uses to recognize duplicate alerts and avoid a second execution.

Pending orders#

CommandDoes
buystopBuy above the market
buylimitBuy below the market
sellstopSell below the market
selllimitSell above the market
LICENSE,buystop,EURUSD,risk=1,pending=20

Your Pending Order Entry Type setting determines whether pending= means pips from the market, an absolute price, or a percentage.

PineConnector pending entry parameters
ParameterMeaning
pending= · price=Read through your Pending Order Entry Type setting
entry_price=Absolute price
entry_pips=Distance in pips from the market
entry_pct=Percentage from the market

Closing positions#

CommandDoes
closelongCloses all buy positions for the symbol
closeshortCloses all sell positions for the symbol
closelongshortCloses both sides for the symbol
closelongpct · closeshortpctCloses the percentage set in your EA
closelongvol · closeshortvolCloses the lots given in risk=
closeallCloses all positions and cancels all pending orders, on every symbol
closealleaoffSame as closeall, then halts the EA

closeall is global

In PineConnector compatibility mode, closeall closes positions and cancels pending orders across the broker trading account connected to the license in your message. Without a magic filter, this includes manual trades and trades opened by other strategies or licenses on that same trading account. It does not send close commands to your other PineHook licenses or broker accounts.

A symbol in the message is only a placeholder, so LICENSE,closeall,EURUSD still acts on every symbol. Use closelongshort when you want to close one symbol.

Test closeall on a demo account before using it live, especially if your previous PineConnector setup treated the command as symbol-specific. Here, the same alert can flatten the whole account.

LICENSE,closelongpct,EURUSD
LICENSE,closelongvol,EURUSD,risk=0.5
LICENSE,closeall,EURUSD

closelongvol requires risk=

For closelongvol or closeshortvol, risk= gives the number of lots to close. PineHook rejects the command when it is missing rather than risk closing the entire position.

Cancelling pending orders#

CommandDoes
cancellongCancels buy-side pending orders
cancelshortCancels sell-side pending orders
LICENSE,cancellong,EURUSD

Close and open in one alert#

CommandShort formDoes
closelongopenlongCL+OLClose longs, then open a long
closelongopenshortCL+OSClose longs, then open a short
closeshortopenlongCS+OLClose shorts, then open a long
closeshortopenshortCS+OSClose shorts, then open a short
closelongshortopenlongCLS+OLClose both sides, then open a long
closelongshortopenshortCLS+OSClose both sides, then open a short

The older names closelongbuy and closeshortsell also work.

LICENSE,closelongopenshort,EURUSD,risk=1,sl=50
LICENSE,CL+OS,EURUSD,risk=1,sl=50

The close always runs first

If the close leg fails, PineHook does not open the new position, which would otherwise double your exposure. If there is nothing to close, the new position still opens as an ordinary entry.

Cancel and replace#

CommandDoes
cancellongbuystopCancels buy pendings, places a new Buy Stop
cancellongbuylimitCancels buy pendings, places a new Buy Limit
cancelshortsellstopCancels sell pendings, places a new Sell Stop
cancelshortselllimitCancels sell pendings, places a new Sell Limit
LICENSE,cancellongbuystop,EURUSD,risk=1,pending=20

Modifying stops and targets#

CommandDoes
newsltplong · newsltpshortChanges SL/TP on open positions of that side
newsltpbuystop · newsltpbuylimitChanges SL/TP on those pending orders
newsltpsellstop · newsltpselllimitChanges SL/TP on those pending orders
LICENSE,newsltplong,EURUSD,sl=50,tp=100

The values of sl= and tp= use the Target Type you set above.

sl=0 moves the stop to breakeven#

When your license uses PineConnector compatibility mode, PineHook treats sl=0 as a request to move the stop to your entry price. In PineHook Default Mode, use breakeven to move the stop to entry, or modify with sl_price=0 to remove it. The shorthand sl= is not a native PineHook parameter.

AlertResult
newsltplong,sl=0Moves the stop to entry on your long positions
newsltpshort,sl=0Same for shorts
closelongpct,sl=0Closes the configured percentage, then moves the remaining position's stop to entry
closelongvol,risk=0.5,sl=0Closes 0.5 lots, then moves the remainder's stop to entry
LICENSE,newsltplong,EURUSD,sl=0
LICENSE,closelongpct,EURUSD,sl=0

Why this one matters

In PineHook's native syntax, a stop price of zero means remove the stop. PineHook rejects sl=0 on a Default Mode license rather than guess which meaning you intended and risk removing your protection.

PineHook also rejects sl=0 on newsltp commands that target pending orders, because no position is open yet. It rejects sl=0 alongside a tp= change as well, since a breakeven move has no take-profit change to apply and silently dropping part of the request would be misleading.

EA control#

CommandDoes
eaonResumes the EA
eaoffHalts the EA

PineConnector's padded form is accepted:

LICENSE,eaoff,eaoff

Known differences#

atrshift=Only 0 is accepted. PineHook's ATR trailing always reads the most recent closed bar.
comment=Appears in Signal Logs, not in the MT5 order comment (see above).

PineHook commands in compatibility mode#

You can also use PineHook's native commands and their explicit-unit parameters in compatibility mode. PineHook syntax covers laddered targets, delayed alerts, timed closes, symbol controls, queue control, and slippage guards.