STRATEGY LIBRARY

Composite indicators: building one condition from several parts

Contents
If you are coming from a platform that ships named composite indicators — a breakout flag, a surge flag, a squeeze flag — they are not missing here. They are spelled out. Writing them from the raw inputs is longer, and it means you can see exactly what the condition claims.

1. Named indicators, written out

What it is called elsewhereHow to write it here
MA breakoutPrice > Sma(60) and PriceN(1) <= Sma(60, 1)
MA supportPrice > Sma(300) and LowestPrice(60) >= Sma(300) * 0.998
Open breakoutPrice > OpenPrice and PriceN(1) <= OpenPrice
Price spikePrice > PriceN(10) * 1.01
Turnover surgeTradeAmount > AvgTradeAmount(300) * 3
Buy volume surgeBuyVol > MaxBuyVol(300) * 0.8
Bid pressureTotalBidSize > TotalAskSize * 1.5
Spread gap(Ask1 - Bid1) / Price > 0.002
Volatility expansionVolatility(60) > Volatility(600) * 2
Near session highPrice / HighestPrice(300) - 1 > -0.005
Off session lowPrice / LowestPrice(300) - 1 > 0.01
Strength vs its own averageStrength > AvgStrength(300) * 1.2
Net buying todayDayBuyAmt - DaySellAmt > 0
Above the heaviest traded pricePrice > MaxBuyPrice
Value N ticks agoany column name plus N(n)Ask3N(5), TotalAskSizeN(5)
Every row above parses and passes the name check, so you can paste one straight into a condition.

2. Why write it out instead of using a flag

The numbers are yours. A surge is three times the recent average because you chose three, and you can change it to two and see what happens. A named flag hides that decision inside someone else's definition — and the definitions differ between platforms, which is how the same strategy produces different results on two systems without anyone having changed a rule. If you cannot see the threshold, you cannot test its sensitivity, and testing sensitivity is most of what separates a real edge from a fitted one.

3. Two patterns worth noticing

The crossing pattern. Price > X and PriceN(1) <= XN(1) turns any state into an event. It is the difference between "price is above the average" and "price just crossed the average", and it changes the trade count by an order of magnitude — see moving average crossover strategy with a real crossing test. The relative pattern. Comparing a value against that symbol's *own* recent average, rather than against an absolute number, is what makes a threshold portable between a $3 stock and a $300 one. Almost every row above that contains Avg is doing this.

4. Combining them without overfitting

Each condition you add narrows the population. Two composites joined with and is usually fine; five is usually a fitted rule wearing a strategy's clothes. The check is trade count. If adding a composite improves the average and cuts trades by 90%, you have not improved anything — see eleven conditions, four trades a month.

5. Where to look up the parts

Every column and window function used above is listed in the day trading indicators and factors reference, with what each one actually contains and when it updates. That matters more than it sounds: a factor computed on a bar that has not closed yet is a different number from the same factor after the close, and mixing them up is the most common way a backtest sees the future.

Educational template for research and backtesting. Not investment advice and not a signal service.

Related reading

← All strategy library

Originally published by TraderWe on August 13, 2026. You may quote and link to this page. Republishing the full text without a link back to the original is not permitted.

3 replies

DataDrivenDee· Aug 2026 ago
Genuinely like that the parts are visible, but how would we actually test whether a hand-written breakout condition behaves the same as a packaged one from another platform? Seems like you'd need to log both side by side over the same session before trusting either.
MLcurious· Aug 2026 ago
ok so the thing I keep tripping on, when you combine like four of these into one condition, does each part need its own lookback window or can they share? I assumed shorter is always more reactive but I'm probably confusing myself here lol
BacktestBetty· Aug 2026 ago
Useful table, one caution though. 1) The moment you can turn 3 into 2 you will, and you'll keep turning it until the numbers look pretty on whatever window you tested. 2) Pick the multiplier before you look at results, then only check it holds across a couple of different periods. 3) The composite ones worry me more — a breakout AND a turnover surge AND bid pressure is three knobs, and three knobs will fit anything if you twist long enough. Fewer conditions, tested honestly, beats a beautiful stack that only worked once.
Sign in to reply →