ChartBridgeDocs
Dashboard
ChartBridgeDocs
Getting Started
Install EA
Connect EA
Multiple Strategies
Configuration
Syntax
EA Settings
Cheat Sheet
Symbol Mapping
Symbol Bridge
Features
Connect Telegram
Configure Email Features
Monitor And Notification
Analytics
Notification
Help & Support
FAQ

Syntax

PreviousMultiple StrategiesNext EA Settings

On this page

  • Message schematic
  • Try the syntax generator
  • Webhook URL
  • How the EA reads your values
  • Volume
  • Stop loss and take profit
  • What is a pip?
  • Open orders
  • Market commands
  • Pending commands
  • Close, cancel and modify
  • Close positions
  • Partial closes
  • Cancel pending orders
  • Modify open positions
  • Modify pending orders
  • Close and re-enter
  • Comment
  • EA controls
  • Cheatsheet

Message schematic

Structure only. The complete examples below supply a command and its values.

eaToken=YOUR_EA_TOKEN;command=Command;symbol=Symbol;volume=…;stopLoss=…;takeProfit=…;price=…;comment=…

FieldMeaning
eaTokenYour EA Token from the ChartBridge Portal. Required. Every EA running with this token receives the message.
commandOne command from the tables below, such as buy, sell or closelong. Lowercase and matched exactly.
symbolThe symbol to trade. Symbol Mapping in the Portal and the EA's prefix/suffix settings are applied before the EA looks it up. EA controls ignore it.
volumeSize of the entry. Its unit is set by the EA's Volume Type.
stopLossStop loss. Its unit is set by the EA's Target Type. Omitted or 0 means no stop loss.
takeProfitTake profit. Its unit is set by the EA's Target Type. Omitted or 0 means no take profit.
priceEntry for pending orders. Its unit is set by the EA's Pending Order Price Basis.
commentOptional text saved as the trade's comment.

Write each field as name=value and separate fields with a semicolon. Field order does not matter and spaces around values are trimmed. Field names are case-sensitive: write stopLoss, not stoploss. A value cannot contain a semicolon. Use one EA Token, command and symbol per message.

The message carries numbers only. The units come from the receiving EA's inputs, so the same message can mean different things on two EAs with different settings. Check the EA's Main Configuration before you send.

Try the syntax generator

Syntax generator

Pick a command, fill in the fields it needs, and copy the message into your TradingView alert.

1. Choose a command
2. Fill in the fields
EA Tokenfrom the Strategies page
Symbolyour broker's exact name
Volume
Stop loss (pips)
Take profit (pips)
Comment
Your EA's units (Main Configuration)
Volume Type
Target Type
3. Paste into TradingView → MessageValid
eaToken=YOUR_EA_TOKEN;command=buy;symbol=EURUSD;volume=0.01;stopLoss=20;takeProfit=40
eaTokenYOUR_EA_TOKENcommandbuysymbolEURUSDvolume0.01stopLoss20takeProfit40
Webhook URLhttps://tf.staging.chartbridge.com/webhook

Webhook URL

https://tf.staging.chartbridge.com/webhook

Paste separately into TradingView's Webhook URL field.

Illustrative requests, not executed trades. Paste one complete example into TradingView → Message. Replace YOUR_EA_TOKEN and the symbol, adapt the values and test on demo. Check receipt and the actual account/order outcome separately.

Buy a fixed size

eaToken=YOUR_EA_TOKEN;command=buy;symbol=EURUSD;volume=0.01;stopLoss=20;takeProfit=40

With Volume Type = Lots and Target Type = Pips, requests a 0.01-lot buy with a 20-pip stop and 40-pip target.

Close EURUSD buys

eaToken=YOUR_EA_TOKEN;command=closelong;symbol=EURUSD

Requests closure of EURUSD buys on every receiving EA. Power Mode determines eligible positions: Off limits it to the EA's own Magic Number; On includes manual trades and other EAs.

How the EA reads your values

EA input (Main Configuration)Applies toOptions
Volume TypevolumeLots, Dollar Amount, Percentage of Margin, Percentage of Balance, Percentage of Equity
Target TypestopLoss, takeProfitPips, Price, Percentage
Pending Order Price BasispricePips from market, Specified price, Percentage from market

