Skip to content
Docs
Open Portal
Copy the page manually

Your browser did not allow direct clipboard access. Select and copy the Markdown below.

PineConnector Syntax

Find a command or parameter, choose its units, then copy a complete example.

Choose an action, then its values. PineConnector Syntax tells the receiving EA what to request.

Pine Script is the separate programming language that can generate these messages.

Message structureStructure only. Use a complete example after choosing your command and parameters.
TradingView → Message PineConnector Syntax
LicenseID,Command,Symbol,Parameters
Field What goes here
LicenseID The ID for your intended connection in Portal Connections. One ID can address several accounts.
Command One action, such as buy, sell or closelong.
Symbol The exact broker symbol, including suffix and letter case. EA controls can use a special third field.
Parameters The values needed by that action, each written as name=value.
  • Keep the field order shown above, separated by commas. Spaces around commas are optional.
  • Use one License ID, one command and one symbol per message.
  • Keep explanations and alternative messages outside TradingView’s Message field.

Paste separately into TradingView's Webhook URL field.

Try these on demo: paste into TradingView → Message. Replace LicenseID and the broker symbol; use permitted sizes and add your secret= if required.

Buy a fixed size
Buy a fixed size
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20

Result: Calculated; trade not executed Requests 0.01 lot; with the FX-5 entry 1.10000, buy SL 1.09800. More examples →

Choose a planned cash loss
Choose a planned cash loss
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_dollar=100,sl_pips=20

Result: Calculated; trade not executed With a USD 100 budget, 20-pip stop and USD 10 per pip per lot, calculated volume is 0.50 lots before broker volume rounding. More examples →

Close EURUSD buys
Close EURUSD buys
TradingView → Message PineConnector Syntax
LicenseID,closelong,EURUSD

Result: Illustrative; trade not executed Close EURUSD buys within the EA's position scope. More examples →

One ID can reach several accounts. Check the intended accounts and the EA’s trade scope, then follow the demo test workflow.

Use explicit units such as vol_lots= and sl_pips= for new messages. Choose one method for each value. Explicit units take priority over corresponding setting-dependent inputs; they do not bypass other EA filters or broker rules.

Use your broker’s values when adapting an example. These are illustrative values, not EA defaults or recommended trade settings:

  • FX-5: EURUSD entry 1.10000, five decimals, quoting Point 0.00001, one PineConnector pip 0.00010.
  • Account: USD 10,000 balance and 9,100 equity.
  • Results: requests before broker handling, not executed trades. Any variation is stated beside the example.

Choose fields for an entry:

  • One explicit volume method.
  • At most one stop method and one target method.
  • An explicit stop whenever you use loss-based sizing.

Omitted values: check the receiving EA settings. A missing parameter does not establish a numeric default; this page names a default only where the reference supplies one.

One PineConnector pip = 10 symbol quoting points. Multiply a pip distance by that pip size to get a price distance. Point describes the quote; the broker’s tick size is the minimum tradable price change and can differ from Point.

Teaching class Quoting Point One PineConnector pip sl_pips=20 distance Illustrative buy SL
FX-5: five decimals, entry 1.10000 0.00001 0.00010 20 × 0.00010 = 0.00200 1.09800
FX-3: three decimals, entry 150.000 0.001 0.010 20 × 0.010 = 0.200 149.800
METAL-2: two decimals, entry 2000.00 0.01 0.10 20 × 0.10 = 2.00 1998.00

Calculated example; not an executed trade.

Use precision, not the asset name. Two-decimal index and crypto examples share the same pip size above. An asset name does not establish its broker precision.

Account currency does not change this price level when entry and pip size stay fixed. It matters for loss-based volume.

The same 20 pips can mean a different distance

PineConnector uses 1 pip = 10 symbol points. Select an example to inspect the price calculation and decimal precision.

Example symbolDistance as a share of entry
Example entry
1.10000
5 decimal places
20-pip distance
0.00200
1 pip = 0.00010
Stop loss (buy)
1.09800
Entry minus the distance

20 × 0.00010 = 0.00200 price units, or 0.1818% of this example entry.

These entry prices and decimal precisions are examples, not live quotes or a rule for every asset class. Check your broker’s symbol precision and minimum stop distance.

Calculated example; not an executed trade.

Read the example

Given: Five illustrative quotes/precisions; start with FX-5 buy at 1.10000. Only three precision classes are represented.

Alert: LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20

Result and why: At a five-decimal EURUSD entry of 1.10000, sl_pips=20 is a 0.00200 price distance and the buy stop is 1.09800. At a three-decimal JPY-pair entry of 150.000, the distance is 0.20 and the buy stop is 149.800.

At a two-decimal gold entry of 2000.00, the same input is a 2.00 price distance. The example index at 34000.00 and crypto at 60000.00 also use two decimals and a 2.00 distance. These distances represent different percentages of their entry prices.

The same PineConnector pip convention applies to pip-based stops, targets, entries, breakeven, trailing and spread. Broker precision can differ even for the same symbol. Point is a quoting point, not necessarily the minimum tradable price change (tick size).

Look up your symbol’s Point, tick size and stop constraints. The same pip convention applies to pip-based stops, targets, entries, breakeven, trailing, ATR triggers and spread.

Calculate a pending entry offset from the market reference when the request arrives. Then calculate its pip/percentage SL and TP from the pending entry, including when modifying the targets of an existing pending order.

Pending command Pip entry formula Percentage entry formula
buystop, selllimit Market + entry_pips × pip Market × (1 + entry_pct ÷ 100)
buylimit, sellstop Market − entry_pips × pip Market × (1 − entry_pct ÷ 100)

Given the FX-5 market reference 1.10000:

  1. Buy stop entry_pips=20 gives entry 1.10200.
  2. Its sl_pips=20 gives SL 1.10000: 1.10200 − 20 × 0.00010.

Wrong base: measuring the stop from market gives 1.09800, a different 40-pip distance from the pending entry. This contrasts calculations; it is not a second command to send.

Calculated example; not an executed trade. Bid/ask spread is omitted from the single market reference. Check the receiving account for actual quote side, fills and broker handling.

Existing-position relative modifications have a separate reference-price limit.

Lots = planned loss budget ÷ (stop distance in pips × pip value per 1.00 lot), before broker volume rounding. A stop stated as a price or percentage first gives a price distance from the applicable entry; divide that distance by the symbol’s PineConnector pip size.

Method Budget in account currency
vol_dollar= Supplied cash amount
vol_pct_bal_loss= Balance × message percentage ÷ 100
vol_pct_eq_loss= Equity × message percentage ÷ 100

Given FX-5, vol_dollar=100, a 100,000 EUR contract and USD 10 per pip per 1.00 lot:

Stop choice Distance in pips Lots before broker volume rounding
sl_pips=20 20 100 ÷ (20 × 10) = 0.50
Exact stop 1.09500 (1.10000 − 1.09500) ÷ 0.00010 = 50 100 ÷ (50 × 10) = 0.20
1% stop 0.01100 ÷ 0.00010 = 110 100 ÷ (110 × 10) ≈ 0.090909

Calculated example; not an executed trade. USD 10 is a scenario assumption, not a universal pip value. Look up your broker’s contract, tick-value and currency details.

Costs, fills, gaps and broker limits can make actual loss differ from the sizing input.

With equity 9,100, a 1% budget is 91. The same 20-pip stop gives 91 ÷ (20 × 10) = 0.455 lots before rounding.

On an illustrative 0.01 volume step, that lies between 0.45 and 0.46. The EA’s rounding direction is not established here. Check the requested and accepted volume rather than choosing either by assumption.

Check accounts first, then trades. A License ID can address several accounts. Neither a symbol nor a comment proves there is only one recipient.

  • Symbol commands: use the exact broker symbol, including case and suffix.
  • closeall / closealleaoff: use the receiving EA’s chart symbol as the third field. They can affect other symbols within scope.
  • Magic Restriction: check this EA setting to determine whether management can include manual trades and other EAs.
  • comment=: a supported filter narrows management to the exact strategy label. Omitting it can broaden the request.
  • eaoff / eaon: use their own command word as the third field.

