Fetching the page
Fetching the page
GIO4X Labs · Simulation
Six machines about how an account is lost and how slowly it comes back, the last about how a portfolio is put together. Each is a simulation on invented figures, or arithmetic you can check, and each says what it leaves out.
Risk of ruin
Set a win rate, the size of a gain against a loss, the share risked on each trade and the fall that counts as ruin. The fan shows where 240 simulated runs went, and how many hit the level.
Tool: Position SizeOf 240 simulated runs of 150 trades, 74 (30.8%) fell 50% below where they began and stopped there, drawn in red. The other 166 did not, within these trades.
Average trade = win rate × gain − loss rate × 1, in units of the amount risked: here 0.45 × 1.3 − 0.55 = +0.04. Each trade risks the same share of the account as it then stands. The picture’s scale is proportional, and the luckiest runs go off the top.
A simulation on invented odds. Every trade is independent and the odds never change; real trades are neither, and nobody knows their own win rate this exactly.
The sizing ladder
One invented run of wins and losses, replayed at 0.5%, 1%, 2%, 5% and 10% risk per trade. The larger sizes fall further and take longer to get back.
Tool: DrawdownOne invented run of 150 trades (75 wins, 75 losses, each gain the size of each loss) replayed at five sizes. At 0.5% risk the deepest fall was 6.3%; at 10% it was 76.1%, and the account spent 91 trades below an earlier peak.
| Risk per trade | Deepest fall | Gain needed to undo it | Longest time below a peak | Ended on, per 100 |
|---|---|---|---|---|
| 0.5% | 6.3% | 6.7% | 75 trades | 100 |
| 1% | 12.3% | 14.0% | 75 trades | 99 |
| 2% | 23.3% | 30.3% | 75 trades | 97 |
| 5% | 49.4% | 97.7% | 76 trades | 83 |
| 10% | 76.1% | 317.9% | 91 trades | 47 |
The dot on each curve is the bottom of its deepest fall. The wins and losses are the same for all five; only the share of the account risked on each trade differs. The scale is proportional: equal distances are equal percentages.
A run with more wins than losses ends higher at the larger sizes, and one with more losses ends lower. With equal numbers of each, every size ends below where it began and the larger sizes end lowest, because each loss takes a larger gain to undo.
A simulation on invented trades with fixed, even odds. It shows what size does to a given run. It does not say what size to use.
Losing streaks
For a win rate and a number of trades, the exact chance of at least so many losses in a row, and one simulated run with its longest streak marked.
The Mind RoomWith a win rate of 45%, the chance of at least 6 losses in a row somewhere in 100 trades is 72.9%. In the simulated run below the bars, the longest losing streak was 6.
The method: keep the chance of each possible length of the losing run a sequence currently ends on (0 up to 5), and one more for “the streak has happened”. Each trade, a win sends every length back to 0 and a loss moves it one along; a loss from 5 lands in “happened”, which nothing leaves. After 100 trades that number is the answer. It is exact, not an estimate.
It assumes each trade is independent with the same odds. Real losses tend to cluster more than this, because the conditions that cause one often cause the next.
Correlation of a portfolio
Two to four invented holdings in equal shares. Move the slider to set how closely they move together, and compare the combined swing with the average of the parts.
The Engine Room2 invented holdings in equal shares with a correlation of 0.30: the combined swing is 9.7 points a step against 12.0 for the average of the parts, 81% of it. The less they move together, the more their swings cancel.
Holdings (each one invented)
For two holdings: σ = √(w₁²σ₁² + w₂²σ₂² + 2·w₁·w₂·ρ·σ₁·σ₂). With A and B alone, half each: √(0.25 × 10² + 0.25 × 14² + 2 × 0.25 × 0.30 × 10 × 14) = 9.7.
Swings (standard deviations) of one step, in invented points: A 10, B 14. σ is a swing, w a share of the whole and ρ the correlation. With more than two holdings the same sum runs over every pair. The slider stops at −0.30 because four holdings cannot all move against one another by more than −0.33.
The combined swing is arithmetic; the paths are one simulated draw with that correlation. Real correlations are not fixed: holdings that moved apart in calm periods have often fallen together under stress.
Recovery arithmetic
A loss of x needs a gain of x ÷ (1 − x) to undo it. The bar falls and must climb back; the curve shows how fast the climb grows.
Tool: Compound GrowthA loss of 50% leaves 50 of every 100. To be back at 100, what is left must gain 100%: 50 ÷ (100 − 50) = 1.00.
Gain needed = loss ÷ (1 − loss), with the loss as a fraction. The dotted line is where a gain equal to the loss would sit; the solid curve leaves it further behind the deeper the loss.
Arithmetic, not a forecast. It says how far there is to climb, not whether or how soon a climb comes.
Building a portfolio
Three invented holdings at weights you set, money paid in or taken out each month, and rebalancing that costs something. Switch on a stress stretch, an exchange rate, or the same exposure with borrowed money, and compare the result with never rebalancing and with equal weights on the same paths.
Investing explainedOver 120 invented months, 10,000 units held as 40% Steady, 40% Lively, 20% Abroad, with 50 paid in each month and rebalanced every 12 months, ended on 19,565 against 16,000 paid in; it was rebalanced 10 times at a cost of 50, and its deepest fall was 34.1%.
| These settings | Never rebalanced | Equal weights | |
|---|---|---|---|
| End value | 19,565 | 19,009 | 19,743 |
| Deepest fall | 34.1% | 34.6% | 34.6% |
| Total contributed | 16,000 | 16,000 | 16,000 |
| Total cost paid | 50 | 0 | 56 |
| Times rebalanced | 10 | 0 | 10 |
Weights (they always total 100%)
Drag one weight and the other two share what is left, in the proportions they already had (equally, if both were at nothing).
Rebalance
A separate comparison. Investing with only your own money and holding a leveraged exposure are different things, even on the same paths: a fall that the first survives can leave the second with nothing.
A simulation on invented paths. It shows what each choice did on one run; another run can favour a different column. It is not a forecast and does not say what to hold or how often to rebalance.
The model
Ordinary arithmetic and a seeded random number generator, run in your browser: no data feed, nothing sent anywhere and nothing stored. The sizing sum that turns a risk per trade into a position is in the Position Size tool.
SimulationInvented odds, invented holdings, an invented exchange rate and example accounts. Educational information, not investment advice or a recommendation to trade.
The result of one trade tells the next one nothing. In the simulations a win or a loss is one draw from a seeded generator, so the same run number always gives the same run.
The win rate and the size of a gain against a loss are whatever the sliders say, for every trade. A gain is always the same multiple of the amount risked, and a loss is always exactly the amount risked.
Each trade risks the same percentage of the current balance, so the amount shrinks after a loss and grows after a gain. Ruin is counted the first time a run is the chosen percentage below where it began, and the run stops there.
The chance of a losing streak is computed in full by dynamic programming, with the method stated beside it. The risk of ruin is the share of 240 simulated runs that hit the level: another 240 would give a slightly different share.
Each invented holding moves by a random step with a fixed swing, and every pair shares one correlation. The combined swing is the standard formula for the standard deviation of a weighted sum.
In the sixth machine each holding has a made-up average return and swing that never change, and every pair shares one correlation. Money paid in is split at the target weights, money taken out comes from each holding in proportion, and rebalancing costs the rate you set on the value bought and sold. Nothing else is charged.
For a marked run of months the model raises every correlation to 0.9 and doubles every swing, because it was told to, not because anything was measured. The exchange rate is one more invented path, independent of the holdings.
The leveraged comparison borrows once at the start, lets the loan grow by the financing cost, and stops for good the first month the exposure is worth no more than the loan. A real lender would usually act before that point; that is not modelled.
What it is not
The model is simple on purpose, so the arithmetic can be seen. Each simplification makes the picture tidier than the thing it describes, and none of the figures here measures a real account or method.
Losses tend to arrive together, because the conditions that cause one often cause the next, and because people trade differently after a loss. Streaks in practice can be longer than the independent figure suggests.
A win rate measured over past trades is an estimate with a wide margin, and it shifts as markets change. The sliders ask for numbers that in practice cannot be known this exactly.
A price can pass through a stop in a gap or a fast market, so a real loss can be larger than planned. Costs such as spread, commission and financing are not modelled here at all.
The correlation between two holdings is not a fixed property. Holdings that moved apart in calm periods have often fallen together under stress, which is when the relief was wanted.
Questions people ask
Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose.