Skip to content
TradingTune
Pine Script and TradingView Workflow

Why Pyramiding Settings Need Notes

Shows how layered exposure settings can alter tester metrics and risk context.

On this page

Key takeaways

  • Pyramiding sets the maximum number of entries a strategy can have open at once in one direction, so it changes exposure and not only entry count.
  • Sweep pyramiding together with entry spacing and position size, or a spacing effect can be mistaken for a pyramiding effect.
  • A setting that looks smooth in one window can fail in the next if that window never contained a fast reversal.
  • Write down which window produced each result and what the market was doing, so a run can be compared with the next one.

What Pyramiding Notes Solve and Who Needs Them

Pyramiding caps how many entries a strategy can have open at once in the same direction. In TradingView’s strategy properties, the pyramiding property sets the maximum number of successive entries allowed in one direction, and when it is left at its default of 1 the strategy opens new positions but does not add to an open one through strategy.entry() calls. The Pine Script v6 docs state it this way: “The default argument is 1, meaning the strategy can open new positions but cannot add to them using orders from strategy.entry() calls.” (TradingView Pine Script v6 docs on pyramiding, TradingView Help Center on strategy properties). Change that one number during a sweep and everything downstream shifts: the equity curve shape, the count of open positions at any moment, the exposure profile, and how the tester behaves when market direction reverses.

This post is for anyone running a parameter sweep in TradingTune who has noticed that pyramiding moves the tester’s output more than expected, and who wants a repeatable way to document why. Three things matter: pyramiding changes exposure, not just entry count; a sweep across pyramiding values needs the same walk-forward discipline as any other parameter; and every run needs a note tying a setting to what you actually observed, not just a memory of “it looked better.”

Setting Up a Pyramiding Sweep: Parameters and Walk-Forward Splits

A parameter sweep is a systematic run of the same strategy logic across a range of input values, one axis at a time or in combination, so you can see how the output responds to each setting rather than judging a single lucky run. When I set up a pyramiding study, I hold the entry and exit logic fixed and sweep three inputs together: the pyramiding count itself (the maximum number of successive entries the strategy may hold open in one direction), the position size per entry, and the spacing rule that decides how far price must move before another entry is allowed. I typically move the pyramiding count from 1 to 5, position size in steps of 5 to 10 percent of the base allocation, and spacing across a lookback of 20 to 60 bars between adds.

Walk-forward testing splits the historical data into sequential in-sample and out-of-sample windows: you tune on an early slice, then check whether the tuned setting still behaves sensibly on the next slice it has never seen, and roll the window forward. I use windows of roughly 3 to 6 months for the in-sample side and a similar or shorter out-of-sample slice, repeated across the full history so a single lucky segment cannot carry the whole conclusion. Overfitting is what happens when a setting is tuned so tightly to one window’s noise that it stops describing anything general.

The reasoning matters as much as the mechanics. Sweeping pyramiding in isolation hides the real driver: a high pyramiding count paired with tight spacing can pack several entries into the same short-term move, which changes the equity curve’s texture in a way that has nothing to do with the entry logic being any better. Testing pyramiding without also varying spacing risks mistaking a spacing artifact for a pyramiding effect, exactly the kind of hidden assumption that backtesting is supposed to expose.

TradingTune for Chrome

Stop tuning your strategy's inputs by hand.

Add to Chrome, it's free

Free tier, no API keys. A free account is required to run. Not affiliated with TradingView, Inc.

What Changes Across the Pyramiding Range

At the low end of the range, pyramiding at 1 or 2, the equity curve stays close to what a single-entry version of the same strategy would produce: fewer simultaneous positions, a cleaner correspondence between each trade and each equity step, and an exposure profile that is easy to reason about because you always know roughly how much of the account is committed at once.

Moving into the middle of the range, a pyramiding count of 3 to 4, the curve starts to smooth out during trending stretches, since each add arrives on top of an already favorable move, but it also grows a fatter tail during reversals, because more capital sits stacked in the same direction right when the market turns. The count of simultaneous open positions climbs, and so does the sensitivity of the whole equity curve to the exact bar where a reversal begins. A reversal that arrives while the setup is mid-sequence leaves the strategy stacked against the new direction.

At the high end, 5 or more entries, the pattern changes in kind rather than degree. With spacing left tight, the strategy is fully loaded well before a genuine trend confirms itself, so a whipsaw period produces a cluster of adds that all reverse together instead of one contained pullback. That clustering is a structural property of the setting, not a one-off unlucky sequence, and it is exactly the behavior a note should capture the moment you see it.

Illustrative Pyramiding Sweep Data

The following table is hypothetical, the founder’s own Smart Momentum Grid, historical and illustrative only.

Parameter Range Step Qualitative note
Pyramiding count 1 to 5 1 curve smooths in trends, thickens tail in reversals
Entry spacing 20 to 60 bars 10 wider spacing delays clustering of adds
Position size per add 5 to 20 percent 5 larger adds widen the exposure swing
Walk-forward window 3 to 6 months 1 month shorter windows show more setting instability
Trend-filter lookback 50 to 200 bars 25 longer lookback reduces false pyramiding triggers

