Check an add to an open position against your written add rules first
Before you add to an existing long, a script recomputes the combined position's risk at the current stop and checks your own add rules, such as adding only when the first part shows open profit. It reports; you decide.
How it works
- Write your add rules as numbered, checkable statements, for example: an add is allowed only if the current stop is at or above the first entry, the combined open risk at the stop is no more than the initial risk of the first part, and there are at most two adds per position.
- Keep each open position's fills (quantity and price per part) and its current stop in your own positions file.
- When you're considering an add, give the script the planned add quantity and the price you expect, plus the new stop if you'd raise it.
- The script computes the average cost, the combined quantity, the combined risk at the stop in account currency and in R of the original position, and the number of adds so far, then checks each numbered rule as met or not met.
- It prints the figures and the rule table. You decide, and the check line goes into your journal with your decision.
Copy-paste prompt
Write a Python script that checks a planned add to an open long position against my rules. It gives no trading advice and never says whether to add.
Inputs: {{positions_csv}} (position_label, part, quantity, fill_price), {{stops_csv}} (position_label, current_stop), {{initial_risk_csv}} (position_label, initial_risk_amount), and arguments position_label, add_quantity, expected_price, optional new_stop.
Compute: combined_quantity, average_cost, combined_risk = Σ part quantity × (part fill price − stop) using the new stop if given, combined_risk_in_R = combined_risk ÷ initial_risk_amount, adds_so_far.
Check each rule in {{add_rules}} and print met or not met with the numbers used. A negative risk figure means the stop is above that part's cost; show it, don't hide it.
Print one journal line and append it only after I confirm. No broker connection, no orders. Include two test cases I can check by hand.Guardrails
- The rules are yours and written in advance; the script never proposes an add or a size.
- All figures are computed in code from your files, never typed by a model.
- The script reads files and appends one journal line after you confirm; it has no broker access.
What can go wrong
The first version measured risk only on the new part, so an add looked small while the whole position's risk at the stop had nearly doubled. Measuring the combined position against the original R fixed it. Rules like 'the first part shows open profit' also need a number (open profit of at least 1R, say), or the check can't be run.
Why it helps
Adding to a working position is one of the few in-trade decisions that raises risk, and it tends to be made when you feel most confident. Seeing the combined position's risk at the stop, in R of the original trade, next to your own add rules, keeps the decision inside the limits you set when you were calm.
How it fits with other entries
The pre-trade sizing check (aft-0008) covers new positions and portfolio heat; this is the same discipline for adds to an existing one. The management ledger (aft-0059) records the add after it happens, and the overnight gap check (aft-0050) shows what the larger position would cost if it opened beyond the stop.
Where this comes from
Investopedia's explainer on pyramiding (adding to a position) and the SEC investor bulletin on stop orders, as background. The add rules, R measure and check are ours.
Source and references
Original write-up by Agents for Traders. Background reading is linked below.
- Pyramiding: What It Is and How It Works · Investopedia (checked 20 Oct 2026)
- Stop, Stop-Limit, and Trailing Stop Orders: Investor Bulletin · Investor.gov, U.S. Securities and Exchange Commission (checked 20 Oct 2026)
Spotted an error, or want your post removed? Email hello@agentsfortraders.com.
Educational content only. Not investment advice or a personal recommendation. No tickers, signals or trade alerts. Trading involves risk of loss.
Conteúdo exclusivamente educativo. Não constitui aconselhamento nem recomendação de investimento. Sem tickers, sinais ou alertas de negociação. Negociar envolve risco de perda.
Related use cases
Check position size and portfolio heat before you trade
Run a local Python script on your planned entry, stop and positions CSV, and paste only its stdout. The agent checks size, heat, theme concentration and, when present, correlation against your limits, and leaves the decision to you.
Risk & position-sizing checksCheck what each open position would cost if it opened beyond your stop
Before the close, a script works out each position's loss if it opened past your stop by a gap size you choose from your own data. If the total exceeds the overnight limit you wrote down, you see it before you decide to hold.
Discipline, checklists & psychologyLog every stop move, add and partial exit, then check each against your plan
Each time you change an open position, you write one line: what changed, when and which plan clause allowed it. Each weekend an agent sorts the lines into planned, allowed exception or off-plan, so mid-trade changes get reviewed too.
The Daily 3
Three agent workflows for swing traders, free, on US trading days.