vol_lots=, sl_pips= and tp_pct= are now available. Legacy parameters such as risk=, sl= and tp= remain fully supported. Learn more here.
To use new explicit parameters, please use the PineConnector MT5 EA v3.51.1 or later.Syntax
Syntax refers to the set of rules that dictate the proper construction of an alert message for PineConnector. Getting these rules right ensures your trading signals are understood and executed correctly by the Expert Advisor (EA).
- Buy 0.1 Lots:
60123456789,buy,AUDUSD,vol_lots=0.1 - Sell 1 Lot with a Secret Key:
60123456789,sell,EURUSD,vol_lots=1, secret=HappyTrader501 - Sell Risking $50:
60123456789,sell,GBPJPY,vol_dollar=50,sl_pips=20 - Close Trade:
60123456789,closelong,GBPUSD
For more examples and detailed interpretations of combined syntax, please see our Detailed Syntax Examples section.
Core Alert Message Principles
Alert Message Guidelines
To create PineConnector-compliant alert messages, please pay close attention to the following guidelines. Failure to adhere to the syntax may result in the EA rejecting your signal.
- The alert message configured on TradingView is valid, as per this Syntax Guide.
- Your selected EA Settings result in the intended trading behavior.
To learn how to send manual or test alerts effectively, click here.
- Check the Signals Log in your PineConnector members' portal. This log shows successfully received and processed signals.
- Important: Rejected signals (e.g., due to incorrect syntax or an incorrect license) will not appear in this log.
Components of an Alert Message
Alert messages are made up of distinct components. Here’s what each part means:
Component | Remarks |
License ID | • Your unique identifier, found in the PineConnector Licensing Dashboard.
• It's typically a long number starting with 6 or 7 (e.g., 70123456789). |
Command | • The specific action you want the EA to take (e.g., buy, sell, closeall).
• Note: Commands do not use an equals sign (=). |
Symbol | • The asset or instrument to be traded (e.g., EURUSD, GBPJPY, US30.Cash). |
Others | • Explicit Parameters (Recommended): Define exact values (e.g., vol_lots=0.1, sl_pips=20).
• Legacy Parameters: Generic values relying on EA settings (e.g., risk=1).
• These parameters always use an equals sign (=). |
Structure of an Alert Message
The components in your alert message must follow this specific order:
LicenseID,Command,Symbol,ParametersKey Structural Rules:
- Order: The sequence (License ID, then Command, then Symbol, then any Other parameters) is mandatory.
- Commas: Components must be separated by commas (
,). - Spaces around the commas are optional (see "Acceptable Syntax" below).
- Uniqueness: Each alert message can only contain one License ID, one Command, and one Symbol.
Acceptable PineConnector Syntax Examples:
LicenseID,Command,Symbol,Parameters(no spaces around commas)LicenseID , Command , Symbol , Parameters(spaces around commas are acceptable)
Unacceptable PineConnector Syntax Examples:
Command,LicenseID,Symbol(Incorrect order)LicenseID,Command,Command(Multiple Commands)LicenseID,LicenseID,Command,Symbol(Multiple License IDs)
Command & Parameter Reference
PineConnector supports two methods for defining order parameters. We strongly recommend using the new Explicit Syntax instead of the Legacy Syntax for all new strategies to ensure maximum precision and independence from EA settings.
1. Explicit Syntax Parameters
Explicit parameters allow you to define exact units (Lots, Pips, Price, $) directly in your alert message. When you use these parameters, the EA ignores its internal "Volume Type" or "Target Type" settings for that specific order.
Here are the available explicit parameters. Click a parameter to jump to its detailed usage guide.
Category | Parameters | Description |
Volume | vol_lots= | Set fixed lot size. |
vol_dollar= | Set risk in dollar amount (requires SL). | |
vol_pct_bal_loss= | Set risk as % of Balance (requires SL). | |
vol_pct_eq_loss= | Set risk as % of Equity (requires SL). | |
vol_pct_bal_margin= | Set volume by % of Balance used as Margin. | |
Stop-Loss | sl_pips= | Set SL distance in pips. |
sl_price= | Set SL at a specific price. | |
sl_pct= | Set SL distance in %. | |
Take-Profit | tp_pips= | Set TP distance in pips. |
tp_price= | Set TP at a specific price. | |
tp_pct= | Set TP distance in %. |
1.1 Volume Parameters
You must select one volume parameter for every entry command.
vol_lots=
Sets the trade volume directly in lots. The EA executes exactly what is written.
- Logic: Input Value = Executed Lots.
- Broker Limits: Ensure the value is within your broker's Minimum and Maximum volume limits (check via Ctrl+U on MT5).
LicenseID,buy,EURUSD,vol_lots=0.1vol_dollar=
Calculates the lot size based on a specific cash amount (in your account currency) you are willing to lose if the Stop-Loss is hit.
SL Required: You must include sl_pips=, sl_price=, or sl_pct= for this to work.
The EA dynamically calculates lot size using your broker's specific contract size.
LicenseID,buy,EURUSD,vol_dollar=50,sl_pips=10vol_pct_bal_loss=
Calculates the lot size so that the potential loss (if SL is hit) equals a specific percentage of your current Account Balance.
SL Required: You must include sl_pips=, sl_price=, or sl_pct= for this to work.
vol_pct_bal_loss=1risks 1% of your account balance.
LicenseID,sell,EURUSD,vol_pct_bal_loss=1,sl_pips=10vol_pct_eq_loss=
Identical to vol_pct_bal_loss, but calculates risk based on Account Equity (Balance ± Open Floating P/L).
SL Required: You must include sl_pips=, sl_price=, or sl_pct= for this to work.
vol_pct_eq_loss=2risks 2% of your equity.
LicenseID,buy,US30,vol_pct_eq_loss=1,sl_pips=50vol_pct_bal_margin=
Calculates the lot size based on using a percentage of your Account Balance as margin. This ignores Stop-Loss distance.
vol_pct_bal_margin=5opens a trade size that requires 5% of your balance as margin.
LicenseID,buy,EURUSD,vol_pct_bal_margin=51.2 Stop-Loss Parameters
These parameters define the Stop-Loss (SL) level. If provided, they override the EA's internal settings.
sl_pips=
Sets the Stop-Loss a specific number of pips away from the entry price.
Important: The EA defines 1 Pip as 10 Points (Symbol Point * 10).
The table below shows the impact of using sl_pips=20 across various assets.
Asset Class | Symbol Digits | 1 Pip Value | Entry Price | Computed SL | Real Distance |
Forex | 5 (e.g., 1.10000) | 0.0001 | 1.10000 | 1.09800 | 0.00200 |
JPY Pair | 3 (e.g., 150.000) | 0.01 | 150.000 | 149.800 | 0.20 |
Indices | 2 (e.g., 34000.00) | 0.10 | 34000.00 | 33998.00 | 2.0 Points |
Gold | 2 (e.g., 2000.00) | 0.10 | 2000.00 | 1998.00 | $2.00 |
Crypto | 2 (e.g., 60000.00) | 0.10 | 60000.00 | 59998.00 | $2.00 |
Note on non-FX pairs: Broker configuration may vary wildly on digits. If sl_pips=20 is too close, your broker likely uses different decimal precision. Try increasing the value (e.g., to 200 or 2000).LicenseID,buy,EURUSD,vol_lots=0.1,sl_pips=20sl_price=
Sets the Stop-Loss at a specific absolute price level.
Data Warning: TradingView prices often differ slightly from your broker. Ensure your sl_price= is not too close to the current market price (inside the Spread + Stops Level), or the broker will reject the order.
LicenseID,buy,EURUSD,vol_lots=0.1,sl_price=1.123
LicenseID,buy,EURUSD,vol_lots=0.1,sl_price=1.123,tp_price=1.321sl_pct=
Sets the Stop-Loss a percentage distance away from the entry price.
- Buy Math: Entry Price × (1 - Percentage)
- Sell Math: Entry Price × (1 + Percentage)
LicenseID,buy,EURUSD,vol_lots=0.1,sl_pct=1
LicenseID,sell,BTCUSD,vol_lots=0.1,sl_pct=11.3 Take-Profit Parameters
These parameters define the Take-Profit (TP) level. If provided, they override the EA's internal settings.
tp_pips=
Sets the Take-Profit a specific number of pips away from the entry price.
Important: The EA defines 1 Pip as 10 Points.
The table below shows the impact of using tp_pips=20 across various assets.
Asset Class | Symbol Digits | 1 Pip Value | Entry Price | Computed TP | Real Distance |
Forex | 5 (e.g., 1.10000) | 0.0001 | 1.10000 | 1.10200 | 0.00200 |
JPY Pair | 3 (e.g., 150.000) | 0.01 | 150.000 | 150.200 | 0.20 |
Indices | 2 (e.g., 34000.00) | 0.10 | 34000.00 | 34002.00 | 2.0 Points |
Gold | 2 (e.g., 2000.00) | 0.10 | 2000.00 | 2002.00 | $2.00 |
Crypto | 2 (e.g., 60000.00) | 0.10 | 60000.00 | 60002.00 | $2.00 |
LicenseID,buy,EURUSD,vol_lots=0.1,tp_pips=20tp_price=
Sets the Take-Profit at a specific absolute price level.
Data Warning: Ensure your tp_price is not too close to the current market price (inside the Spread + Stops Level).
LicenseID,buy,EURUSD,vol_lots=0.1,tp_price=1.500
LicenseID,sell,EURUSD,vol_lots=0.1,sl_price=1.321,tp_price=1.123tp_pct=
Sets the Take-Profit a percentage distance away from the entry price.
- Buy Math: Entry Price × (1 + Percentage)
- Sell Math: Entry Price × (1 - Percentage)
LicenseID,buy,SOLUSD,vol_lots=1,tp_pct=52. Authentication and Other Parameters
secret=
Include this parameter in your alert message to authenticate the signal using a pre-defined secret key. This is only required if you have enabled Signal Authentication in your PineConnector Portal.
LicenseID,buy,EURUSD,vol_lots=1,secret=SECRETKEYsecret= value in your alert matches the secret key you've set in the PineConnector Portal.comment=
Adds a custom text comment to the order in MetaTrader. This is useful for tagging orders with a specific strategy name or ID.
Max Length: 20 characters. Comments longer than this may be truncated or result in a blank comment depending on the broker.
// Valid Comment
LicenseID,buy,EURUSD,vol_lots=0.1,comment=BreakoutStrategy
// Valid (Spaces allowed)
LicenseID,buy,EURUSD,vol_lots=0.1,comment=Trade 123 Set A3. Market Order Commands
These commands are for placing orders that execute immediately at the current market price.
buy
Places a buy (long) order at the current market price.
risk= is a required parameter.
- long
- bull
- bullish
LicenseID,buy,EURUSD,risk=0.01
LicenseID,long,US30.Cash,sl=100,tp=200,risk=1
LicenseID,bullish,GBPJPY,risk=1,comment=Stategy Alphasell
Places a sell (short) order at the current market price.
risk= is a required parameter.
- short
- bear
- bearish
LicenseID,sell,EURUSD,risk=0.01
LicenseID,short,DAX30,risk=2
LicenseID,bear,GBPJPY,risk=14. Pending Order Commands
Commands for placing orders that execute when the price reaches a specified level.
sl_pips, vol_lots) are not yet available for pending orders.pending=
Specifies the entry price or offset for a pending order.
buystop, buylimit).The interpretation of the pending= value depends on the “Pending Order Entry Type” selected in your PineConnector EA settings. Common options:
- Pips: e.g.,
pending=10means 10 pips away from the current market price. - Specified Price: e.g.,
pending=1.12500sets the entry at this exact price. - Percentage: e.g.,
pending=0.1means 0.1% away from the current market price.
LicenseID,buystop,EURUSD,pending=10,risk=1buystop
Places a buy stop order, above the current market price.
pending= and risk= are required parameters.
LicenseID,buystop,EURUSD,pending=10,risk=1buylimit
Places a buy limit order, below the current market price.
pending= and risk= are required parameters.
LicenseID,buylimit,EURUSD,pending=10,risk=1sellstop
Places a sell stop order, below the current market price.
pending= and risk=are required parameters.
LicenseID,sellstop,EURUSD,pending=10,risk=1selllimit
Places a sell limit order, typically above the current market price.
pending= and risk=are required parameters.
LicenseID,selllimit,EURUSD,pending=10,risk=15. Position and Order Management Commands
Commands for closing open positions or cancelling pending orders.
5.1 General Closing & Cancellation
closeall
Closes all open positions and deletes all pending orders that were opened by the specific instance of the PineConnector EA that receives this command. This action applies across all symbols managed by that EA instance.
LicenseID,closeall,ChartSymbolChartSymbol(Mandatory): For this command to be accepted and processed, you must specify the symbol of the chart on which the target PineConnector EA is currently running.- Example: If your EA is running on a
GBPJPY.achart, your command must beLicenseID,closeall,GBPJPY.a. UsingEURUSDin the example below assumes the EA is on a EURUSD chart. - This requirement acts as a safety measure, ensuring the
closeallcommand is intentionally directed to the correct EA instance.
closelong or closeshort instead.cancellong
Cancels all pending buy orders (buystop, buylimit) for the specified symbol.
LicenseID,cancellong,EURUSDcancelshort
Cancels all pending sell orders (sellstop, selllimit) for the specified symbol.
LicenseID,cancelshort,EURUSD5.2 Symbol-Specific Position Closing
closelong
Closes all open buy positions of the specified symbol.
LicenseID,closelong,EURUSDcloseshort
Closes all open sell positions of the specified symbol.
LicenseID,closeshort,EURUSDcloselongshort
Closes all open buy and sell positions of the specified symbol.
LicenseID,closelongshort,EURUSD5.3 Partial Position Closing
closelongpct
Closes a percentage of total open volume for buy positions of the specified symbol. The percentage is based on your selected "Partial Close Percentage" in the EA settings (e.g., 10%, 20%, 25%, 34%, 50%). sl=0 is an optional parameter that moves the stop-loss of remaining positions to breakeven after a partial close.
LicenseID,closelongpct,EURUSD
LicenseID,closelongpct,EURUSD,sl=0 (SL moved to BE after partial close)closeshortpct
Closes a percentage of total open volume for sell positions of the specified symbol, using the EA's "Partial Close Percentage" setting. sl=0 is an optional parameter that moves the stop-loss of remaining positions to breakeven after a partial close.
LicenseID,closeshortpct,EURUSD
LicenseID,closeshortpct,EURUSD,sl=0 (SL moved to BE after partial close)closelongvol
Closes a specific volume of open buy positions for the specified symbol, up to the value indicated by risk=. risk= is a required parameter and represents the volume to close. sl=0 is an optional parameter that moves the stop-loss of remaining positions to breakeven after a partial close.
LicenseID,closelongvol,EURUSD,risk=3
LicenseID,closelongvol,EURUSD,risk=0.5
LicenseID,closelongvol,EURUSD,risk=1.5,sl=0 (SL moved to BE after partial close)- Position A: Buy 1 lot (opened first)
- Position B: Buy 2 lots (opened second)
- Position C: Buy 0.5 lots (opened last)
- Partial Closure Across Multiple Positions
- Command:
LicenseID,closelongvol,EURUSD,risk=2.8 - Result: Position A (1 lot) closes fully. Position B (2 lots) partially closes 1.8 lots, leaving 0.2 lots. Position C (0.5 lots) is unaffected.
- Closing More Than Total Volume
- Command:
LicenseID,closelongvol,EURUSD,risk=4 - Result: All positions (A, B, C) close fully as the requested close volume (4 lots) exceeds total open volume (3.5 lots).
- Closing Less Than Smallest Part of Oldest Position
- Command:
LicenseID,closelongvol,EURUSD,risk=0.4 - Result: Position A (1 lot) partially closes 0.4 lots, leaving 0.6 lots. Positions B and C are unaffected.
closeshortvol
Closes a specific volume of open sell positions for the specified symbol, up to the value indicated by risk=. risk= is a required parameter and represents the volume to close. sl=0 is an optional parameter that moves the stop-loss of remaining positions to breakeven after a partial close.
LicenseID,closeshortvol,EURUSD,risk=3
LicenseID,closeshortvol,EURUSD,risk=0.5
LicenseID,closeshortvol,EURUSD,risk=1.5,sl=0 (SL moved to BE after partial close)6. Order Modification Commands
Commands to change parameters of existing open positions or pending orders.
6.1 Modifying Open Positions
newsltplong
Modifies the stop-loss (SL) and/or take-profit (TP) of all open buy positions for the specified symbol. New SL/TP values are computed based on your selected “Target Type” in the EA.
LicenseID,newsltplong,EURUSD,sl_pips=10
LicenseID,newsltplong,EURUSD,tp_pips=20
LicenseID,newsltplong,EURUSD,sl_pips=30,tp_pips=60
LicenseID,newsltplong,EURUSD,sl_price=1.12345 (price)
LicenseID,newsltplong,EURUSD,sl_pct=1,tp_pct=2 (percentage)
LicenseID,newsltplong,EURUSD,sl=0 (breakeven)sl= / tp= values for Modification:- Pips: If Target Type is Pips,
sl=10means the EA sets the SL 10 pips from the current market price (not original entry price) at the time of modification. - Percentage: If Target Type is Percentage,
sl=1means the EA sets the SL 1% from the current market price.
sl=0
To move the stop-loss of all your buy positions for the specified symbol to their entry price (breakeven), send sl=0.
Required Conditions for Breakeven (sl=0)- The position must be in profit.
- The current market price must be sufficiently far from the entry price to allow the SL modification (broker/platform minimum distance rules apply). If these conditions are not met, the modification might fail, potentially resulting in Error 4756 (Invalid Price) on MT5.
newsltpshort
Modifies the SL and/or TP of all open sell positions for the specified symbol. Works similarly to newsltplong.
LicenseID,newsltpshort,EURUSD,sl_pips=10
LicenseID,newsltpshort,EURUSD,tp_pips=20
LicenseID,newsltpshort,EURUSD,sl_pips=30,tp_pips=60
LicenseID,newsltpshort,EURUSD,sl_price=1.12345 (price)
LicenseID,newsltpshort,EURUSD,sl_pct=1,tp_pct=2 (percentage)
LicenseID,newsltpshort,EURUSD,sl=0 (breakeven)(Refer to newsltplong asides for interpretation of values and breakeven conditions.)
6.2 Modifying Pending Orders
newsltpbuystop
Modifies the SL and/or TP of all pending buystop orders for the specified symbol.
LicenseID,newsltpbuystop,EURUSD,sl=10
LicenseID,newsltpbuystop,EURUSD,tp=20
LicenseID,newsltpbuystop,EURUSD,sl=30,tp=60newsltpbuylimit
Modifies the SL and/or TP of all pending buylimit orders for the specified symbol.
LicenseID,newsltpbuylimit,EURUSD,sl=10
LicenseID,newsltpbuylimit,EURUSD,tp=20
LicenseID,newsltpbuylimit,EURUSD,sl=30,tp=60newsltpsellstop
Modifies the SL and/or TP of all pending sellstop orders for the specified symbol. New SL and TP are computed based on your selected Target Type on the EA.
LicenseID,newsltpsellstop,EURUSD,sl=10
LicenseID,newsltpsellstop,EURUSD,tp=20
LicenseID,newsltpsellstop,EURUSD,sl=30,tp=60newsltpselllimit
Modifies the SL and/or TP of all pending selllimit orders for the specified symbol.
LicenseID,newsltpselllimit,EURUSD,sl=10
LicenseID,newsltpselllimit,EURUSD,tp=20
LicenseID,newsltpselllimit,EURUSD,sl=30,tp=607. Combined Action Commands
These commands perform multiple actions in sequence, such as closing existing positions/orders and then opening new ones.
7.1 Close Position & Open New Market Order
closelongopenlong
Closes all open buy positions for the specified symbol and then immediately opens a new buy market order. Either of the volume parameter (vol_lots, vol_dollar, vol_pct_bal_loss, etc) is required. The short form (CL+OL) is also accepted.
LicenseID,closelongopenlong,EURUSD,vol_lots=1
LicenseID,CL+OL,EURUSD,vol_lots=1closelongopenshort
Closes all open buy positions for the specified symbol and then immediately opens a new sell market order. Either of the volume parameter (vol_lots, vol_dollar, vol_pct_bal_loss, etc) is required. The short form (CL+OS) is also accepted.
LicenseID,closelongopenshort,EURUSD,vol_lots=1
LicenseID,CL+OS,EURUSD,vol_lots=1closeshortopenlong
Closes all open sell positions for the specified symbol and then immediately opens a new buy market order. Either of the volume parameter (vol_lots, vol_dollar, vol_pct_bal_loss, etc) is required. The short form (CS+OL) is also accepted.
LicenseID,closeshortopenlong,EURUSD,vol_lots=1
LicenseID,CS+OL,EURUSD,vol_lots=1closeshortopenshort
Closes all open sell positions for the specified symbol and then immediately opens a new sell market order. Either of the volume parameter (vol_lots, vol_dollar, vol_pct_bal_loss, etc) is required. The short form (CS+OS) is also accepted.
LicenseID,closeshortopenshort,EURUSD,risk=1
LicenseID,CS+OS,EURUSD,risk=1closelongshortopenlong
Closes all open buy and sell positions for the specified symbol and then immediately opens a new buy market order. Either of the volume parameter (vol_lots, vol_dollar, vol_pct_bal_loss, etc) is required. The short form (CLS+OL) is also accepted.
LicenseID,closelongshortopenlong,EURUSD,risk=1
LicenseID,CLS+OL,EURUSD,risk=1closelongshortopenshort
Closes all open buy and sell positions for the specified symbol and then immediately opens a new sell market order. Either of the volume parameter (vol_lots, vol_dollar, vol_pct_bal_loss, etc) is required. The short form (CLS+OS) is also accepted.
LicenseID,closelongshortopenshort,EURUSD,risk=1
LicenseID,CLS+OS,EURUSD,risk=17.2 Cancel Pending Orders & Open New Pending Order
cancellongbuystop
Cancels all pending buy orders (buystop, buylimit) for the specified symbol and then places a new buystop order. risk= and pending= are required for the new order.
LicenseID,cancellongbuystop,EURUSD,risk=1,pending=10,sl=15,tp=20cancellongbuylimit
Cancels all pending buy orders for the specified symbol and then places a new buylimit order. risk= and pending= are required.
LicenseID,cancellongbuylimit,EURUSD,risk=1,pending=10,sl=15,tp=20cancelshortsellstop
Cancels all pending sell orders for the specified symbol and then places a new sellstop order. risk= and pending= are required.
LicenseID,cancelshortsellstop,EURUSD,risk=1,pending=10,sl=15,tp=20cancelshortselllimit
Cancels all pending sell orders for the specified symbol and then places a new selllimit order. risk= and pending= are required.
LicenseID,cancelshortselllimit,EURUSD,risk=1,pending=10,sl=15,tp=208. Advanced Stop-Loss Management Parameters
These are optional parameters that can be added to entry commands (e.g., buy, sell, buylimit) to enable dynamic stop-loss behaviors like breakeven or trailing.
Breakeven Parameters (betrigger=, beoffset=)
Automatically moves the position's stop-loss to breakeven (or a slight offset) once a certain profit is achieved.
newsltplong or newsltpshort with sl=0 can move an SL to breakeven manually at a later stage, these parameters (betrigger=, beoffset=) set up an automatic breakeven condition at the point of order entry.To use automatic breakeven, include both betrigger= and beoffset= in your entry command syntax. Ensure beoffset= is less than betrigger=.
betrigger=: The number of pips a position must gain before the breakeven function is activated. Must be greater than0.beoffset=: The offset in pips from the entry price where the new stop-loss will be placed.beoffset=0: SL placed exactly at the entry price.beoffset=1: For a buy trade, SL placed 1 pip above entry; for a sell trade, 1 pip below entry (protecting 1 pip of profit).
LicenseID,buy,EURUSD,vol_lots=1,sl=20,betrigger=10,beoffset=2Ensure that the 2 parameters “betrigger=” and “beoffset=” are present in your syntax if using this feature.
- A buy order for EURUSD is placed with an initial stop-loss 20 pips away.
- If the trade moves 10 pips in profit (
betrigger=10), the stop-loss will automatically be moved to 2 pips above the entry price (beoffset=2).
Pip Trailing Parameters (trailtrig=, traildist=, trailstep=)
Automatically moves the stop-loss in the direction of the trade as it becomes more profitable, based on pip values.
- All pip trailing parameters accept integer values; floats will be rounded.
- Trailing computation is based on pips, regardless of the "Target Type" selected in EA settings.
To use pip trailing, include trailtrig=, traildist=, and trailstep= in your entry command.
trailtrig=: The number of pips a trade must gain before the trailing stop-loss is first activated.traildist=: The distance in pips from the current price at which the trailing stop-loss will be maintained. If no initialsl=is set, the first SL will be placed attraildistpips oncetrailtrigis met.trailstep=: The number of pips the price must move further in a favorable direction before the trailing stop-loss is adjusted again (maintaining thetraildist).
LicenseID,buy,EURUSD,vol_lots=1,trailtrig=12,traildist=8,trailstep=3Ensure that the 3 parameters “trailtrig=”, “traildist=” and “trailstep=” are present in your syntax if using this feature.
trailtrig=12: Trailing SL first activates when the price moves 12 pips in favor (entry + 12 pips). The SL is placed at (entry + 12 -traildist) = (entry + 4 pips).trailstep=3: If the price moves another 3 pips in favor (to entry + 15 pips), the SL is trailed again to (entry + 15 -traildist) = (entry + 7 pips).- This continues for every additional 3 pips gained.
trailtrig= for Immediate Activation
Using a negative value (e.g., trailtrig=-10) or trailtrig=0 can activate trailing immediately. trailtrig=0 might activate after the spread is covered.10 for a pip-based parameter might mean 1 index point. Always test with your specific instrument. The EA's "Experts" tab in MetaTrader may print trailing information and activation prices.ATR Trailing Parameters (atrtimeframe=, atrperiod=, atrmultiplier=, atrshift=, atrtrigger=)
Automatically trails the stop-loss based on the Average True Range (ATR) indicator, using MetaTrader's price data (not TradingView's). This allows the SL to adapt to market volatility.
Only atrtimeframe= and atrperiod= are mandatory if using ATR trailing; other ATR parameters have defaults.
atrtimeframe=: The chart timeframe (in minutes) on which the ATR is calculated. The SL updates once per bar close of this timeframe. If an initialsl=is not specified, an SL will be automatically added based on ATR values.- MT4 Allowable Values:
1(1 min),5,15,30,60(1 hr),240(4 hr),1440(1 day). atrperiod=: The averaging period for the ATR calculation (e.g.,14for a 14-period ATR).atrmultiplier=: The multiple of the ATR value used to calculate the stop-loss distance. Default:1.atrshift=: The bar shift for ATR calculation.0uses the most recently closed candle's ATR,1uses the second most recent, etc. Default:0.atrtrigger=: The number of pips a trade must gain before ATR trailing is activated. Default:0(activates immediately, subject to initial SL placement).
LicenseID,buy,EURUSD,vol_lots=1,sl=10,
atrtimeframe=60,atrperiod=14,atrmultiplier=2,atrtrigger=8Ensure that the 2 parameters “atrtimeframe=” and “atrperiod=” are present in your syntax if using this feature. Other ATR components are optional and will use their default values if omitted.
- A buy order for EURUSD is placed with an initial SL 10 pips away.
- ATR Trailing will activate after the price moves 8 pips in favor (
atrtrigger=8). - The trailing SL distance will be based on an ATR calculated on the 60-minute (
atrtimeframe=60) chart, using a 14-period (atrperiod=14) ATR, and the distance will be 2 times (atrmultiplier=2) this ATR value.
9. Trade Entry Filters
Optional parameters that can be added to entry commands to prevent trades unless certain market or account conditions are met.
spread=
Allows an entry order only if the current market spread for the instrument is equal to or less than the specified value in pips.
LicenseID,buy,EURUSD,vol_lots=1,spread=2
LicenseID,buy,EURUSD,vol_lots=1,spread=1.22accfilter=
Allows an entry order only if a specified account metric meets a certain value.
The metric checked depends on the Account Filter Type selected in your PineConnector EA settings. EA Options for Filter Type: Account Balance, Account Equity, Margin Percentage and Free Margin
LicenseID,buy,EURUSD,vol_lots=1,accfilter=500- Assume "Account Filter Type" in EA is set to
Account Balance. - Syntax:
LicenseID,buy,EURUSD,vol_lots=1,accfilter=500 - Interpretation: The buy signal will only be processed if the Account Balance is $500 or higher. If less than $500, the signal is ignored.
10. EA Management Commands
Commands to control the operational state of the PineConnector EA.
eaoff
Halts the PineConnector EA. If the EA is halted, incoming signals will not be processed.
Note: For the eaoff command, the third parameter (where a symbol typically goes) must also be eaoff. This acts as a specific instruction identifier for the EA.
LicenseID,eaoff,eaoffeaon
Reactivates a halted PineConnector EA.
- Note: Similar to
eaoff, the third parameter must also beeaon.
LicenseID,eaon,eaonclosealleaoff
Closes all open positions and pending orders managed by the specific EA instance (similar to closeall) and then halts that PineConnector EA (similar to eaoff).
This command will only affect positions/orders opened by this PineConnector EA unless Magic Restriction is turned off in the EA.
LicenseID,closealleaoff,ChartSymbolChartSymbol(Mandatory): As withcloseall, you must specify the symbol of the chart on which the target EA is running for the command to be accepted.- Example:
LicenseID,closealleaoff,GBPJPY.aif the EA is on aGBPJPY.achart.
11. Sample Combined Syntax
This section provides examples of how different parameters can be combined in an alert message.
Market Orders (buy/sell)
Syntax | Interpretation |
60123456789,buy,AUDUSD,vol_lots=0.01 | • Enters a long AUDUSD trade
• Opens a 0.01 position size/lots |
60123456789,sell,GBPJPY,sl_pips=50,tp_pips=150,vol_lots=1 | • Enters a short volume GBPJPY trade
• Opens a 1 volume position
• SL and TP placed 50 and 150 pips from current price |
60123456789,buy,EURUSD,vol_lots=1,spread=3 | • Opens a buy EURUSD at the market if current spread is 3 or lower
• Opens a position with 1 volume
• No SL or TP will be added |
60123456789,closelong,GBPUSD | • Closes the all GBPUSD long trades |
60123456789,newsltplong,EURUSD,sl_pips=10,tp_pips=30 | • Updates SL to 10 pips from current market price
• Updates TP to 30 pips from current market price |
60123456789,buy,AUDUSD,vol_lots=0.01,secret=HelloWorld | • Enters a long AUDUSD trade
• Opens a 0.01 position size/lots
• Signal will only open if Secret Key matches the one specified in the PineConnector Portal |
With Pips or ATR Trailing, or Breakeven
Syntax | Interpretation |
60123456789,buy,EURUSD,sl_price=1.20,vol_pct_bal_loss=1,trailtrig=15,traildist=10,trailstep=12 | • Opens a long EURUSD position
• Volume is dynamically computed which risks 1% of your account balance
• Initial SL at 1.20
• Trailing stop to activate when price moves favorably by 15 pips
• Every 12 pips move in favor of direction, the stop-loss will move to 10 pips from current price |
60123456789,buy,EURUSD,sl_pips=10,
atrtimeframe=60,atrperiod=14,atrmultiplier=2,atrtrigger=8,vol_lots=5 | • Opens a buy EURUSD at the market
• Opens 5 volumes
• SL placed 10 pips away
• ATR Trailing will begin after 8 pips of favorable move.
• ATR is computed using the average of the previous 14 60-min candles, multiplied by 2. |
60123456789,buy,EURCAD,sl=100,vol_lots=5,betrigger=30,beoffset=5 | • Opens a buy EURCAD at the market
• Opens 5 volumes (“lots” volume type)
• SL placed 10 pips away (”pips” target type)
• SL will be moved to (entry price + 5 pips) when price has moved favorably by 30 pips. |
Pending Orders (buylimit, selllimit, buystop, sellstop)
sl_pips, vol_lots) are not yet available for pending orders.Syntax | Interpretation |
60123456789,selllimit,EURUSD,pending=1.2340,sl=10,risk=1 | • Places a sell limit on EURUSD order
• Entry price set at 1.2340 (”price” pending order entry type)
• Opens a position with 1 volume (“lots” volume type)
• SL placed 10 pips away from entry price (”pips” target type) |
60123456789,cancellong,EURUSD | • Cancels all long pending orders (buystop and buylimit) for EURUSD |
12. Legacy Syntax Parameters
risk=
Specifies the order volume or risk exposure.
The function of the risk= value depends on the “Volume Type” selected in your PineConnector EA settings on MetaTrader.
- Lots: e.g., risk=0.1 means 0.1 lots.
- Dollar Amount: e.g., risk=100 means the EA will calculate lots so the risk is ~$100.
- Percentage of Balance: e.g., risk=1 means the EA will calculate lots to risk 1% of balance.
// Example if EA Volume Type is 'Lots'
LicenseID,buy,EURUSD,risk=0.01
// Example if EA Volume Type is 'Percentage of Balance'
LicenseID,sell,EURCAD,risk=2sl=
Sets the stop-loss for an order.
The interpretation of the sl= value (pips, price level, or percentage) depends on the “Target Type” selected in your PineConnector EA settings.
- Pips: e.g., sl=50 sets the Stop-Loss 50 pips away from entry.
- Price: e.g., sl=1.12300 sets the Stop-Loss at the price 1.12300.
- Percentage: e.g., sl=0.5 sets the Stop-Loss 0.5% away from entry.
LicenseID,buy,EURUSD,risk=1,sl=50tp=
Sets the take-profit for an order.
Similar to sl=, the value for tp= is interpreted based on the “Target Type” selected in your PineConnector EA settings.
- Pips: e.g., tp=100 sets the Take-Profit 100 pips away from entry.
- Price: e.g., tp=1.13500 sets the Take-Profit at the price 1.13500.
- Percentage: e.g., tp=1.0 sets the Take-Profit 1.0% away from entry.
LicenseID,buy,EURUSD,risk=1,tp=10013. Changes to Syntax
This section outlines the latest updates and improvements we have made to the PineConnector syntax.
18 December 2025: Explicit Syntax for Market Orders
Introduction of Explicit Syntax
We are introducing a new way to construct alerts called Explicit Syntax. This update adds specific parameters—such as vol_lots=, sl_pips=, and tp_price=—that allow you to define the exact unit of measurement for your trades directly within the alert message. The goal is to give you total control over every signal without needing to rely on or constantly change your global EA settings.
Breaking Free from EA Settings
Previously, your alerts were heavily tied to the settings you configured in the PineConnector EA. For example, if your EA "Volume Type" was set to Lots, every single signal you sent had to be interpreted as a fixed lot size. If you wanted to send a specific trade risking a dollar amount instead, you had to manually change the EA setting, which wasn't practical for automated trading. With Explicit Syntax, that limitation is gone. You can now tell the EA exactly what to do for each individual trade, ignoring the global defaults.
Unmatched Flexibility
This update provides a level of flexibility that wasn't possible before. You can now mix and match different logic within the same strategy or even the same alert. For instance, you can set your Stop-Loss in pips (sl_pips=) while setting your Take-Profit as a percentage (tp_pct=). Furthermore, one incoming signal can calculate volume based on a fixed lot size (vol_lots=), while the very next signal can calculate volume based on a percentage of your balance (vol_pct_bal_loss=). This gives you precise control over your risk management on a trade-by-trade basis.
Compatibility and Rules
We designed this update to be seamless for all users. If you prefer using the standard Legacy Syntax (risk=, sl=, tp=), you can continue to do so; it remains 100% supported and will continue to respect your EA settings.
However, if you choose to use the new Explicit Syntax in an alert, it will take priority. The EA will detect the explicit parameter (e.g., vol_lots=) and ignore any corresponding Legacy parameter or EA setting for that specific instruction. Just be careful not to send conflicting instructions—such as trying to define both vol_lots= and vol_dollar= in the same message—as the EA will reject the signal to prevent unintended behavior.
Current Scope
For this initial release, Explicit Syntax supports Market Orders only (e.g., buy, sell). We plan to expand this functionality to Pending Orders in a future update.
New Explicit Parameters
Category | Parameters | Description |
Volume | vol_lots= | Set fixed lot size. |
vol_dollar= | Set risk in cash amount (requires SL). | |
vol_pct_bal_loss= | Set risk as % of Balance (requires SL). | |
vol_pct_eq_loss= | Set risk as % of Equity (requires SL). | |
vol_pct_bal_margin= | Set volume by % of Balance used as Margin. | |
Stop-Loss | sl_pips= | Set SL distance in pips. |
sl_price= | Set SL at a specific price. | |
sl_pct= | Set SL distance in %. | |
Take-Profit | tp_pips= | Set TP distance in pips. |
tp_price= | Set TP at a specific price. | |
tp_pct= | Set TP distance in %. |
On this page
- Syntax
- Core Alert Message Principles
- Alert Message Guidelines
- Components of an Alert Message
- Structure of an Alert Message
- Command & Parameter Reference
- 1. Explicit Syntax Parameters
- 1.1 Volume Parameters
- vol_lots=
- vol_dollar=
- vol_pct_bal_loss=
- vol_pct_eq_loss=
- vol_pct_bal_margin=
- 1.2 Stop-Loss Parameters
- sl_pips=
- sl_price=
- sl_pct=
- 1.3 Take-Profit Parameters
- tp_pips=
- tp_price=
- tp_pct=
- 2. Authentication and Other Parameters
- secret=
- comment=
- 3. Market Order Commands
- buy
- sell
- 4. Pending Order Commands
- pending=
- buystop
- buylimit
- sellstop
- selllimit
- 5. Position and Order Management Commands
- 5.1 General Closing & Cancellation
- closeall
- cancellong
- cancelshort
- 5.2 Symbol-Specific Position Closing
- closelong
- closeshort
- closelongshort
- 5.3 Partial Position Closing
- closelongpct
- closeshortpct
- closelongvol
- closeshortvol
- 6. Order Modification Commands
- 6.1 Modifying Open Positions
- newsltplong
- newsltpshort
- 6.2 Modifying Pending Orders
- newsltpbuystop
- newsltpbuylimit
- newsltpsellstop
- newsltpselllimit
- 7. Combined Action Commands
- 7.1 Close Position & Open New Market Order
- closelongopenlong
- closelongopenshort
- closeshortopenlong
- closeshortopenshort
- closelongshortopenlong
- closelongshortopenshort
- 7.2 Cancel Pending Orders & Open New Pending Order
- cancellongbuystop
- cancellongbuylimit
- cancelshortsellstop
- cancelshortselllimit
- 8. Advanced Stop-Loss Management Parameters
- Breakeven Parameters (betrigger=, beoffset=)
- Pip Trailing Parameters (trailtrig=, traildist=, trailstep=)
- ATR Trailing Parameters (atrtimeframe=, atrperiod=, atrmultiplier=, atrshift=, atrtrigger=)
- 9. Trade Entry Filters
- spread=
- accfilter=
- 10. EA Management Commands
- eaoff
- eaon
- closealleaoff
- 11. Sample Combined Syntax
- Market Orders (buy/sell)
- With Pips or ATR Trailing, or Breakeven
- Pending Orders (buylimit, selllimit, buystop, sellstop)
- 12. Legacy Syntax Parameters
- risk=
- sl=
- tp=
- 13. Changes to Syntax
- 18 December 2025: Explicit Syntax for Market Orders