Trade Override can replace the message's values with the EA's own. Use Signal Parameters takes volume, stopLoss and takeProfit from the message. Use EA Parameters takes all three from the EA's Risk, Stop-Loss and Take-Profit Override inputs. The two mixed options take SL/TP from one side and volume from the other.

Volume

The EA rounds every calculated volume to the nearest volume step of the symbol. It does not adjust to the broker's minimum or maximum volume; the broker rejects a volume outside its limits.

Volume TypeWhat volume means
LotsFixed lots. 0.01 requests 0.01 lot. The stop does not affect size.
Dollar AmountCash loss at the stop, in account currency despite the name. 100 targets 100 at the stop. Requires a stop loss.
Percentage of MarginPercentage of free margin to lose at the stop. 1 targets 1% of free margin. Requires a stop loss.
Percentage of BalancePercentage of balance to lose at the stop. 1 targets 1% of balance. Requires a stop loss.
Percentage of EquityPercentage of equity to lose at the stop. 1 targets 1% of equity. Requires a stop loss.

Every type other than Lots rejects a message with no stopLoss above 0 ("Stop Loss must be > 0"). Balance excludes floating profit/loss; equity includes it; free margin is equity minus margin in use. With an illustrative USD 10,000 balance and USD 9,100 equity, 1% means USD 100 or USD 91 respectively.

Choose a planned cash loss

eaToken=YOUR_EA_TOKEN;command=buy;symbol=EURUSD;volume=100;stopLoss=20

With Volume Type = Dollar Amount and Target Type = Pips, targets a loss of 100 in account currency at the 20-pip stop. Actual loss can differ.

Use balance for the risk amount

eaToken=YOUR_EA_TOKEN;command=sell;symbol=EURUSD;volume=1;stopLoss=20

With Volume Type = Percentage of Balance and Target Type = Pips, targets a loss of 1% of balance at the 20-pip stop.

Loss sizing: lots = budget ÷ (stop distance in pips × pip value per 1.00 lot). The EA reads pip value from the symbol's tick value and tick size. Costs, gaps and fills can make realised loss exceed the budget.

A wider stop means a smaller position

Pick a planned loss, then change the stop distance and see how the calculated lot size changes.

Same cash budgetPosition sizeLots
00.511.52020406080100Stop distance · pips
Stop
Planned loss
Planned loss
USD 100volume=100
Stop distance
18 pipsChosen for this example
Calculated size
0.556 lotsBefore volume rounding

100 ÷ (18 × 10) ≈ 0.556 lots, which the EA rounds to 0.56 on a 0.01 volume step.

Doubling the stop from 18 to 36 pips halves the size from 0.56 to 0.28 lots (the hollow dot on the chart).

Illustrative FX-5 EURUSD, USD account, 100,000 EUR contract and USD 10 per pip per lot. Real sizing uses broker contract details and volume limits; costs and execution can change the loss. Calculated example; not an executed trade.

At 20 pips, USD 100 ÷ (20 × USD 10) = 0.50 lots. Doubling the stop to 40 pips halves the size to 0.25 lots.

Stop loss and take profit

Target Type sets the unit for both stopLoss and takeProfit. A buy SL is below entry and its TP above; a sell is the reverse. The EA measures from the entry price: the current Ask/Bid for a market order, the pending entry for a pending order, and the position's or order's open price when modifying.

Target TypeUnit and example value
PipsDistance in pips. stopLoss=20 means entry minus 20 pips for a buy, plus 20 pips for a sell.
PriceAbsolute price. stopLoss=1.09500 requests that level directly.
PercentagePercentage of entry price. stopLoss=1 means entry × 1% as the distance. It does not mean 1% account risk.

What is a pip?

A pip is the unit ChartBridge uses for pip distances. On most forex pairs, prices have 5 decimals and a pip is the 4th decimal; the 5th decimal is a tenth of a pip.

Price moveDistance
1.10000 → 1.100101 pip
1.10000 → 1.1010010 pips
1.10000 → 1.1020020 pips

So stopLoss=20 on a EURUSD buy at 1.10000 puts the stop at 1.09800.

The pip depends on how many decimals your broker shows for the symbol, not on the asset name:

Decimals on the priceExample price1 pip20 pips
51.100000.00010.0020
3 (JPY pairs)150.0000.010.20
2 (often gold)2000.000.102.00