Given: each demo account has a matching EA buy and sell on EURUSD, plus a manual EURUSD buy. Magic Restriction limits management to matching EA positions.

Result: the message below requests closure of matching EA buys on both accounts. Matching sells and manual buys stay outside that selection. Illustrative request; not an executed trade.

Close matching buys within the supplied scope
TradingView → Message PineConnector Syntax
LicenseID,closelong,EURUSD

Why: closelong selects buys, EURUSD selects the symbol, Magic Restriction limits eligible positions, and the shared ID supplies both recipients.

Changing only the command changes the selection:

  • closeshort: matching sells.
  • cancellong: pending buy orders; these open positions are outside the operation.

No request here establishes an actual close.

Illustrative request; not an executed trade. For an EA-wide closeall, replace its third-field ChartSymbol with the receiving EA chart symbol; that field does not limit management to that symbol. See the complete close reference rows.

Before closing, cancelling or modifying, look up the receiving accounts and settings. Afterwards check both what changed and what remained. Command tables state the requested scope, not a list of tickets known to exist in your account.

  1. Open Market Watch, right-click the receiving broker’s exact symbol (including suffix), then choose Specification.
  2. Record Digits, Stops level (points), minimum/maximum volume and Volume step.
  3. Obtain Point, tick size, tick value and its currency, contract size and contract/quote currency from the same MT5 specification. Ask the broker for any field missing from your terminal view.
  4. Compare your request with those limits: Stops level × Point gives the minimum stop distance; tick size separately governs price increments. Volume must meet minimum, maximum and step rules. The EA’s rounding policy is separate.

No terminal access on Edge? Request the same broker MT5 symbol specification through the broker or support. Include broker/server and exact symbol. Keep credentials and keys private.

With Stops level 20 points and Point 0.00001, minimum distance is 20 × 0.00001 = 0.00020. A tick size of 0.00005 independently controls price increments.

Do not substitute tick size for Point or infer a USD pip value from an asset name. A displayed zero stop level does not prove every stop will be accepted.

Calculated example; not an executed trade. The 20-point stop level and 0.00005 tick size above are a lookup illustration, not limits for the FX-5 fixture or your broker.

MetaTrader Specification · MetaQuotes symbol properties.

  1. In Portal Connections, check the intended ID and all receiving accounts.
  2. Read current balance, equity, account currency, free margin and margin level in the receiving terminal/account view. Without hosted access, request them through broker/support. An old screenshot does not establish values at arrival.
  3. Open the receiving EA’s Inputs. Check Magic Restriction, Partial Close Percentage and Account Filter Type. For legacy messages also check Volume Type, Target Type, Pending Order Entry Type and Parameter Source where applicable.
  4. For pending/modification calculations, inspect actual pending or position entry and current broker bid/ask. For ATR, match the broker MetaTrader symbol, timeframe, lookback and bar offset.

Settings unavailable? Ask support to confirm the receiving configuration. An alert’s numeric value does not identify an EA setting.

Not supplied here: broker ATR series, exact build-specific shift mapping or an EA rounding rule.

Prefer explicit units for new messages. vol_lots=0.01 requests 0.01 lot. Generic risk=0.01 needs the EA’s legacy Volume Type to identify a size.

Their volume interpretation matches only when Volume Type is Lots and legacy Parameter Source uses message values. This comparison does not permit mixing volume methods.

Explicit units take priority over corresponding setting-dependent inputs. Authentication, account filters, scope and broker rules still apply. Confirm compatibility before changing an older setup.

Release history and older alerts

The recorded milestones are 18 December 2025 for explicit units and 27 January 2026 for expanded explicit pending methods. These dates do not identify the minimum compatible EA build.

Read the preserved legacy reference.

Choose how to size the trade. Use one volume method for each entry.

A loss budget needs a stop distance. Margin allocation is a separate calculation.

Choose one Use when you want…
1. vol_lots= A fixed number of lots.
2. vol_dollar= A planned cash loss at the stop.
3. vol_pct_bal_loss= A planned loss based on balance.
4. vol_pct_eq_loss= A planned loss based on equity.
5. vol_pct_bal_margin= A percentage of balance allocated as margin.

Request a fixed lot size. 0.01 means 0.01 lot, not 1% risk. Check the broker’s minimum, maximum and lot increment.

Given: Fixed quantity

Buy a fixed lot size
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20

Result: Illustrative; trade not executed 0.01 lot requested; buy SL 1.09800.

Why: The supplied 0.01 lot passes through as a quantity; stop distance does not convert it into account-risk sizing.

Lot minimum, maximum and volume step come from the broker specification.

Stop loss required

vol_dollar=100 sizes the trade for a planned loss of about 100 at the stop, in account currency: USD 100 on the illustrative USD account.

Add one stop: sl_pips=, sl_price= or sl_pct=.

Volume uses the stop distance and broker details. Actual loss can differ with execution, costs and broker limits.

Given: USD account; planned cash loss USD 100; FX-5; stop 20 pips; USD 10 per pip per 1.00 lot.

Plan a cash loss at the stop
ExampleAlert message
1Pips
Pips
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_dollar=100,sl_pips=20

Result: Calculated; trade not executed FX-5 buy SL 1.09800; calculated volume 0.50 lots before broker volume rounding.

2Price
Price
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_dollar=100,sl_price=1.09500

Result: Calculated; trade not executed FX-5 buy SL 1.09500; calculated volume 0.20 lots before broker volume rounding.

3Percentage
Percentage
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_dollar=100,sl_pct=1

Result: Calculated; trade not executed FX-5 buy SL 1.08900; calculated volume ≈0.090909 lots before broker volume rounding.

Why: 100 (message cash budget) ÷ [20 (message stop pips) × 10 (fixture USD per pip per lot)] = 0.50 lots.

The USD 10 pip value assumes a USD account and a 100,000 EUR contract. Actual loss can differ with execution and costs.

A wider stop means a smaller position

Keep the planned loss at USD 100. Change the stop distance and see how the calculated lot size changes.

Lots

Stop distance · pips

Planned loss
USD 100
vol_dollar=100
Stop distance
20 pips
Chosen for this example
Calculated size
0.50 lots
Before volume rounding

100 ÷ (20 × 10) = 0.5 lots.

Illustrative FX-5 EURUSD, USD account, 100,000 EUR contract and USD 10 per pip per lot; all calculated lots are before broker volume rounding. Real sizing uses broker contract details and volume limits; costs and execution can change the loss.

Calculated example; not an executed trade.

Read the example

Given: FX-5 EURUSD buy at 1.10000; USD account, 100,000 EUR contract; pip value USD 10 per 1.00 lot.

Alert: LicenseID,buy,EURUSD,vol_dollar=100,sl_pips=20

Result and why: With vol_dollar=100 and a 20-pip stop, this example gives 100 ÷ (20 × 10) = 0.50 lots. A 40-pip stop gives 0.25 lots; an 80-pip stop gives 0.125 lots before broker rounding.

The cash budget stays the same while the stop distance changes the calculated size. Loss-based volume needs one explicit stop method in the same message: sl_pips=, sl_price= or sl_pct=.

Stop loss required

Size the trade for a planned loss based on account balance. 1 means 1%: on a 10,000 balance, that is 100 in account currency at the chosen stop.

Include one explicit stop method. Use the shared loss-based sizing formula; this budget is not the amount of margin used.

Given: USD balance 10,000; FX-5 sell; 20-pip stop; USD 10 per pip per lot.

Use balance for the risk amount
TradingView → Message PineConnector Syntax
LicenseID,sell,EURUSD,vol_pct_bal_loss=1,sl_pips=20

