Grid and Martingale: How These Structures Work and Why They Can Fail
A factual explanation of grid spacing, martingale multipliers and the way both convert many small wins into one large open exposure, including what a backtest can and cannot show about them.
Grid and martingale structures appear frequently in template libraries and in forum discussions, and they deserve a clearer explanation than they usually get. This article describes how each works as a set of rules, what happens to risk while they run, and why their most common failure mode is difficult to see in a backtest.
Key takeaways
- A grid opens additional positions at defined intervals, usually against the current movement, until a condition ends the sequence.
- A martingale changes the size of later positions, most often increasing it after a loss.
- Both convert a history of many small outcomes into a single open exposure that grows over time.
- Neither structure changes the underlying direction of the trade; it changes the distribution of outcomes across time.
- In Lupuso, grid and martingale are block types you can construct and test, which is exactly why they should be examined rather than assumed harmless.
What is a grid?
A grid is a rule that opens additional positions at fixed price intervals. The intervals, the number of allowed steps and the direction of the additional positions are all parameters.
A typical formulation: starting from an initial position, if price moves against it by a chosen interval, open another position in the same direction; repeat up to a maximum number of steps; close all positions when price returns to an average entry or to a defined take-profit level.
The defining property is that the sequence is not closed until a condition is met. While the sequence is open, the number of positions and the total exposure grow with each adverse step. The strategy can therefore show a long series of small completed sequences and then one sequence that does not close for a long time.
Two details determine almost everything about how a grid behaves:
- Spacing. Fixed price spacing behaves very differently on symbols with different volatility. Volatility-relative spacing, for example a multiple of ATR, scales with the instrument.
- Step limit. An unbounded sequence has no defined worst case. A bounded sequence has a worst case you can write down — and therefore a maximum exposure you can plan for.
What is martingale?
A martingale adjusts the size of each subsequent position rather than the number of positions. The most common form multiplies the size after a loss, so that a later winning position recovers earlier losses. The multiplier is a parameter: 1.0 is no martingale at all, 2.0 is the classic doubling, and other values produce other shapes.
The arithmetic is the part worth stating plainly. Doubling after each loss means that after n consecutive losses the size of the next position is 2^n times the initial size. The growth is exponential, not gradual. Ten steps is a factor of 1024. This is not a judgement about the strategy; it is what the parameter does.
Martingale and grid are often combined: a grid supplies the sequence of additional positions and a martingale multiplies each one. The result is exposure that grows in both count and size, which is the fastest way to arrive at very large open risk.
Why can these structures fail?
The failure mode is structural, not a matter of tuning.
A strategy that closes sequences at a profit produces many small favourable outcomes and defers losses rather than realising them. The loss is not avoided; it is held as open exposure until price returns far enough to allow a close. If price does not return within the step limit, the exposure is realised as a single large loss that can exceed the sum of all the previous small gains.
Three conditions make this more likely:
- Trend without sufficient retracement. If price moves persistently in one direction, the intervals keep triggering and the step limit is reached.
- Low liquidity or widening spread. Additional positions cost more to open and to close, and gaps can skip past levels entirely.
- A step limit chosen after the fact. If the limit was selected because the tested period never exceeded it, the limit is a description of that period rather than a design decision.
The pattern that emerges is characteristic: a long record of completed sequences with small gains, then a single drawdown larger than everything before it. The record before that moment does not contradict the outcome; it is the mechanism that produced it.
What does a backtest show, and what does it not?
A backtest can show you how many sequences completed, what the maximum open exposure was, and how deep the equity decline went during the tested period. These are useful descriptions, and with grids they are more informative than the final balance, because the interesting quantity is the peak exposure, not the end point.
What a backtest cannot do is demonstrate that a sequence would have closed. Every historical period eventually contained a return that allowed the sequence to close. That is a property of the data you happened to test. A different period, a different symbol or a different broker clock may not contain such a return, and no historical run can rule that out.
For this reason the most informative output of a grid backtest is often not the profit line but the maximum open exposure and the maximum number of simultaneously open positions. If those numbers are large, the rule's risk is concentrated in a small number of historical moments, and the sample available to reason about them is correspondingly small.
How should these blocks be handled in a builder?
The honest way to work with grid and martingale blocks is to treat them as risk-bearing constructions that need explicit limits, not as clever additions.
In Lupuso, the Grid family includes an ATR trend grid and a hedge grid, and every threshold in them is an input you can change in the variables and constants window. Constructing one is straightforward; the useful work is in deciding and documenting:
- The maximum number of steps, and what happens when it is reached: full close, partial close, or stop.
- The maximum open exposure, expressed in money or in a fraction of equity, after which no further step is allowed.
- The maximum simultaneous positions on one symbol.
- The multiplier, if any, and the point at which it stops increasing.
- The account-level daily loss limit that applies regardless of what the sequence is doing.
Validation runs before export, and export is all-or-nothing. If a grid cannot be represented faithfully on the chosen target — for example because of netting versus hedging account behaviour — the export is refused with a reason. That refusal is relevant information, not an inconvenience.
Common mistakes
- Setting a step limit by looking at the tested period's worst case rather than by deciding an exposure ceiling in advance.
- Using fixed price spacing on a symbol whose volatility changes substantially across the day.
- Combining a grid with a martingale multiplier without recalculating the maximum possible exposure.
- Reading a long history of completed sequences as evidence that the structure is stable.
- Ignoring account type, so that a grid built on independent positions merges unexpectedly on a netting account.
- Allowing unlimited exposure because "the sequence has always closed before".
- Testing without costs, or with spreads narrower than those that occur during the hours the sequence is usually open.
Risk note
Grid and martingale structures can accumulate open exposure that is many times larger than any single position in a conventional entry-and-stop strategy, and they can do so quickly. The historical sequences that completed in profit are not evidence about the next sequence, and a backtest cannot demonstrate that a sequence would have closed under different market conditions. Trading carries a real risk of loss, and with these structures the loss can exceed the account balance if exposure is not bounded and enforced. Decide the step limit, the maximum exposure and the daily loss limit before running anything, keep them inside the strategy so they are visible and inspectable, size the account so that the maximum possible exposure is survivable, and treat any long history of small wins as a description of one period rather than as evidence of stability.
English · Español · Français · Deutsch · Português · 中文 · العربية · हिन्दी · 9 supported locales