Reading the rows in order, the pyramiding count row sits at the center of the sweep: it confirms qualitatively what the previous section described, that entries stacked in a trend and entries stacked into a reversal each carry a different signature, and that the smoothing effect at the low end is not free, it is a trade of one texture for another. The spacing and position-size rows have to be read alongside it, not separately, because a pyramiding count without knowing the spacing and size that produced it tells you almost nothing about why the curve looked the way it did.

The two rows I would probe further in a real sweep are the walk-forward window and the trend-filter lookback, because both interact with how quickly the setup notices a change in market character. A short walk-forward window paired with a high pyramiding count is the combination most likely to produce a setting that looks strong on one slice and falls apart on the next, since the window is too short to contain more than one kind of market regime. A longer trend-filter lookback changes how often the pyramiding logic even gets a chance to fire, which shifts the whole picture again.

When a Pyramiding Setting Looks Good In-Sample and Fails Out-of-Sample

When I ran a pyramiding sweep on the Smart Momentum Grid across a single eighteen-month in-sample window, a pyramiding count of 4 combined with tight 20-bar spacing produced the smoothest equity curve of the whole sweep. It looked like the standout setting: fewer sharp pullbacks, a steadier climb, adds arriving right as the trend extended. The instinct was to treat that as the answer and move on to the next parameter.

Rolling the same setting into the next out-of-sample window, a period with two sharp reversals inside a few weeks, told a different story. The tight spacing meant the setup had already stacked most of its four entries before either reversal confirmed, so both reversals hit a fully loaded position instead of a partially loaded one. The in-sample window I had tuned on simply had not contained a fast reversal, so the setting had never been tested against the exact condition that would expose it. What fooled me was treating one smooth window as proof of robustness rather than as one favorable draw from a longer history.

A second, smaller version of the same trap showed up with position size: sizing each add at the top of its range produced smooth in-sample results for the same reason, more capital riding the same favorable trend, and the same fragility the moment the trend inside the out-of-sample window changed character. The lesson in both cases was the same: a setting only ever evaluated against the type of market it was tuned on is not validated, it is just repeated.

Applying a Validation Routine to Your Own Pyramiding Sweep

My take is that any pyramiding value should be evaluated across at least two out-of-sample windows that visibly differ in character, one trending and one choppy, before it earns a place on a shortlist, because a single window can only tell you how the setting behaves in one kind of market. I prefer to widen entry spacing before raising the pyramiding count, since spacing controls how much of the position gets committed before a reversal has a chance to show itself, and that ordering keeps the exposure profile legible instead of stacking two unknowns at once.

The concrete next step for your own sweep: fix everything except pyramiding and spacing, run the pair across at least three walk-forward windows spanning different market conditions, and log the qualitative shape of the equity curve for each window next to the setting that produced it, not just a single summary line. Then widen the pyramiding range gradually, one step at a time, and check whether the smoothing you see at each step survives into the next out-of-sample window or evaporates there. If a setting only looks good on one window, treat that as information about the window, not a discovery about the setting.

The Habit That Keeps Pyramiding Notes Honest

The method question a pyramiding sweep answers is not how many entries to allow, it is how adding to a position changes what the tester’s output actually represents. Every step of the range trades one kind of exposure for another: smoother in-sample curves at the cost of thicker tails when the market turns, and a fully loaded position exactly when spacing is too tight for a reversal to show itself before the last entry lands.

The single habit worth keeping is writing down, at the moment you see a result, which window produced it and what the market was doing during that window, before moving to the next setting in the sweep. A pyramiding count without that context is just a number that happened to look good once. With it, the same number becomes a data point you can actually compare against the next run, which is the entire point of running a sweep in the first place. A note does not need to be long: “Pyramiding 4, spacing 20, in-sample Jan-Jul 2023 (trending): smooth curve, fully loaded by third entry. Out-of-sample Aug-Oct 2023 (two reversals): both reversals hit loaded position, thicker tail.” That one line ties the setting to the market it faced, and the next time you see a similar market, you know which notes to pull.

Pine v6
//@version=6
indicator("Pyramiding Sweep Helper", overlay = true)
pyramidCount = input.int(3, "Pyramiding count", minval = 1, maxval = 5)
spacingBars = input.int(30, "Entry spacing (bars)", minval = 10, maxval = 60)
fastMA = ta.ema(close, 20)
slowMA = ta.ema(close, 50)
setup = ta.crossover(fastMA, slowMA)
plot(fastMA, title = "Fast EMA")
plot(slowMA, title = "Slow EMA")
plotshape(setup, title = "Setup", style = shape.triangleup, location = location.belowbar)

Sources

TradingTune for Chrome

Stop tuning your strategy's inputs by hand.

TradingTune runs systematic parameter searches on your own TradingView strategy, right inside the chart page. You keep the strategy, you read the results.

Free tier, no API keys. A free account is required to run. Not affiliated with TradingView, Inc.

Share this post