Result: Calculated; trade not executed USD 100 planned loss budget; 0.50 lots before broker volume rounding; sell SL 1.10200.

Why: 10,000 (fixture balance) × 1 ÷ 100 (message percentage) = USD 100; 100 ÷ (20 × 10) = 0.50 lots.

USD account, 100,000 EUR contract and the stated pip value; requested size, not actual loss.

Stop loss required

Use account equity for the planned loss calculation. Equity includes floating profit or loss, so it can differ from balance. 1 means 1% of equity.

Include one explicit stop method and the shared loss-based sizing formula. Actual loss can differ from the planned amount.

Given: USD equity 9,100; FX-5 buy; 20-pip stop; USD 10 per pip per lot.

Use equity for the risk amount
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_pct_eq_loss=1,sl_pips=20

Result: Calculated; trade not executed USD 91 planned loss budget; 0.455 lots before broker volume rounding; buy SL 1.09800.

Why: 9,100 (fixture equity) × 1 ÷ 100 (message percentage) = USD 91; 91 ÷ (20 × 10) = 0.455 lots.

USD account and 100,000 EUR contract. The 0.01 illustrative volume step does not establish whether the EA rounds to 0.45 or 0.46.

Allocate a percentage of balance as margin. 5 means 5% of balance used as margin.

  • This does not limit loss to 5%.
  • Stop distance is not used for this volume calculation.

Given: USD balance 10,000.

Allocate margin
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_pct_bal_margin=5,sl_pips=20

Result: Calculated; trade not executed USD 500 margin allocation; not a USD 500 loss limit. The resulting lots need the broker margin calculation.

Why: 10,000 (fixture balance) × 5 ÷ 100 (message percentage) = USD 500 allocated as margin.

Leverage, symbol margin requirements, account currency and broker volume limits are needed to determine lots.

Balance and equity give different loss budgets

Move through an example account with open floating profit or loss. Compare the budgets for a new entry at each snapshot.

USD

Account snapshots

1% of balance
USD 100
vol_pct_bal_loss=1 · needs SL
1% of equity
USD 91
vol_pct_eq_loss=1 · needs SL
5% as margin
USD 500
vol_pct_bal_margin=5 · uses balance

Equity USD 9,100 = balance USD 10,000 − USD 900 floating loss. The margin budget is not a loss limit.

Illustrative USD account, with no deposits, withdrawals or closed trades between snapshots. These are new-entry budgets, not changes to an existing position’s size.

Calculated example; not an executed trade.

Read the example

Given: USD balance 10,000; equity 9,100; compare new-entry loss budgets, with a 20-pip stop.

Alert: LicenseID,buy,EURUSD,vol_pct_eq_loss=1,sl_pips=20

Result and why: At a balance of USD 10,000 and equity of USD 9,100, vol_pct_bal_loss=1 gives a USD 100 planned loss budget; vol_pct_eq_loss=1 gives USD 91. Both need an explicit stop.

vol_pct_bal_margin=5 also uses balance: its margin budget is USD 500 in this example. It does not use stop distance and does not cap the trade’s loss at USD 500.

Choose one method when opening a trade. A buy stop loss is below the applicable entry; a sell stop loss is above it.

One entry, three ways to set the stopIllustrative buy at 1.10000 · one price scale
1.10000Buy entryFX-5 · EURUSD
1.09800sl_pips=2020 × 0.00010 = 0.00200 price distance
1.09500sl_price=1.09500Use the supplied level. No conversion.
1.08900sl_pct=11.10000 × 1% = 0.01100 price distance

From a buy entry of 1.10000, sl_pips=20 requests 1.09800, sl_price=1.09500 requests 1.09500, and sl_pct=1 requests 1.08900. Vertical gaps use the same price scale. Pips convert as 20 × 0.00010 = 0.00200; percentage converts as 1.10000 × (1 ÷ 100) = 0.01100. The exact price uses the supplied level without conversion.

Calculated example; not an executed trade. These values illustrate units, not recommended stop distances.

Set the stop distance in PineConnector pips. Convert the message value to a price distance using the broker symbol’s pip size.

Direction Requested SL
Buy Entry − sl_pips × pip
Sell Entry + sl_pips × pip

Given: FX-5 EURUSD, illustrative entry 1.10000; 1 pip = 0.00010. Buy; 0.01 lot.

Stop by pip distance
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20

Result: Calculated; trade not executed Buy SL requested at 1.09800.

Why: 20 (message pips) × 0.00010 (fixture pip size) = 0.00200 distance; 1.10000 (fixture entry) − 0.00200 = 1.09800.

Requested levels only; the broker must accept price and volume increments and minimum distances.

Set the exact stop price. sl_price=1.09500 requests 1.09500; there is no pip or percentage calculation.

Check the correct side of entry, broker tick size and minimum stop distance. A price from TradingView can be invalid at the broker.

Given: FX-5 EURUSD, illustrative buy entry 1.10000; 0.01 lot.

Stop at an exact price
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_price=1.09500

Result: Illustrative; trade not executed Buy SL requested at 1.09500, exactly the supplied price.

Why: The supplied price passes through unchanged; its side, tick increment and broker distance determine validity.

No unit conversion. The stop must be below the buy reference, align to the broker tick size and satisfy the minimum stop distance.

Set the stop distance as a percentage of entry price. 1 means 1% of that price; it does not set 1% account risk.

Direction Requested SL
Buy Entry × (1 − sl_pct ÷ 100)
Sell Entry × (1 + sl_pct ÷ 100)

Given: FX-5 EURUSD, illustrative buy entry 1.10000; 0.01 lot.

Stop by price percentage
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pct=1

Result: Calculated; trade not executed Buy SL requested at 1.08900.

Why: 1.10000 (fixture entry) × (1 ÷ 100) (message percentage) = 0.01100 distance; 1.10000 − 0.01100 = 1.08900.

The base is entry price, not account balance. Requested level only; broker constraints apply.

Before using a stop method:

Opening and modifying differ. The formulas above cover entries. Existing-position modifications have a separate rule.

For manual breakeven, use its special command. sl_pips=0 is not a documented substitute; zero, negative and fractional explicit-stop handling are not established here.

Where should profit be taken? Choose one method if you include a target. A buy target is above entry; a sell target is below it.

Set the target distance in PineConnector pips, from the applicable entry.

Direction Requested TP
Buy Entry + tp_pips × pip
Sell Entry − tp_pips × pip

Given: FX-5 EURUSD, illustrative entry 1.10000; 1 pip = 0.00010. Buy; 0.01 lot.

Target by pip distance
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,tp_pips=40

Result: Calculated; trade not executed TP requested at 1.10400; SL at 1.09800.

Why: 40 (message target pips) × 0.00010 (fixture pip) = 0.00400; 1.10000 + 0.00400 = 1.10400.

Requested levels only; the broker must accept price and volume increments and minimum distances.

BUY exampleSee where the stop and target sit
  • SL · 20 pips
  • TP · 40 pips
  • Take profit1.10400+40 pips
  • Buy entry1.10000
  • Stop loss1.09800−20 pips

20 pips = 0.00200 below entry. 40 pips = 0.00400 above entry.

A sell reverses the stop and target directions.

Illustrative prices · 1 pip = 0.00010 here. Real quotes and broker execution are not simulated.

Calculated example; not an executed trade.

Set an exact target price, such as 1.10400. Check the correct side of entry and the broker’s distance rules.

Given: FX-5 EURUSD, illustrative buy entry 1.10000; 0.01 lot.

Target an exact price
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_price=1.09800,tp_price=1.10400

Result: Illustrative; trade not executed TP requested at 1.10400; SL at the supplied 1.09800.

Why: The supplied target price passes through unchanged; its side, tick increment and broker distance determine validity.

Exact prices pass through. The target must be above the buy reference and satisfy broker tick size and distance rules.

Set a percentage distance from entry. 2 means 2%.

