Scaling in changes the problem from trade risk to portfolio risk
The source builds examples with two entries at different prices sharing a common protective stop. Because each entry has a different distance to that stop, equal lot sizes do not produce equal risk. The lesson therefore allocates a monetary risk budget to each leg and calculates the size of each entry separately.
Define the total risk envelope first
Before adding positions, define how much the complete idea is allowed to lose if the common stop is hit. The lesson gives a simple example of splitting a $300 total budget equally or unevenly between two entries depending on the intended weighting.
A common stop creates different stop distances
In the lesson's GBP example, the upper entry is farther from the common stop than the lower entry. The lower entry can therefore carry more volume for the same monetary risk. This is the mathematical reason a later, better-priced entry can contribute disproportionately to the final P&L.
Do not confuse adding size with adding risk
A bot should not decide that a second entry is safe merely because the first trade is profitable. It should recalculate aggregate loss at the shared stop after every proposed order, including existing positions, the new quantity and execution costs.
Closing one leg and protecting another
The source describes a discretionary variation in which the less attractive entry is closed after price moves favorably, while the better-positioned leg remains and can be protected around break-even. For automation, the conditions for this action need to be explicit: profit threshold, structural resistance/support, fees, minimum stop distance and whether break-even means entry price or entry plus costs.
The engineering rule
Treat a pyramid as one risk object containing multiple legs. Store the common thesis, shared invalidation level, per-leg risk, aggregate risk and current permission state. That is substantially safer than letting each order behave as an independent trade.