Common Parameters

Learn the PineHook parameters many commands share: hedging protection, magic numbers, tickets, delayed alerts, pending-order expiry, timed closes and clearqueue.

Last updated: 2026-10-08

Some parameters work on many commands rather than one. They decide which strategy or trade an alert acts on, whether it may open against an existing position, and when it runs or ends. This page explains each of them, and Commands shows where each one fits in a specific command.

ParameterWhat it doesAccepted values
hedgingAllows or skips an opposite entry for this alert onlytrue or false
magicPicks the strategy an alert acts on0 to 2,147,483,647, or ALL on management commands
ticketPicks one trade, on hedging accounts1 to 32 letters, numbers, ., _ or -
new_ticketNames the replacement in a close-and-open or cancel-and-replace commandSame format as ticket
delayHolds the alert on the server before it runs0 to 86,400 seconds, paid plans only
expiryCancels an unfilled pending order after a number of seconds0 to 315,360,000 seconds
expiry_timeCancels an unfilled pending order at a set timeA future date and time, up to 10 years ahead
closetimeCloses a position a number of seconds after it opens1 to 2,592,000 seconds

setposition accepts hedging, magic and ticket, but not delay, expiry or closetime.

Hedging entry protection#

Allow Hedging is a setting for hedging accounts, where your broker lets you hold a buy and a sell on the same symbol at once. Netting and exchange accounts combine opposite orders into one position and ignore the setting, so check with your broker which account type you have. When it is off, PineHook skips a new entry while any position or pending order on the same symbol points the other way, whichever strategy, manual trade or other EA opened it. That helps when your broker or prop firm forbids holding both sides at once. The existing trade keeps running with its stop and target, and entries in the same direction still go through your other limits.

Allow Hedging is On by default, and you can turn it off for all your licenses in trading settings, or for one license under Risk and limits → Position Limits, and clearing a license's override makes it follow the global setting again. cTrader always uses these dashboard settings, while MT5 uses them in Dashboard settings mode and otherwise reads the EA's own Allow Hedging input.

Add hedging=false or hedging=true to an alert to override the setting for that alert only. The override never changes your saved setting, so later alerts without it use the saved value again.

LICENSE_ID,buy,XAUUSD,size_lots=0.1,magic=7,hedging=false
LICENSE_ID,sell,XAUUSD,size_lots=0.1,magic=7,hedging=true
{"license":"LICENSE_ID","action":"buy","symbol":"XAUUSD","size_lots":0.1,"magic":7,"hedging":false}

The parameter works on entries, on commands that close or cancel and then open, and on the opening part of setposition, while close, cancel, modify and EA control commands keep working as usual but reject it. A command that closes and then opens runs its close first, so if the new entry is skipped, the close has already happened and Signal Logs shows both. Turning the setting off doesn't close existing hedges or cancel orders you already placed, either.

A skipped entry shows as Skipped: Hedging Disabled. Skipped: Hedging Protection Unavailable means PineHook couldn't check the account, most often because an older MT5 EA is connected. On cTrader, it can also follow an entry that got no answer from the broker, in which case PineHook holds opposite entries on that symbol for 2 minutes before it checks again.

Trade identification#

A magic number tells PineHook which strategy an alert belongs to, and a ticket names one trade within that strategy, so a later alert can act on that strategy or that trade alone. Hedging and netting accounts explains both in full, including how they behave on each account type.

magic: strategy ID#

magic=N selects one strategy, and leaving it out uses your license's Default Magic, which is 0 unless you change it. Management commands also accept magic=ALL for every strategy, and the magic number rules cover manual trades and your plan's per-symbol limit.

ticket: one logical trade#

ticket= names one trade on a hedging account, so a later alert can act on that trade and nothing else, and new_ticket= names the replacement in a command that closes or cancels and then opens. The ticket rules explain the format, generated tickets and why netting accounts reject them.

Time parameters#

delay: run the alert later#

delay= holds an alert on PineHook's servers for up to 86,400 seconds (24 hours) before sending it on, counted from when PineHook receives it. While it waits, its Signal Logs row shows Queued (Delayed), and each license can hold 50 delayed alerts at once. Delays need a paid plan, although delay=0 runs immediately on any plan.

PineHook checks Active Hours, the news filter and your symbol filter again when a delayed alert runs, so a change while it waits can still block it. If the EA is offline at that moment, the alert is treated like any other missed alert.

expiry and expiry_time: cancel an unfilled pending order#

These parameters cancel a pending order that hasn't filled by a deadline, up to 10 years ahead, and you can use one or the other but not both. expiry counts seconds from when the order is placed, while expiry_time names a moment, read as UTC unless you add an offset such as +03:00. Without either, the order stays until it fills or you cancel it.

On MT5, the EA runs the expiry timer itself, so it only fires while the EA is running, whereas expiry_time also gets a broker-side expiry where the broker supports one. On cTrader, both become the order's own expiry at the broker.

You want it to expire atWrite it as
A UTC timeexpiry_time=2030-01-15T14:30:00Z
Your broker's chart time on a GMT+3 serverexpiry_time=2030-01-15T14:30:00+03:00
One hour after it's placedexpiry=3600

Each license can hold up to 50 unfilled pending orders, or 5 on Trial, and an order's slot frees when it fills, is cancelled or expires. Setting an expiry therefore keeps that count from filling up with orders you've forgotten about.

closetime: close a position after a set time#

closetime=3600 closes the position 3,600 seconds after it opens, with any value from 1 second to 30 days. The timer starts when the position actually opens, so on a pending order it starts at the fill, and an order that never fills never starts it.

LICENSE,buy,EURUSD,size_pct=1,sl_pips=50,tp_pips=100,closetime=3600

If a stop, target or manual close ends the position first, the timer is cancelled, and when it does fire, it closes whatever volume is left. On MT5, a deadline that passes while the market is closed or the terminal is offline fires as soon as quotes return.

clearqueue: cancel delayed alerts#

clearqueue removes delayed alerts that haven't run yet. It only touches PineHook's queue and never your broker, so use cancellong, cancelshort or cancelall to remove pending orders at the broker.

LICENSE,clearqueue,EURUSD
LICENSE,clearqueue,EURUSD,magic=12345
LICENSE,clearqueue,ALL

With a symbol and no magic=, it clears that symbol's alerts for your Default Magic, while magic=ALL covers every strategy on the symbol and ALL in place of the symbol clears the whole license.

Alerts that arrive while your EA is offline are held and handled by your missed-alert recovery setting when it reconnects, as described in Trading settings.

If a parameter is rejected, Alert error messages lists each message and how to fix it.