Direction Calculation
Buy Entry × (1 + percentage ÷ 100)
Sell Entry × (1 − percentage ÷ 100)

Given: FX-5 EURUSD, illustrative buy entry 1.10000; 0.01 lot.

Target by price percentage
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pct=1,tp_pct=2

Result: Calculated; trade not executed TP requested at 1.12200; 1% SL at 1.08900.

Why: 1.10000 (fixture entry) × 2 ÷ 100 (message target percentage) = 0.02200; 1.10000 + 0.02200 = 1.12200.

Percentages use entry price; requested levels only, subject to broker constraints.

Pending targets use the pending entry reference. All target methods remain subject to broker constraints; modifying open positions is a separate operation.

Use buy or sell for a market entry. Include one volume method and any stop it requires.

Command Action Accepted aliases
buy Request a buy at market. long, bull, bullish
sell Request a sell at market. short, bear, bearish

Aliases are case-insensitive.

Complete example messages — choose one
ExampleAlert message
1Buy
Buy
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,tp_pips=40

Result: Calculated; trade not executed Requests 0.01 lot; buy SL 1.09800 and TP 1.10400, using FX-5 entry 1.10000.

2Sell
Sell
TradingView → Message PineConnector Syntax
LicenseID,sell,EURUSD,vol_lots=0.01,sl_pips=20,tp_pips=40

Result: Calculated; trade not executed Requests 0.01 lot; sell SL 1.10200 and TP 1.09600, using FX-5 entry 1.10000.

Choose the order type by its side of market. Every pending order needs one entry method, one volume method and any stop required for sizing.

Command Entry level Use when…
buystop Above market Buying after a rise.
buylimit Below market Buying after a pullback.
sellstop Below market Selling after a fall.
selllimit Above market Selling after a rebound.

buy and sell are market commands, not substitutes for pending commands.

Complete example messages — choose one
ExampleAlert message
1Buy stop
Buy stop
TradingView → Message PineConnector Syntax
LicenseID,buystop,EURUSD,vol_lots=0.01,entry_pips=20,sl_pips=20,tp_pips=40

Result: Calculated; trade not executed Requests 0.01 lot; entry 1.10200, SL 1.10000, TP 1.10600. Market reference 1.10000; FX-5 pip 0.00010.

2Buy limit
Buy limit
TradingView → Message PineConnector Syntax
LicenseID,buylimit,EURUSD,vol_lots=0.01,entry_pips=20,sl_pips=20,tp_pips=40

Result: Calculated; trade not executed Requests 0.01 lot; entry 1.09800, SL 1.09600, TP 1.10200. Market reference 1.10000; FX-5 pip 0.00010.

3Sell stop
Sell stop
TradingView → Message PineConnector Syntax
LicenseID,sellstop,EURUSD,vol_lots=0.01,entry_pips=20,sl_pips=20,tp_pips=40

Result: Calculated; trade not executed Requests 0.01 lot; entry 1.09800, SL 1.10000, TP 1.09400. Market reference 1.10000; FX-5 pip 0.00010.

4Sell limit
Sell limit
TradingView → Message PineConnector Syntax
LicenseID,selllimit,EURUSD,vol_lots=0.01,entry_pips=20,sl_pips=20,tp_pips=40

Result: Calculated; trade not executed Requests 0.01 lot; entry 1.10200, SL 1.10400, TP 1.09800. Market reference 1.10000; FX-5 pip 0.00010.

Set the pending entry a positive PineConnector pip distance from the current market reference. The command determines the direction: use the four pending formulas and reference rule.

Given: FX-5; market reference 1.10000; buy stop; 0.01 lot.

Set the entry distance
TradingView → Message PineConnector Syntax
LicenseID,buystop,EURUSD,vol_lots=0.01,entry_pips=20,sl_pips=20

Result: Calculated; trade not executed Pending entry requested at 1.10200; SL at 1.10000.

Why: 20 (message entry pips) × 0.00010 (fixture pip) = 0.00200; entry = 1.10000 + 0.00200. SL = 1.10200 − (20 × 0.00010) = 1.10000.

Single illustrative market reference; bid/ask spread omitted. Pending fill and stop execution can differ.

Set an absolute entry price. Choose the correct side of the market and meet the broker’s tick size and minimum distance; the supplied price passes through.

Given: FX-5; market reference 1.10000; buy limit; 0.01 lot.

Choose the entry price
TradingView → Message PineConnector Syntax
LicenseID,buylimit,EURUSD,vol_lots=0.01,entry_price=1.09500,sl_pips=20

Result: Calculated; trade not executed Pending entry requested at the supplied 1.09500; SL at 1.09300.

Why: Entry passes through; the companion stop is 1.09500 − (20 × 0.00010) = 1.09300.

Entry must be below the current market for this buy limit and meet broker tick size and minimum distance.

Set a percentage distance from the current market reference. 1 means 1%. Use a positive value and the command-specific formula.

Pending stop/target distances use the pending entry, not the market price when the message arrives. Explicit pending methods were introduced in the published 27 January 2026 update; check compatibility before using them on an older EA.

Given: FX-5; market reference 1.10000; buy stop; 0.01 lot.

Choose a percentage entry distance
TradingView → Message PineConnector Syntax
LicenseID,buystop,EURUSD,vol_lots=0.01,entry_pct=1,sl_pct=0.5

Result: Calculated; trade not executed Pending entry requested at 1.11100; raw SL 1.105445 before broker price precision or tick-size handling.

Why: 1.10000 × 1 ÷ 100 = 0.01100; entry = 1.11100. Stop distance = 1.11100 × 0.5 ÷ 100 = 0.005555; SL = 1.11100 − 0.005555 = 1.105445.

Entry percentage uses market reference; stop percentage uses pending entry. The exact broker-accepted SL is not determined without price handling rules.

Measure the stop from the pending entry

Choose an order type, then change its stop distance. The stop is measured from the requested entry level.

EURUSD

Price levels · entry_pips=20

Market reference
1.10000
Illustrative quote
Buy limit entry
1.09800
20 pips below market
Requested stop
1.09300
50 pips below the pending entry

1.09800 − 0.00500 = 1.09300.

Five-decimal EURUSD example; entry_pips=20 and 1 pip = 0.00010. These are requested levels. Actual fills, costs and stop execution can change the outcome.

Calculated example; not an executed trade.

Read the example

Given: FX-5 market reference 1.10000; buy limit 20 pips below market; deliberately varied 50-pip stop.

Alert: LicenseID,buylimit,EURUSD,vol_lots=0.01,entry_pips=20,sl_pips=50

Result and why: With market reference 1.10000, buylimit and entry_pips=20 request entry at 1.09800. Adding sl_pips=50 requests the stop at 1.09300: 50 pips below that pending entry.

Measuring 50 pips from the current market would instead give 1.09500, only 30 pips below the requested buy-limit entry. For a sell, the stop is above the requested entry.

Start with what should change. Close open positions, cancel pending orders, or modify their stops and targets.

Check the receiving accounts and eligible trades before choosing a command.

Command Request
closelong Close buys for the symbol.
closeshort Close sells for the symbol.
closelongshort Close both directions for the symbol.
closeall Close positions and cancel pending orders across the receiving EA’s scope. Use its chart symbol as the third field.

For strategy-specific closing, read the comment= matching rules. Omitting a comment can broaden the request.

Choose the intended scope. Replace ChartSymbol with the receiving EA’s chart before using closeall.

Complete example messages — choose one
ExampleAlert message
1Close buys
Close buys
TradingView → Message PineConnector Syntax
LicenseID,closelong,EURUSD

Result: Illustrative; trade not executed Requests closure of matching EURUSD buys; sells are outside this direction selection.

2Close sells
Close sells
TradingView → Message PineConnector Syntax
LicenseID,closeshort,EURUSD

Result: Illustrative; trade not executed Requests closure of matching EURUSD sells; buys are outside this direction selection.