Check the decimals for your symbol in MetaTrader 5's Market Watch (Ctrl + M). The same pip applies to pip-based pending entries.

Prices must meet broker stop-level and tick rules; the broker can reject a stop that is too close.

One entry, three ways to set the stop

Illustrative entry · one price scale. Change each value and watch where the stop lands.

1.09800pips1.09500price1.08900percentage1.10000Buy entry · FX-5 · EURUSD
Target Type = Pips
stopLoss=2020 × 0.00010 = 0.00200 price distance
Target Type = Price
stopLoss=1.09500Use the supplied level. No conversion.
Target Type = Percentage
stopLoss=11.10000 × 1% = 0.01100 price distance

From a buy entry of 1.10000, a 20-pip stop requests 1.09800, a price stop of 1.09500 requests 1.09500, and a 1% stop requests 1.08900.

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

Target by price percentage

eaToken=YOUR_EA_TOKEN;command=buy;symbol=EURUSD;volume=0.01;stopLoss=1;takeProfit=2

With Target Type = Percentage and an illustrative buy entry of 1.10000, the 2% target distance is 0.02200: TP 1.12200. The 1% SL is 1.08900. These percentages use price, not account balance.

Open orders

Market commands

Include volume, plus a stop loss when Volume Type needs one.

CommandAction
buyBuy at market.
sellSell at market.

The EA's Max Positions, Max Positions per Symbol and Max Unique Symbols settings can reject a market entry; check the EA configuration.

Pending commands

Every pending order requires price above 0 and volume, plus a stop loss when Volume Type needs one. The EA's Max Pending Orders setting can also reject one.

CommandRequested entry side
buystopAbove market, buying after a rise.
buylimitBelow market, buying after a pullback.
sellstopBelow market, selling after a fall.
selllimitAbove market, selling after a rebound.
Pending Order Price BasisWhat price means
Pips from marketPip distance from market. 20 means 20 pips.
Specified priceAbsolute entry price, such as 1.09500. Check the command's side of market.
Percentage from marketPercentage of market. 1 means market × 1% as the distance.

For relative entries the market reference is Ask for buy orders and Bid for sell orders. The EA adds the distance for buystop/selllimit and subtracts it for buylimit/sellstop. Relative SL/TP is then measured from that pending entry.

Choose the entry price

eaToken=YOUR_EA_TOKEN;command=buylimit;symbol=EURUSD;volume=0.01;price=1.09500;stopLoss=20

With Pending Order Price Basis = Specified price and Target Type = Pips, requests a buy limit at 1.09500 and SL 20 pips lower at 1.09300.

Choose a percentage entry distance

eaToken=YOUR_EA_TOKEN;command=buystop;symbol=EURUSD;volume=0.01;price=1;stopLoss=20

With Pending Order Price Basis = Percentage from market, Target Type = Pips and Ask 1.10000, the 1% offset requests entry at 1.11100. Its 20-pip stop requests 1.10900.

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.

MarketEntryStop lossEURUSD
50 pips1.10000market1.09800entry1.09300stop
Pending order
Market reference
1.10000Illustrative quote
Buy limit entry
1.0980020 pips below market
Requested stop
1.0930050 pips below the pending entry

1.09800 − 0.00500 = 1.09300

At market reference 1.10000, a buy limit 20 pips below market requests 1.09800. Its 50-pip stop requests 1.09300. Measuring that stop from market instead would give 1.09500, only 30 pips from entry. A buy's SL is below its pending entry.

Five-decimal EURUSD example; Pending Order Price Basis = Pips from market, Target Type = Pips, 1 pip = 0.0001. These are requested levels. Actual fills, costs and stop execution can change the outcome. Calculated example; not an executed trade.

Close, cancel and modify

Check accounts, then trades. One EA Token can reach several accounts. Symbol commands act only on the message's symbol and stated direction. Power Mode determines whether management can include manual trades or other EAs: Off limits it to the EA's own Magic Number; On includes everything on the account. Check what changed and what remained on every receiving account.

If Volume Type is not Lots, the EA runs its volume calculation on these commands too and rejects them without a stopLoss above 0. Keep Volume Type = Lots on EAs you manage with these commands, or include a stopLoss.

Close positions

CommandRequested scope
closelongBuy positions on the symbol.
closeshortSell positions on the symbol.
closeallBuy and sell positions on the symbol. Pending orders are left in place.

