Skip to content

Automated trading

Choosing Position Size, Stop Loss and Take Profit for a PineConnector Alert

PineConnector messages use one volume method and at most one stop method and one target method. Choose explicit units: vol_lots= for lots, loss-budget methods such as vol_dollar= with an explicit stop, and sl_pips= or sl_price= for the corresponding stop unit. A planned loss is a sizing input, not a maximum realised loss. The checks below distinguish the requested values from the broker outcome.


Before You Start

This assumes you already have an alert() call or TradingView alert sending messages to PineConnector's webhook. If you haven't set that up yet, start with Pine Script alert() Function: Automate Strategy Signals or, for a full connection walkthrough, How to Connect TradingView to MT5. For the complete parameter list with every command, this guide's companion reference is TradingView Alert Syntax for Automated Execution and PineConnector's own syntax documentation; this guide focuses on choosing between the options, not listing all of them again.


Three Questions That Decide Your Sizing Parameter

PineConnector's syntax documentation lists five volume methods. You send exactly one per message. The right one depends on what "size" means to you for this particular trade:

What you actually want Parameter Needs a stop loss?
The same position size every time, regardless of account balance vol_lots=0.1 No
Plan a cash loss at the stop in account currency vol_dollar=50 Yes
Risk a fixed percentage of your account balance per trade vol_pct_bal_loss=1 Yes
Risk a fixed percentage of current equity per trade (floating P/L included) vol_pct_eq_loss=1 Yes
Allocate a fixed percentage of balance as margin, regardless of stop vol_pct_bal_margin=5 No