3Close both
Close both
TradingView → Message PineConnector Syntax
LicenseID,closelongshort,EURUSD

Result: Illustrative; trade not executed Requests closure of both EURUSD directions within scope.

4Close all
Close all
TradingView → Message PineConnector Syntax
LicenseID,closeall,ChartSymbol

Result: Illustrative; trade not executed Replace ChartSymbol with the chart symbol of the receiving EA. This is not limited to positions on that one symbol. Requests closure of positions and cancellation of pending orders across the receiving EA scope.

Commands Size to close
closelongpct, closeshortpct The Partial Close Percentage selected in the EA.
closelongvol, closeshortvol The lot volume supplied through risk=, required here. It is a close-volume amount, not entry-risk interpretation.

Volume-close requests process available positions in order until the requested amount is reached.

  • Above the available amount: close all available volume; a position does not become negative.
  • Check actual tickets, broker increments and remaining volume. Do not assume proportional reductions.

Adding sl=0 can request breakeven for the remaining positions after the partial close. The profit and broker-distance conditions below still apply.

Given: 0.04 lot of eligible EURUSD buys; EA Partial Close Percentage = 25%.

  • closelongpct: 0.04 × 25 ÷ 100 = 0.01 lot to close, leaving 0.03 lot if accepted.
  • closelongvol with risk=0.01: names that close amount directly. Here risk= means lots to close, not entry risk.

Sell commands apply the same quantity rule to eligible sells.

Calculated example; not an executed trade. This separate position-volume fixture assumes the broker permits 0.01-lot increments. It does not establish per-ticket allocation or rounding when the calculated amount falls between increments.

These examples close buys or sells on EURUSD within the EA’s scope. Broker volume increments still apply.

Complete example messages — choose one
ExampleAlert message
1Partial buy close
Partial buy close
TradingView → Message PineConnector Syntax
LicenseID,closelongpct,EURUSD

Result: Illustrative; trade not executed Requests the EA-selected Partial Close Percentage of matching buy volume; the number of lots needs that setting.

2Partial sell close
Partial sell close
TradingView → Message PineConnector Syntax
LicenseID,closeshortpct,EURUSD

Result: Illustrative; trade not executed Requests the EA-selected Partial Close Percentage of matching sell volume; the number of lots needs that setting.

3Partial close and breakeven
Partial close and breakeven
TradingView → Message PineConnector Syntax
LicenseID,closelongpct,EURUSD,sl=0

Result: Illustrative; trade not executed Requests the EA-selected Partial Close Percentage of matching buy volume; the number of lots needs that setting. Also requests conditional breakeven on the remainder.

4Close buy volume
Close buy volume
TradingView → Message PineConnector Syntax
LicenseID,closelongvol,EURUSD,risk=0.01

Result: Illustrative; trade not executed Requests closure of 0.01 lot of matching buy volume, subject to available volume and broker increments.

5Close sell volume
Close sell volume
TradingView → Message PineConnector Syntax
LicenseID,closeshortvol,EURUSD,risk=0.01

Result: Illustrative; trade not executed Requests closure of 0.01 lot of matching sell volume, subject to available volume and broker increments.

Command Request
cancellong Cancel the symbol’s buy stops and buy limits.
cancelshort Cancel the symbol’s sell stops and sell limits.

These cancel pending orders. Use a closing command after a position has opened.

Complete example messages — choose one
ExampleAlert message
1Cancel buy orders
Cancel buy orders
TradingView → Message PineConnector Syntax
LicenseID,cancellong,EURUSD

Result: Illustrative; trade not executed Requests cancellation of matching buy stops and buy limits; open positions remain outside this operation.

2Cancel sell orders
Cancel sell orders
TradingView → Message PineConnector Syntax
LicenseID,cancelshort,EURUSD

Result: Illustrative; trade not executed Requests cancellation of matching sell stops and sell limits; open positions remain outside this operation.

newsltplong changes buy-position SL/TP; newsltpshort changes sell-position SL/TP. Include at least one stop or target and choose one method for each.

Exact prices: the examples below name the requested level directly.

Pip/percentage methods: their reference price for open-position modifications is not established here. Confirm the installed EA’s rule first; do not borrow the opening-entry formula.

Illustrative levels assume EURUSD near 1.10000. Adjust them to the actual entry, current broker quote and permitted stop distance.

Complete example messages — choose one
ExampleAlert message
1Buy stop and target
Buy stop and target
TradingView → Message PineConnector Syntax
LicenseID,newsltplong,EURUSD,sl_price=1.09800,tp_price=1.10400

Result: Illustrative; trade not executed Requests the supplied SL/TP on matching buy positions. It does not change their entry or lot volume; broker constraints apply.

2Sell stop and target
Sell stop and target
TradingView → Message PineConnector Syntax
LicenseID,newsltpshort,EURUSD,sl_price=1.10200,tp_price=1.09600

Result: Illustrative; trade not executed Requests the supplied SL/TP on matching sell positions. It does not change their entry or lot volume; broker constraints apply.

Use the special value sl=0, not sl_pips=0. The position must be in profit and far enough from entry for the broker to permit the new stop. A rejected modification can leave the old stop unchanged; inspect the result before retrying.

Given: a matching profitable position entered at 1.10000, with enough current broker distance for an entry-price stop.

Result: request SL 1.10000 for a buy or sell; entry and volume stay unchanged. Illustrative request; not an executed trade.

Why: sl=0 names entry price, not a pip distance. Inspect the retained TP and actual stop after the request.

A position outside the profit/distance conditions is not a successful breakeven example.

Complete example messages — choose one
ExampleAlert message
1Buy breakeven
Buy breakeven
TradingView → Message PineConnector Syntax
LicenseID,newsltplong,EURUSD,sl=0

Result: Illustrative; trade not executed Requests SL at entry on matching buy positions; profit and broker-distance conditions apply. A rejected change can leave the old SL.

2Sell breakeven
Sell breakeven
TradingView → Message PineConnector Syntax
LicenseID,newsltpshort,EURUSD,sl=0

Result: Illustrative; trade not executed Requests SL at entry on matching sell positions; profit and broker-distance conditions apply. A rejected change can leave the old SL.

Command Orders whose SL/TP is changed
newsltpbuystop Buy stops
newsltpbuylimit Buy limits
newsltpsellstop Sell stops
newsltpselllimit Sell limits

Include at least one stop or target. Explicit pip/percentage distances use the pending entry price. These commands change targets; they do not replace the pending entry itself.

Complete example messages — choose one
ExampleAlert message
1Buy-stop targets
Buy-stop targets
TradingView → Message PineConnector Syntax
LicenseID,newsltpbuystop,EURUSD,sl_pips=20,tp_pips=40

Result: Illustrative; trade not executed Requests a 20-pip SL and 40-pip TP from the existing pending entry, leaving that entry and volume unchanged. Check matching orders within scope.

2Buy-limit targets
Buy-limit targets
TradingView → Message PineConnector Syntax
LicenseID,newsltpbuylimit,EURUSD,sl_pips=20,tp_pips=40

Result: Illustrative; trade not executed Requests a 20-pip SL and 40-pip TP from the existing pending entry, leaving that entry and volume unchanged. Check matching orders within scope.

3Sell-stop targets
Sell-stop targets
TradingView → Message PineConnector Syntax
LicenseID,newsltpsellstop,EURUSD,sl_pips=20,tp_pips=40

Result: Illustrative; trade not executed Requests a 20-pip SL and 40-pip TP from the existing pending entry, leaving that entry and volume unchanged. Check matching orders within scope.

4Sell-limit targets
Sell-limit targets
TradingView → Message PineConnector Syntax
LicenseID,newsltpselllimit,EURUSD,sl_pips=20,tp_pips=40

Result: Illustrative; trade not executed Requests a 20-pip SL and 40-pip TP from the existing pending entry, leaving that entry and volume unchanged. Check matching orders within scope.