To close every position and pending order on every symbol, use ceaseall under EA controls.

Close all on a symbol

eaToken=YOUR_EA_TOKEN;command=closeall;symbol=EURUSD

Requests closure of all EURUSD positions, buys and sells. EURUSD pending orders stay open; send cancelall to remove them.

Partial closes

CommandRequested scope
closelongpct, closeshortpctEach buy/sell position on the symbol is reduced by a percentage of its own volume. The EA's Partial Close Percentage Override decides the source: the EA's Partial Close Position Percentage, or the message's volume read as a percentage.
closelongvol, closeshortvolEach buy/sell position on the symbol is reduced by the message's volume, in lots.

Partial buy close

eaToken=YOUR_EA_TOKEN;command=closelongpct;symbol=EURUSD

If a buy position is 0.04 lot and the EA's Partial Close Position Percentage is 25%, the requested reduction is 0.01 lot, leaving 0.03 if accepted. Each matching position is reduced separately.

Close buy volume

eaToken=YOUR_EA_TOKEN;command=closelongvol;symbol=EURUSD;volume=0.01

Requests a 0.01-lot reduction from each EURUSD buy position. With three matching buys, up to 0.03 lot closes in total.

Partial Close Position Retry Count sets how many times the EA retries a rejected partial close.

Cancel pending orders

CommandRequested scope
cancelallAll pending orders on the symbol, buys and sells.
cancellongBuy stops and buy limits on the symbol.
cancelshortSell stops and sell limits on the symbol.
cancellongbuystopBuy stops on the symbol only.
cancellongbuylimitBuy limits on the symbol only.
cancelshortsellstopSell stops on the symbol only.
cancelshortselllimitSell limits on the symbol only.

Cancel commands never open a replacement order. To replace one, send the cancel command, then a separate pending-order message.

Cancel buy orders

eaToken=YOUR_EA_TOKEN;command=cancellong;symbol=EURUSD

Cancels EURUSD buy stops and buy limits. Already-open positions are outside this operation.

Cancel buy stops only

eaToken=YOUR_EA_TOKEN;command=cancellongbuystop;symbol=EURUSD

Cancels EURUSD buy stops; EURUSD buy limits stay in place.

Modify open positions

CommandRequested change
newsltplongSL/TP on buy positions.
newsltpshortSL/TP on sell positions.

Send both stopLoss and takeProfit. Pips and percentage values are measured from each position's open price. An omitted or 0 value removes that level: sending only takeProfit clears the existing stop loss.

Buy stop and target

eaToken=YOUR_EA_TOKEN;command=newsltplong;symbol=EURUSD;stopLoss=1.09800;takeProfit=1.10400

With Target Type = Price, requests SL 1.09800 and TP 1.10400 on EURUSD buys; entry and lot volume stay unchanged. Adapt levels to actual broker quotes and permitted distances.

Modify pending orders

CommandPending orders whose SL/TP changes
newsltpbuystopBuy stops.
newsltpbuylimitBuy limits.
newsltpsellstopSell stops.
newsltpselllimitSell limits.

Send stopLoss and takeProfit as for positions; an omitted or 0 value removes that level. The message's price is also applied as the order's entry, converted by Pending Order Price Basis, so include it. Relative SL/TP is measured from the order's entry.

Buy-stop targets

eaToken=YOUR_EA_TOKEN;command=newsltpbuystop;symbol=EURUSD;price=1.10200;stopLoss=20;takeProfit=40

With Pending Order Price Basis = Specified price and Target Type = Pips, keeps each EURUSD buy stop at 1.10200 and requests SL 1.10000 and TP 1.10600.

Close and re-enter

CommandClose → new market entry
closelongbuyBuys → new buy.
closeshortsellSells → new sell.

These close every position in that direction on the symbol, then open one new position in the same direction. The new entry needs volume and, when Volume Type needs one, a stop loss. If any close fails, the EA does not open the new position.

Refresh a buy

eaToken=YOUR_EA_TOKEN;command=closelongbuy;symbol=EURUSD;volume=0.01;stopLoss=20

Requests closing EURUSD buys, then a new 0.01-lot buy. Check both results; a combined message does not guarantee both actions complete. To reverse direction instead, send closelong followed by a separate sell.