The last row is easy to confuse with the two above it and means something different. A percentage of account risk (how much you're willing to lose) is not the same figure as a percentage of margin allocated (how much of your account is committed to holding the position open). vol_pct_bal_margin=5 sizes the trade so it uses roughly 5% of your balance as margin; it says nothing about what you'd lose if the stop is hit, because it isn't calculated from your stop distance at all. If what you actually mean is "I want to risk 1% of my account on this trade," that's vol_pct_bal_loss=1 or vol_pct_eq_loss=1, not a margin percentage. With either percentage method, size grows and shrinks with the account; when to increase position size explains why that beats sizing up after a winning streak.

The three loss-based methods (vol_dollar=, vol_pct_bal_loss=, vol_pct_eq_loss=) all require an explicit stop loss parameter in the same message. PineConnector calculates the lot size backward from your stop distance and your risk figure, and it cannot do that without a stop to measure from. A closer stop and a farther stop produce different lot sizes for the same cash or percentage risk, by design: that's the entire point of risk-based sizing, but it also means the resulting lot size will change if your stop distance changes, even with an identical risk figure.

LicenseID,buy,EURUSD,vol_dollar=50,sl_pips=10
LicenseID,sell,EURUSD,vol_pct_bal_loss=1,sl_pips=20

These figures are sizing inputs, not promised outcomes. Slippage, weekend gaps, and a broker's execution price at the moment the stop triggers can all move the realized loss away from the $50 or 1% you calculated. Treat the risk figure as a sizing target, not a fixed ceiling on what you'll actually lose.


Matching Your Stop and Target to How Your Script Stores Them

A Pine Script strategy typically holds a level in one of three shapes, and PineConnector has a parameter for each:

  • A pip distance (you decided "20 pips away," not tied to any specific price) → sl_pips=20 / tp_pips=40.
  • An exact chart price (a swing low, an EMA value, a support level your script calculated) → sl_price= / tp_price=.
  • A percentage distance from entry → sl_pct=1 / tp_pct=2.

Sending the wrong one is a common way a target ends up somewhere you didn't expect. A chart-derived price is not a pip count: low[1] in Pine Script might evaluate to 1.09760, and sending that through sl_pips= would ask PineConnector for a stop 1.0976 pips away, not a stop at that price. Use the price parameter for a price, and the pip parameter for a pip count. That's necessary, but not sufficient, on its own:

Illustrative specification, not executable code: for a buy, define the chart-derived stop below the entry reference and target above it, format each as a price, and use sl_price= and tp_price=. Separately verify the broker symbol, tick size and minimum stop distance on demo.

A chart-side direction check is preliminary. PineConnector’s current Syntax reference requires the correct side of entry, broker tick size and minimum stop distance; a TradingView-derived price can still be invalid at the broker. Review the received text in Portal → Bridge / Signals log, the EA’s requested values in Experts and the broker result in Journal and account history. See the price-stop reference.

A special case worth knowing: sl=0 is not the same as sl_pips=0. The bare value sl=0 is a documented request to move the stop to breakeven on an existing position. It requires the position to be in profit and needs your broker's minimum stop distance to be satisfiable, and it isn't interchangeable with the pip/price/percentage family above. There's a second legacy exception worth knowing too: the partial-close commands closelongvol/closeshortvol use risk= to mean a close-volume amount in lots (for example risk=0.01 closes 0.01 lots), not an entry-risk figure. That's a different, still-current use of the same parameter name, distinct from legacy entry sizing, whose risk= interpretation depends on the receiving EA’s Volume Type.


If Your Order Size or Target Isn't What You Expected

Work from the record in Portal → Bridge / Signals log. An entry establishes receipt, while its processing result may report a problem. A missing entry and a rejected processing result are different branches; use the setup test guide and the account’s Experts/Journal records rather than assuming every rejected message is absent. Compare the received text with the intended message before changing settings.

  • Two volume or two stop methods in one message. The syntax specifies one volume method and one stop method per message; PineConnector isn't documented to merge or prioritize between conflicting ones, so don't send both vol_lots= and vol_dollar=, or both sl_pips= and sl_price=, in the same alert.
  • A loss-based volume method with no stop, or a mismatched one. vol_dollar=, vol_pct_bal_loss= and vol_pct_eq_loss= all need a stop in the same message to calculate a lot size at all. If the size looks too large or too small for the risk figure you sent, check the stop distance next. A tighter stop produces a larger lot size for the same dollar or percentage risk, and a wider stop produces a smaller one.
  • A price sent as a pip count, or a pip count sent as a price. Covered above; this produces a target that's either absurdly close to entry or nowhere near the chart level you intended.
  • A price or pip distance on the wrong side of entry. A take-profit below entry on a buy (or above entry on a sell) is invalid; PineConnector's documentation requires the price to be on the correct side. Validate this in your script, as shown above, before sending the alert.
  • Pending-order distances measured from the wrong reference. For buystop, buylimit, sellstop and selllimit, PineConnector's documentation is explicit that stop and target distances are measured from the pending entry price, not from the market price when the order is placed or filled. If your target looks offset by the same amount as your entry distance, check this next.
  • Broker-side rejection or adjustment. Read the symbol’s minimum, maximum and volume step. The FAQ says out-of-range targets are rejected and in-range targets round to the nearest step. The Syntax reference leaves the rounding direction unresolved, so do not infer it from one page: verify calculated, submitted and accepted volume in Experts and broker records. Price increments and minimum stop distances are separate checks.

Verifying the Result

A record in Portal → Bridge / Signals log shows receipt; read its processing result too. It does not prove that the broker filled an order. On demo, verify the account, symbol, direction, filled volume, resulting position and broker-side stop/target levels. On Edge, the hosted Experts and Journal logs are available in Portal → Edge; use them with account history.


Reviewed 18 September 2026. Every parameter, requirement and example above was checked against PineConnector's syntax documentation and its EA settings guide. The worked examples are illustrative, not measured results: confirm the resulting size, stop and target on a demo account before trading on it live. PineConnector executes the instructions you send it. It does not select trades, manage money, or hold funds. Trading carries risk, and past performance of any strategy does not indicate future results.

Try Core for 7 days for $7 at PineConnector and size your first alert deliberately, on a demo account, before going live. After the trial, Core is $59/month unless you cancel.

Corrections reviewed 23 September 2026 against the cited primary documentation accessed on that date. No trading account was tested and no Pine Script or MQL5 code was compiled for this update.

Sources

  1. PineConnector – PineConnector Syntax, accessed 23 September 2026.
  2. PineConnector – Frequently Asked Questions, accessed 23 September 2026.
  3. PineConnector – Test your setup, accessed 23 September 2026.
  4. PineConnector – Connect your MT5 account, accessed 23 September 2026.
  5. PineConnector – EA settings reference, accessed 23 September 2026.
Back to PiCo Blog

Run your strategies on our managed infrastructure

Bridge routes TradingView alerts to MetaTrader. Edge hosts and runs MT5 for you.

Core Trial

Then $59/month unless you cancel.

$7for 7 days

  • 3 account connections
  • 1 hosted MT5
  • Unlimited alerts, routed by Bridge
Try Core for $7

Trusted by 66,000+ traders in 156 countries and territories · <1s typical latency

Your Edge MT5 runs in our cloud · nothing to install · built on Microsoft Azure