How Execute determines position size using a 3-tier config matrix, risk-based math, and per-account independence.
Execute determines how many lots to trade before every entry. This page covers the 3-tier configuration matrix, sizing modes, risk formulas, R-multiple calculation, and how sizing works across multiple accounts.
Every sizing decision checks three tiers in priority order. The first tier with a non-zero value wins.
Tier 1 — Strategy-specific. Each strategy has its own size and risk columns in your AccountConfig sheet. For example, a strategy named SST reads from sst_size and sst_risk. If these have values, they control sizing for that strategy.
Tier 2 — Asset class. If Tier 1 has no value, the engine falls back to asset-class columns: stock_fut_size, index_opt_risk, commodity_fut_size, and so on. The correct column is selected by matching the instrument's asset class (stock, index, commodity) and type (futures, options).
Tier 3 — Global fallback. If neither strategy nor asset class has a value, the engine reads defaultStockSize — a catch-all for any instrument not covered by the tiers above.
This matrix lives in your Google Sheet. You control it. Execute reads it at signal time.
When your size value is below 1,000, it is treated as a lot count.
size = 5, lot_size = 50
→ lots = 5, quantity = 250
Set sst_size = 3 and every SST trade enters with 3 lots, regardless of risk or margin.
When you set a risk value (e.g., sst_risk = 500), the engine calculates how many lots fit within that risk budget.
Risk per lot formula:
risk_per_lot = |entry_price - sl_price| × multiplier × lot_size
entry_price — the price at entrysl_price — the initial Stop Loss (SL)multiplier — contract multiplier (1 for most instruments)lot_size — units per lot (e.g., 100 for US stock options, 50 for ES futures)Lot count:
lots = floor(account_risk / risk_per_lot)
Example: you buy AAPL call options at $185 with SL at $180. US options lot size is 100.
risk_per_lot = |185 - 180| × 1 × 100 = $500
account_risk = $2,000
lots = floor(2000 / 500) = 4
quantity = 4 × 100 = 400
When your size value is 1,000 or above and no risk value is set, it is treated as a capital allocation. The engine divides your capital by margin per lot.
size = 50000, margin_per_lot = 12000
→ lots = floor(50000 / 12000) = 4
When both risk and capital constraints are specified, the tighter constraint wins. If risk math says 6 lots but capital only supports 4, you get 4 lots.
The R-multiple measures how far price has moved relative to your initial risk. It applies to both long and short trades.
For long trades:
R-multiple = (current_price - entry_price) / (entry_price - initial_sl)
Example: entry at $185, SL at $180, current price at $195.
R = (195 - 185) / (185 - 180) = 10 / 5 = +2R
For short trades:
R-multiple = (entry_price - current_price) / (initial_sl - entry_price)
Example: entry at $185, SL at $190, current price at $175.
R = (185 - 175) / (190 - 185) = 10 / 5 = +2R
In both cases, 1R of risk means the trade has moved one unit of initial risk in your favor. A trade at -1R has hit the initial SL level. R-multiples are used by Trade Manager's R-Trail feature to move SL at profit milestones.
See Trade Manager for how R-Trail uses these milestones to adjust SL.
Each account in your AccountConfig is sized independently. Account A might have sst_risk = 500 while Account B has sst_risk = 2000. When a signal fires, the engine runs the sizing formula separately for each account. Account A gets fewer lots. Account B gets more. The same signal, different position sizes.
This independence extends to margin checks. If Account A has insufficient margin, its order may be reduced or skipped while Account B executes at full size. No account's sizing affects another.
The engine returns zero quantity (and skips the trade) in these cases:
When zero is returned, the reason is logged. Check your Telegram alerts for the specific skip reason.
If the broker rejects your order due to insufficient margin after sizing, Order Intelligence takes over. It retries the order with one fewer lot, stepping down until the order fills or reaches one lot.
See Order Intelligence for margin step-down retry and freeze limit splitting.
Strategy rules are frozen into the trade record at entry time. Changing your AccountConfig affects new trades only — active trades keep their original sizing parameters.
This is engineering infrastructure, not investment advice. All trading involves risk of loss.