Comment

comment is saved on new positions and pending orders. Close, cancel and modify commands do not filter by it.

Label a strategy

eaToken=YOUR_EA_TOKEN;command=buy;symbol=EURUSD;volume=0.01;stopLoss=20;comment=Strategy A

Labels the requested position Strategy A for identification in MetaTrader and reports.

EA controls

These act on the whole EA, not one symbol, and need no symbol field. They are accepted even while the EA is stopped.

CommandEffect
eastopStop processing signals. Positions and orders stay open. Later trade messages are rejected with "EA is Paused" until eastart.
eastartResume a stopped EA. Does not open anything. Establish why it stopped first: Daily or Total Protection can also stop it.
ceaseallClose all positions and cancel all pending orders on every symbol. The EA keeps running.
ceasealleastopceaseall, then stop the EA as eastop does.
eashutdownRemove the EA from its chart. Positions and orders stay open. It does not come back with eastart; re-attach it in MetaTrader.
ceasealleashutdownceaseall, then remove the EA from its chart.

If a Daily Profit or Daily Loss Limit is set, the EA also resumes at the start of the next broker day, even after eastop.

Power Mode sets the scope of ceaseall and its variants: Off limits them to the EA's own Magic Number; On includes manual trades and other EAs on the account.

Stop the EA

eaToken=YOUR_EA_TOKEN;command=eastop

Requests that the receiving EA stop processing trade signals. Send eaToken=YOUR_EA_TOKEN;command=eastart to resume.

Close everything and stop

eaToken=YOUR_EA_TOKEN;command=ceasealleastop

Requests closing every position and pending order in scope on all symbols, then stopping the EA. Check the final positions, pending orders and stopped state separately on all receiving accounts.

For every request, verify receipt, processing and the actual broker state. Check existing orders before retrying an uncertain outcome.

Cheatsheet

FieldUnit set by
volumeVolume Type
stopLossTarget Type
takeProfitTarget Type
pricePending Order Price Basis
commentFree text
CommandWhat it doesNeeds
buyOpen a buy at marketsymbol, volume
sellOpen a sell at marketsymbol, volume
buystopPlace a buy stop above marketsymbol, volume, price
buylimitPlace a buy limit below marketsymbol, volume, price
sellstopPlace a sell stop below marketsymbol, volume, price
selllimitPlace a sell limit above marketsymbol, volume, price
closelongClose buy positions on the symbolsymbol
closeshortClose sell positions on the symbolsymbol
closeallClose buy and sell positions on the symbol; pending orders staysymbol
closelongbuyClose buy positions, then open a new buysymbol, volume
closeshortsellClose sell positions, then open a new sellsymbol, volume
closelongpctReduce each buy position by a percentagesymbol; volume if % comes from signal
closeshortpctReduce each sell position by a percentagesymbol; volume if % comes from signal
closelongvolReduce each buy position by volume lotssymbol, volume
closeshortvolReduce each sell position by volume lotssymbol, volume
cancelallCancel all pending orders on the symbolsymbol
cancellongCancel buy stops and buy limits on the symbolsymbol
cancelshortCancel sell stops and sell limits on the symbolsymbol
cancellongbuystopCancel buy stops on the symbolsymbol
cancellongbuylimitCancel buy limits on the symbolsymbol
cancelshortsellstopCancel sell stops on the symbolsymbol
cancelshortselllimitCancel sell limits on the symbolsymbol
newsltplongSet SL/TP on buy positionssymbol, stopLoss, takeProfit
newsltpshortSet SL/TP on sell positionssymbol, stopLoss, takeProfit
newsltpbuystopSet SL/TP and entry on buy stopssymbol, price, stopLoss, takeProfit
newsltpbuylimitSet SL/TP and entry on buy limitssymbol, price, stopLoss, takeProfit
newsltpsellstopSet SL/TP and entry on sell stopssymbol, price, stopLoss, takeProfit
newsltpselllimitSet SL/TP and entry on sell limitssymbol, price, stopLoss, takeProfit
eastopStop processing signals; trades stay open—
eastartResume a stopped EA—
ceaseallClose all positions and pending orders on every symbol—
ceasealleastopceaseall, then stop the EA—
eashutdownRemove the EA from its chart; trades stay open—
ceasealleashutdownceaseall, then remove the EA from its chart—