Command Alias Close → new market entry
closelongopenlong CL+OL Buys → buy
closelongopenshort CL+OS Buys → sell
closeshortopenlong CS+OL Sells → buy
closeshortopenshort CS+OS Sells → sell
closelongshortopenlong CLS+OL Both → buy
closelongshortopenshort CLS+OS Both → sell

Provide volume for the new entry and a stop if that volume method requires one. Check both results; a combined message is not a guarantee that both actions complete.

Complete example messages — choose one
ExampleAlert message
1Replace buys with a buy
Replace buys with a buy
TradingView → Message PineConnector Syntax
LicenseID,closelongopenlong,EURUSD,vol_lots=0.01,sl_pips=20

Result: Illustrative; trade not executed Requests the listed close followed by a new 0.01-lot buy with a 20-pip SL. Check each result separately; completion of both is not guaranteed.

2Replace buys with a sell
Replace buys with a sell
TradingView → Message PineConnector Syntax
LicenseID,closelongopenshort,EURUSD,vol_lots=0.01,sl_pips=20

Result: Illustrative; trade not executed Requests the listed close followed by a new 0.01-lot sell with a 20-pip SL. Check each result separately; completion of both is not guaranteed.

3Replace sells with a buy
Replace sells with a buy
TradingView → Message PineConnector Syntax
LicenseID,closeshortopenlong,EURUSD,vol_lots=0.01,sl_pips=20

Result: Illustrative; trade not executed Requests the listed close followed by a new 0.01-lot buy with a 20-pip SL. Check each result separately; completion of both is not guaranteed.

4Replace sells with a sell
Replace sells with a sell
TradingView → Message PineConnector Syntax
LicenseID,closeshortopenshort,EURUSD,vol_lots=0.01,sl_pips=20

Result: Illustrative; trade not executed Requests the listed close followed by a new 0.01-lot sell with a 20-pip SL. Check each result separately; completion of both is not guaranteed.

5Replace both with a buy
Replace both with a buy
TradingView → Message PineConnector Syntax
LicenseID,closelongshortopenlong,EURUSD,vol_lots=0.01,sl_pips=20

Result: Illustrative; trade not executed Requests the listed close followed by a new 0.01-lot buy with a 20-pip SL. Check each result separately; completion of both is not guaranteed.

6Replace both with a sell
Replace both with a sell
TradingView → Message PineConnector Syntax
LicenseID,closelongshortopenshort,EURUSD,vol_lots=0.01,sl_pips=20

Result: Illustrative; trade not executed Requests the listed close followed by a new 0.01-lot sell with a 20-pip SL. Check each result separately; completion of both is not guaranteed.

Command Cancel → new pending order
cancellongbuystop Buy pending orders → buy stop
cancellongbuylimit Buy pending orders → buy limit
cancelshortsellstop Sell pending orders → sell stop
cancelshortselllimit Sell pending orders → sell limit

The replacement needs entry and volume, plus any required stop. Review the existing orders and the new order separately before retrying.

Complete example messages — choose one
ExampleAlert message
1New buy stop
New buy stop
TradingView → Message PineConnector Syntax
LicenseID,cancellongbuystop,EURUSD,vol_lots=0.01,entry_pips=20,sl_pips=20

Result: Illustrative; trade not executed Requests the listed cancellation followed by a new 0.01-lot buystop 20 pips from market, with SL 20 pips from its entry. Check cancellation and replacement separately.

2New buy limit
New buy limit
TradingView → Message PineConnector Syntax
LicenseID,cancellongbuylimit,EURUSD,vol_lots=0.01,entry_pips=20,sl_pips=20

Result: Illustrative; trade not executed Requests the listed cancellation followed by a new 0.01-lot buylimit 20 pips from market, with SL 20 pips from its entry. Check cancellation and replacement separately.

3New sell stop
New sell stop
TradingView → Message PineConnector Syntax
LicenseID,cancelshortsellstop,EURUSD,vol_lots=0.01,entry_pips=20,sl_pips=20

Result: Illustrative; trade not executed Requests the listed cancellation followed by a new 0.01-lot sellstop 20 pips from market, with SL 20 pips from its entry. Check cancellation and replacement separately.

4New sell limit
New sell limit
TradingView → Message PineConnector Syntax
LicenseID,cancelshortselllimit,EURUSD,vol_lots=0.01,entry_pips=20,sl_pips=20

Result: Illustrative; trade not executed Requests the listed cancellation followed by a new 0.01-lot selllimit 20 pips from market, with SL 20 pips from its entry. Check cancellation and replacement separately.

These parameters configure later stop changes when opening an entry. They do not replace its volume or any initial stop required for loss-based sizing.

Use the shared pip size for these offsets.

Direction Trigger price Requested SL after trigger
Buy Entry + betrigger × pip Entry + beoffset × pip
Sell Entry − betrigger × pip Entry − beoffset × pip
Buy path from 1.10000, trigger 10, offset 2 Requested SL
+8 pips: below trigger Retain initial 1.09800
+10 pips: trigger reached 1.10000 + 2 × 0.00010 = 1.10020
+14 pips: further rise Keep fixed entry-relative 1.10020

Calculated example; not an executed trade. The sequence assumes accepted changes and omits costs; it does not simulate combined stop-management features.

The favourable movement in pips before automatic breakeven activates. Must be above zero; include beoffset= too.

Given: FX-5 EURUSD, illustrative entry 1.10000; 1 pip = 0.00010. Buy; initial SL 1.09800.

Activate automatic breakeven
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,betrigger=10,beoffset=2

Result: Calculated; trade not executed At a 10-pip favourable move, request SL 1.10020.

Why: Trigger price = 1.10000 + (10 × 0.00010) = 1.10100; SL = 1.10000 + (2 × 0.00010) = 1.10020.

Assumes the broker accepts the change. A trigger observation is not a fill; spread and costs are omitted.

Where to place the stop relative to entry after the trigger. Keep it smaller than betrigger=. 0 requests entry price; 2 protects two pips above a buy entry or below a sell entry.

A breakeven price is not a guarantee of zero net loss after costs or execution differences. Broker rules can reject the modification.

Given: FX-5 EURUSD, illustrative entry 1.10000; 1 pip = 0.00010. Buy; trigger 10 pips.

Choose the breakeven offset
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,betrigger=10,beoffset=2

Result: Illustrative; trade not executed After the trigger, request SL at entry +2 pips: 1.10020; the offset stays entry-relative.

See the shared breakeven sequence and formula. Offset must be below trigger; broker acceptance is separate.

Breakeven moves to a fixed entry offset

Choose the gain that activates breakeven and the level to request. Further gains do not increase that fixed breakeven level.

Pips from entry

Example price path

Activation gain
+10 pips
betrigger=
Stop from entry
+2 pips
beoffset=
Offset check
Below trigger
2 < 10

At a +10-pip gain, request the stop at entry +2 pips. The breakeven level stays fixed as this price path continues.

Buy example with an initial 20-pip stop. The drawing assumes requested changes are accepted and omits spread and costs. It does not model stop execution or combined stop-management features.

Calculated example; not an executed trade.

Read the example

Given: FX-5 buy at 1.10000; one pip 0.00010; initial SL 1.09800.

Alert: LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,betrigger=10,beoffset=2

Result and why: With betrigger=10 and beoffset=2, a 10-pip favourable move requests the stop 2 pips above the buy entry. At entry 1.10000, that is 1.10020. The breakeven target stays at that entry-relative level.

The trigger must be above zero and the offset must be below the trigger. beoffset=0 requests the entry price; this is not a guarantee of zero net loss after costs or execution differences.

The optional comparison uses the same trigger with traildist=8 and trailstep=3. Unlike the fixed breakeven level, its illustrated stop advances after further favourable steps.

For positive whole-number inputs, using the shared pip size:

Direction Illustrated stop
Buy Current price − traildist × pip
Sell Current price + traildist × pip

After the trigger, each further favourable trailstep permits another tightening. The illustrated stop does not loosen on a pullback; see the complete sequence below.

Set the movement before pip trailing activates. Include both traildist= and trailstep=.

  • Positive: the worked sequence below uses this path.
  • Negative: can request immediate activation.
  • Zero: can depend on spread coverage.

Confirm zero/negative boundaries on your EA before relying on them.

Given: FX-5 EURUSD, illustrative entry 1.10000; 1 pip = 0.00010. Buy; initial SL 1.09800; distance 8, step 3.

Start trailing after a gain
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,trailtrig=12,traildist=8,trailstep=3

Result: Calculated; trade not executed At +12 pips, the first illustrated trailing request is SL 1.10040.

Why: 12 (trigger) − 8 (distance) = +4 pips from entry; 1.10000 + (4 × 0.00010) = 1.10040.

Positive whole-number walkthrough; requested changes assumed accepted. Update cadence and quote-side sampling are not simulated.

Distance from current price to the trailing stop. Without an initial stop, the reference describes adding one when trailing activates. Loss-based volume still requires its initial explicit stop.

Given: FX-5 EURUSD, illustrative entry 1.10000; 1 pip = 0.00010. Buy; trigger 12, distance 8, step 3.

Choose the trailing distance
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,trailtrig=12,traildist=8,trailstep=3

Result: Illustrative; trade not executed At price 1.10120, the illustrated stop is 1.10040, 8 pips behind price.

See the complete shared trailing sequence; the example assumes accepted stop changes.

Further favourable movement needed for each adjustment. With trigger 12, distance 8 and step 3, a buy’s stop is first requested 4 pips above entry, then 7 pips above entry after the next three-pip move.

Units: pips, regardless of the EA’s Target Type. This walkthrough uses whole numbers.

Fractional inputs: rounded, but direction and tie handling are not established here. No fractional result is predicted.

Given: FX-5 EURUSD, illustrative entry 1.10000; 1 pip = 0.00010. Buy; trigger 12, distance 8, step 3.

Choose the update step
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,trailtrig=12,traildist=8,trailstep=3

Result: Calculated; trade not executed At +14 pips, retain 1.10040. At +15 pips, request 1.10070; a pullback to +13 retains it.

Why: Next adjustment = 12 + 3 = 15 pips; stop = 15 − 8 = +7 pips, or 1.10070.

Illustrated no-op states are part of the sequence; they do not establish actual broker sampling or fills.

BUY example · step throughWatch a trailing stop move
  • Trigger · 12 pips
  • Distance · 8 pips
  • Step · 3 pips
Pips from entryExample price sequence →
Buy entry
1.100000 pips
Price
1.100000 pips
Stop request
1.09800−20 pips
1 / 6Start at entry

This example starts with sl_pips=20. The initial stop stays in place until trailing activates.

Initial stop: 1.10000 − 0.00200 = 1.09800.

Read the six-step example
  1. Start at entry

    Price: 0 pips (1.10000). Stop request: −20 pips (1.09800). This example starts with sl_pips=20. The initial stop stays in place until trailing activates. Initial stop: 1.10000 − 0.00200 = 1.09800.

  2. Price rises, but not far enough

    Price: +8 pips (1.10080). Stop request: −20 pips (1.09800). The move is still below the trigger. The initial stop is unchanged. +8 is below the +12-pip trigger.

  3. Trigger reached

    Price: +12 pips (1.10120). Stop request: +4 pips (1.10040). Request the first trailing adjustment: move the stop to 8 pips behind this price. 12 − 8 = +4 pips above entry.

  4. Wait for the next step

    Price: +14 pips (1.10140). Stop request: +4 pips (1.10040). Price has moved another 2 pips. The 3-pip step has not been reached, so the stop stays put. 14 − 12 = 2 pips; the next step is at +15.

  5. Move the stop up

    Price: +15 pips (1.10150). Stop request: +7 pips (1.10070). Price has gained another 3 pips since the last adjustment. Request a higher stop. 15 − 8 = +7 pips above entry.

  6. Price pulls back; the stop stays

    Price: +13 pips (1.10130). Stop request: +7 pips (1.10070). The stop stays at +7. A pullback does not move it down to maintain the original distance. Stop remains +7 pips; it does not loosen to +5.

The stop moves towards profit, never away on a pullback. This example starts with a 20-pip SL and assumes the requested changes are accepted; spread and costs are omitted.

Illustrative prices · 1 pip = 0.00010 here. Real quotes and broker execution are not simulated.

Calculated example; not an executed trade.

Choose the ATR timeframe in minutes. Include atrperiod= too.

  • Data: the broker’s MetaTrader series; it may differ from TradingView.
  • Updates: each bar close of the selected timeframe.

The MT4 timeframe choices listed here are 1, 5, 15, 30, 60, 240 and 1440 minutes. Look up the broker data and EA configuration. Confirm other MT5 choices on your installed EA rather than assuming every numeric value works.

Given: Broker MetaTrader data; hourly bars; 14 periods.

Use hourly ATR data
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,atrtimeframe=60,atrperiod=14

Result: Calculated; trade not executed Requests ATR trailing using 14 periods on the 60-minute timeframe; calculations update at its bar closes.

Why: 60 minutes = one hour per bar; 14 periods selects 14 hourly bars, not 14 minutes.

The actual ATR value and stop require broker data and the specified bar selection; no live ATR is supplied here.

The number of periods used for Average True Range, such as 14. Along with atrtimeframe=, this is required for ATR trailing.

Given: Broker MetaTrader data; 60-minute bars; intentional lookback variation.

Choose the ATR lookback
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,atrtimeframe=60,atrperiod=20

Result: Illustrative; trade not executed Requests a 20-period hourly ATR lookback; the actual ATR value is not supplied.

Changing the lookback does not by itself determine the ATR distance. Use broker data for the same symbol and timeframe.

ATR: convert the distance before placing the stop

Section titled “ATR: convert the distance before placing the stop”

Given ATR in price units:

Direction Illustrated candidate stop
Buy Current price − ATR × multiplier
Sell Current price + ATR × multiplier

The model retains an already tighter stop. If ATR is in pips, convert it with the PineConnector pip size.

Actual ATR needs the broker series and bar selection. The samples below are not an indicator calculation.

Multiplier applied to the ATR distance. Default: 1. A value of 2 uses twice the calculated ATR.

Given: Illustrative hourly bar: price +18 pips; supplied ATR 7 pips; buy; initial SL −20; trigger 8 reached.

Scale the ATR distance
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,atrtimeframe=60,atrperiod=14,atrmultiplier=2

Result: Calculated; trade not executed Calculated candidate SL +4 pips from entry, or 1.10040, if it tightens the existing stop.

Why: 7 (supplied ATR pips) × 2 (message multiplier) = 14 pips; +18 − 14 = +4 pips.

ATR is supplied sample data, not an indicator computed by the widget. Broker acceptance and exact ATR bar conventions remain separate.

The bar offset used for ATR calculation. Default: 0. Confirm the exact closed-bar convention on your version when matching another indicator’s output.

Given: Broker ATR; 60-minute timeframe; 14 periods.

Select the ATR bar offset
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,atrtimeframe=60,atrperiod=14,atrshift=1

Result: Illustrative; trade not executed Requests ATR bar offset 1. This page does not establish the exact closed-bar mapping for your EA build.

An exact ATR value cannot be derived without the build-specific bar selection and broker series.

Set the favourable pip movement before ATR trailing begins. Default: 0, described as immediate activation subject to initial-stop placement.

Without an initial stop, the ATR reference describes adding one from its calculation. Loss-based sizing still requires an explicit initial stop.

Check the initial stop, activation and later adjustments. Test the interaction before combining stop-management features.

Given: FX-5 EURUSD, illustrative entry 1.10000; 1 pip = 0.00010. Buy; initial SL 1.09800; ATR timeframe 60, period 14.

Delay ATR activation
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,atrtimeframe=60,atrperiod=14,atrtrigger=8

Result: Calculated; trade not executed Requests ATR activation after an 8-pip favourable move, at illustrative price 1.10080. The next stop needs the ATR value.

Why: 1.10000 + (8 × 0.00010) = 1.10080.

Activation and later bar-close adjustments are separate. No stop level is inferred without ATR data.

ATR changes the distance at each bar close

Step through the bars and adjust the multiplier. Higher ATR can widen the calculated distance while an existing stop stays in place.

Pips from entry

Example hourly bar closes · shaded bars have higher sample ATR

Sample ATR
22 pips
At bar 6
ATR × multiplier
44 pips
22 × 2.0
Stop from entry
+8 pips
Previous level retained

At bar 6, +43 − 44 = −1 pips would loosen the stop. Keep the previous +8-pip level.

Illustrative ATR samples, not a calculated indicator or live candles. Buy example: initial SL −20 pips, atrtrigger=8. Each multiplier redraws a separate scenario. Real ATR uses broker MetaTrader data and may differ from TradingView.

Calculated example; not an executed trade.

Read the example

Given: FX-5 buy at 1.10000; hourly bar closes, supplied ATR samples in pips; initial stop 20 pips.

Alert: LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,atrtimeframe=60,atrperiod=14,atrmultiplier=2,atrtrigger=8

Result and why: This example uses hourly bar closes and illustrative ATR samples. At bar 3, price is 18 pips above entry and ATR is 7 pips. With atrmultiplier=2, the distance is 14 pips and the illustrated stop request is +4 pips.

At bar 5, price is +37 and ATR is 17: the 34-pip distance would give +3. The illustrated stop has already reached +8 at bar 4, so it stays at +8 instead of loosening.

ATR updates occur at bar closes of atrtimeframe=. atrperiod= determines the averaging lookback; atrmultiplier= scales the distance, atrshift= selects the ATR bar and atrtrigger= controls activation. This drawing uses supplied sample ATR values and does not simulate all of those inputs.

Set the maximum entry spread in PineConnector pips. 2 means two pips; decimal values are supported.

Spread = (Ask − Bid) ÷ pip size at arrival. Less than or equal to the limit passes this filter only.

Given: FX-5; bid 1.10000 and ask 1.10020 at arrival.

Limit the entry spread
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,spread=2

Result: Calculated; trade not executed Spread is 2 pips, so it passes spread=2 only. Other filters and broker checks remain.

Why: (1.10020 − 1.10000) ÷ 0.00010 (fixture pip) = 2 pips; 2 ≤ 2.

Use the broker quote at arrival. Passing this filter is not a confirmed order or a later retry.

Check the spread when each alert arrives

Adjust the maximum spread. Inspect a marker to see which of these ten example alerts passes this one filter.

Spread · pips

Each marker is one incoming alert

Example alerts
10
One check at each arrival
Pass this filter
8
Other checks still apply
Filtered out
2
Above this spread limit

Alert 4: 3.8 > 2.0 pips — filtered out at that arrival.

Each marker uses the spread at that alert’s arrival. Passing this filter does not confirm an order: other EA checks and broker rules still apply.

Calculated example; not an executed trade.

Read the example

Given: Ten supplied arrival observations in PineConnector pips; spread limit 2; FX-5 entry example.

Alert: LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,spread=2

Result and why: With spread=2, a spread of 1.2 pips passes and a spread of exactly 2 pips also passes. A spread of 3.8 pips fails this filter.

Eight of these ten illustrative alerts pass the 2-pip limit. A later narrowing is a different observation; it does not change the spread recorded for an earlier alert. Review the signal’s processing result before deciding what to do next.

A threshold using the EA’s Account Filter Type: balance, equity, free margin or margin percentage. 500 is not enough information on its own to identify the metric.

Look up the actual metric and setting. This page does not establish the comparison for every Account Filter Type, including whether equality passes. Do not infer pass/fail from 500 alone.

Given: Threshold 500; Account Filter Type and its comparison not supplied.

Apply an account threshold
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,accfilter=500

Result: Illustrative; trade not executed Passes threshold 500 to the selected account metric. Pass/fail cannot be determined from this message alone.

Why: The EA setting chooses the metric. Its comparison rule and current value are additional inputs; the message alone cannot supply a pass/fail result.

Read the receiving EA setting, current metric and setting-specific comparison; equality is unresolved here.

Use a short strategy identifier:

  • Up to 20 characters.
  • Spaces are shown in the reference.
  • Avoid commas: they separate message fields.

Short plain identifiers avoid disputed special-character and overlength behaviour in older guides.

For strategy separation, check scope and use the exact matching comment and supported commands in Multi-Strategy.

Given: Strategy identifier, 10 characters including the space.

Label a strategy
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,comment=Strategy A

Result: Illustrative; trade not executed Requests the position label Strategy A. A supported comment-filtered exit uses that exact label.

Why: The string supplies the label; exact matching and supported command scope determine any strategy-specific selection.

Up to 20 characters; no comma. Scope and command support still matter; a label is not isolation from all other commands.

Add your case-sensitive Signal Authentication key when authentication is enabled. A missing or different value prevents forwarding to the terminal.

A saved License ID does not add or verify the key. Configure authentication.

Never use a broker password or share the real secret in a copied page or support screenshot.

Given: Authentication enabled for the intended License ID.

Include authentication
TradingView → Message PineConnector Syntax
LicenseID,buy,EURUSD,vol_lots=0.01,sl_pips=20,secret=YOUR_SECRET_KEY

Result: Illustrative; trade not executed Forwards only when the supplied key matches the saved case-sensitive key; this placeholder is not a working secret.

Why: Authentication compares the supplied value with the saved key, including its letter case; the placeholder supplies no real credential.

Replace YOUR_SECRET_KEY privately. Never paste a real key into documentation, exported examples or support screenshots.

Command Required third field Request
eaoff eaoff Halt processing of incoming signals.
eaon eaon Resume a halted EA.
closealleaoff Receiving EA’s chart symbol Close positions/cancel pending orders within scope, then halt.

closeall uses that chart-symbol requirement too. Identify the receiving EA’s actual chart; do not guess a symbol for an account-wide action.

Complete example messages — choose one
ExampleAlert message
1Halt EA
Halt EA
TradingView → Message PineConnector Syntax
LicenseID,eaoff,eaoff

Result: Illustrative; trade not executed Requests a halt to incoming signal processing; this command does not request position closure.

2Resume EA
Resume EA
TradingView → Message PineConnector Syntax
LicenseID,eaon,eaon

Result: Illustrative; trade not executed Requests resumption of a halted EA; this command does not request a new entry.

3Close and halt
Close and halt
TradingView → Message PineConnector Syntax
LicenseID,closealleaoff,ChartSymbol

Result: Illustrative; trade not executed Replace ChartSymbol with the receiving EA chart symbol. Requests closure/cancellation within scope, then a halt; inspect each result.

See the shared scope and chart-symbol rule before using an EA-wide command.

Receipt is the first check. Broker outcome is a separate check. On demo, verify the intended account, symbol, direction, volume, entry, stop and target.

Check both halves of a cancel-and-replace request

Section titled “Check both halves of a cancel-and-replace request”
  1. Find the delivery record. It establishes receipt, not whether cancellation or replacement succeeded.
  2. Inspect old pending orders. Record what remains. Checking only the new order leaves cancellation unverified.
  3. Inspect the new order. Compare requested entry, volume and targets with the broker result.

Why: one message can request two actions; one observed result does not prove both completed.

Illustrative request; not an executed trade. No actual outcome or automatic retry is assumed.

For any close or modification, check what changed and what remained. Inspect existing orders before retrying.

Follow the complete test workflow · Build or check a message · Troubleshoot an error.

Maintaining an older alert? The archived parameter reference preserves its setting-dependent interpretation.