VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Indicators and signals

VIDYA indicator: adaptive smoothing, settings, and an NQ trend test

VIDYA is an exponential moving average whose speed rises with recent volatility and falls when price goes sideways. It lags less in trends and whips less in ranges than a fixed EMA by its mechanism, but it stays a trend-following average, and an NQ daily test shows the usual trend-following shape rather than proof that it beats EMA.

By · Published · updated · Editorial policy

Contents
  1. What is the VIDYA indicator and does an adaptive average beat a fixed one?
  2. How does VIDYA adapt its smoothing: CMO or standard deviation?
  3. How do you set VIDYA parameters?
  4. How does VIDYA differ from EMA and KAMA?
  5. What does a trend-following test of an adaptive average show on NQ?
  6. How sensitive is the result to the VIDYA settings?
  7. Frequently asked questions
  8. References

What is the VIDYA indicator and does an adaptive average beat a fixed one?

The VIDYA indicator (variable index dynamic average) is an exponential moving average that speeds up when price trends and slows down when price goes sideways. By its mechanism it lags less in a trend and whips less in a range than a fixed EMA. It is still a trend-following average, and an NQ daily test shows the usual trend-following shape, not proof that VIDYA beats EMA.

VIDYA is an exponential moving average whose smoothing constant is multiplied, bar by bar, by a volatility index that measures how strongly price has moved in one direction recently. A fixed EMA is a car with the speed locked: it follows the road at one pace whether the road is open or crowded. VIDYA presses the accelerator on an open highway and brakes in traffic. The VIDYA indicator page gives the full definition; this article is about what the adaptation does, how to set it, and what a trend test of an adaptive average on NQ daily bars looks like.

Adaptation changes how fast the line follows price, not what kind of tool it is. VIDYA is used the same way as any moving average, as a price filter, a crossover line or a slope reading, and it shares the strengths and the weaknesses of that family. A guide to which technical analysis tools and indicators you can test places moving averages in that family. The test in the fifth section shows the shape every trend-following average produces: few trades, long time in the market and a drawdown that is a large part of the net profit.

How does VIDYA adapt its smoothing: CMO or standard deviation?

VIDYA multiplies a fixed smoothing constant by a volatility index that sits between 0 and 1, so the line moves fast when price goes one way and almost freezes when price goes nowhere. The smoothing constant is the share of each new close that enters the average: a constant of 0.1 means the average moves one tenth of the way from its last value toward the new close on every bar. The one formula in this article is the VIDYA update:

VIDYA today = α × VI × close + (1 − α × VI) × VIDYA yesterday

Here α (alpha) is the fixed smoothing constant of an ordinary EMA of the chosen length, VI is the volatility index for the current bar, close is the current close, and VIDYA yesterday is the line's previous value. When VI is 1 the line behaves exactly like the EMA of that length. When VI is 0 the line does not move at all.

Two drivers of VI are in common use:

  • Chande Momentum Oscillator (CMO). The Chande Momentum Oscillator is a momentum reading that takes the sum of up-closes minus the sum of down-closes over a set length and divides it by the sum of both. The result runs from −1 (every close lower) to +1 (every close higher). VIDYA uses its absolute value, so one-way movement in either direction gives a VI near 1 and a choppy, two-way market gives a VI near 0. A CMO pinned near ±1 is the same condition as a momentum indicator stuck at an extreme; the article on what it means when KD or RSI stays stuck overbought covers how to read and test that state.
  • Standard-deviation ratio. Standard deviation is a measure of how far closes typically sit from their recent average; the standard deviation indicator page covers how it is calculated and read on a chart. This form divides the standard deviation over a short length by a longer reference standard deviation. The index sits near 1 when volatility is normal, drops when the market goes quiet and rises above 1 in a volatility burst, which then makes the line faster than its base EMA. This form reacts to the size of movement; the CMO form reacts to its direction.

Hypothetical example

Take an EMA length of 20, so α is about 0.095. In a steady uptrend the CMO reads 0.8, and the effective smoothing is 0.095 × 0.8 ≈ 0.076: the line moves about three quarters as fast as a plain 20-bar EMA. In a sideways week the CMO reads 0.1, and the effective smoothing falls to about 0.0095, roughly the speed of a 200-bar EMA. The same indicator has switched from a fast line to a very slow one without any change of settings.

VIDYA is fast in trends and flat in ranges: during a trend the volatility index is near 1 and the VIDYA line hugs price, during a range the index is near 0 and the line goes nearly flat Fast in trends, flat in ranges The volatility index sets its speed Trend Range Price VIDYA VI ≈ 1 VI ≈ 0 One line, two speeds. So: expect late restarts after ranges.
The volatility index scales the smoothing constant, so one line is fast in the trend and nearly flat in the range.

How do you set VIDYA parameters?

Two numbers matter, the CMO (or standard-deviation) length and the EMA length, and the practical choice is to test a small grid of neighbouring values with costs included rather than trust a single textbook pair. A widely used default pairs a CMO length of 9 with an EMA length of 12. Treat that pair as the centre of a grid, not as an answer.

SettingShorter valueLonger value
CMO length (the volatility index)Index swings quickly between 0 and 1; the line changes speed every few barsIndex moves slowly; the line keeps one speed for longer stretches
EMA length (the base speed)Line hugs price in trends; more crossings in ranges even with the index damping themLine sits further from price; fewer crossings, later entries and exits
Both shortFast, many crossings, highest trade count and highest cost drag
Both longSlow, few crossings, late turns, large give-backs at trend ends
Shorter VIDYA lengths give more crossings: on the same illustrative price, short lengths cross price 14 times, the 9 and 12 default 6 times, and long lengths 2 times Short lengths, more crossings Same price, three settings Price VIDYA Short 14 crossings 9 / 12 6 crossings Long 2 crossings Every crossing is a cost. So: test the grid with costs on.
The two lengths together decide how often price crosses the line, and every crossing is a trade with a cost.

A workable order of steps:

  1. Pick the bar size first. A length of 12 means twelve daily bars on a daily chart and twelve minutes on a 1-minute chart, which are very different amounts of price information. What testing shows about the best indicator for intraday trading applies here: intraday bars carry more noise, so the same lengths produce more crossings and more cost.
  2. Define the rule exactly. Close above the line enters long, close below enters short, or a crossover of two VIDYA lines. Write the entry and the exit before you look at any result.
  3. Set commission and slippage per trade before the first run. A fast setting that wins before costs often loses after them, because its edge per trade is small and its trade count is high.
  4. Run a grid around the default. For example CMO lengths from 5 to 20 and EMA lengths from 8 to 40 in steps. Read the whole grid, not the best cell; the last section explains why.

How does VIDYA differ from EMA and KAMA?

EMA uses one fixed speed, KAMA scales its speed between a fixed fast limit and a fixed slow limit, and VIDYA scales its speed by a volatility index with no lower limit, which is why VIDYA can go nearly flat in a range while the other two keep drifting toward price. The moving averages page covers the EMA family; the KAMA indicator page covers the efficiency-adaptive line in detail.

KAMA (Kaufman's adaptive moving average) is an adaptive average whose speed is set by an efficiency ratio. The efficiency ratio is the net price change over a length divided by the sum of the absolute bar-to-bar changes over the same length: a straight line gives 1, a market that ends where it began gives 0. KAMA maps that ratio onto a speed between a fast EMA constant and a slow EMA constant and squares the result. Because the slow limit is fixed, KAMA never stops moving. VIDYA has no such floor: when the CMO reads 0, the line holds its value.

AverageWhat drives the speedLowest possible speedIn a rangeAt a breakout
EMANothing; one fixed constantThe fixed constantDrifts toward price at its one pace; crossings continueFollows at its one pace; lag depends only on length
KAMAEfficiency ratio (net move ÷ sum of bar moves)The slow-limit constant, squared; never zeroSlows a lot but keeps drifting toward priceSpeeds up toward the fast limit as the ratio rises
VIDYAVolatility index (CMO or standard-deviation ratio)Zero when the index is zeroCan go nearly flat; price crosses a line that does not chase itSpeeds up toward the base EMA speed as the index rises
Only VIDYA can stop moving: in a range the EMA keeps chasing price at a fixed speed, KAMA slows but never reaches zero speed, and VIDYA can go flat because its lowest speed is zero Only VIDYA can stop moving Grey zigzag is price In a range Lowest speed EMA Fixed KAMA Never zero VIDYA Zero Flat in ranges, slow to restart. So: check entries after breakouts.
Fixed speed against two kinds of adaptive speed: only VIDYA can stop moving when the market stops moving.

The flat line in a range has two faces. It reduces crossings that are only noise, which is the point of the design. It also means that when a range ends with a sharp move, the line starts far from price, and the first bars of the new trend go to waiting for the index to rise. Every smoothing method moves lag somewhere: VIDYA trades fewer false crossings in the range for a later start at the breakout that ends the range.

What does a trend-following test of an adaptive average show on NQ?

One NQ daily run of an adaptive-average rule shows the typical trend-following shape: few trades, a very high time in market, and a drawdown that is more than half of the net profit. The run used an Efficiency-Adaptive Moving Average rule as a stand-in, a rule built from standard indicators, and not VIDYA itself. The result is one candidate the search kept out of about a thousand it tried, chosen for its return against its drawdown; the exact count is in the source box. Picking the kept one after the fact flatters its numbers, because the best of many tries always carries some luck along with any real pattern. Bailey, Borwein, López de Prado and Zhu (2014) show how large that flattery becomes as the number of tries grows, and Sullivan, Timmermann and White (1999) found the same effect when they re-examined technical trading rules against the full set of rules that had been searched.

Five steps for testing an adaptive-average rule: NQ daily bars, rule plus costs, try about a thousand settings, keep the best, check neighbours; the kept setting is the far tail of all tries, so its result carries luck, which step 5 has to check Step 4 flatters the result Testing an adaptive-average rule 1 2 3 4 5 NQ daily bars Rule + costs Try a thousand Keep the best Check neighbours A thousand tries Kept Kept = part luck Keeping the best adds luck. So: never skip step 5.
The order of steps for testing an adaptive-average rule. The fourth step is where the kept result is flattered, which is why the fifth step exists.

What the run tested: NQ (E-mini Nasdaq-100 futures) daily bars from 2019-01-02 to 2025-06-30, long and short, one contract, with the adaptive-average rule as the only entry and exit, no stop, no target and no filters. AlphaPrime (Valynox) charged $20 commission and $10 slippage inside each candidate evaluation with next-bar execution, which is the standard setup described on the backtesting page, so the ranking the search produced was already net of costs.

Source: AlphaPrime product engine (CPU), run 2026-10-31. NQ daily bars, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $10 slippage per trade.

NumberResult
Net profit (closed trades)$193,250
Max drawdown$116,210
Trades59
Win rate64.41%
Profit factor1.751
Average trade$3,275.42
Time in market92.15%

Read the numbers together rather than one at a time. Time in market is the share of bars on which the strategy held a position; at 92.15% the rule was almost always long or short, which is what an average with no filters does: it is on one side of price nearly all the time. Fifty-nine trades in about six and a half years is fewer than one a month, so the average trade of $3,275.42 rests on a small sample, and a few trades more or fewer could move it a long way. The max drawdown of $116,210 against a net profit of $193,250 means the account gave back more than half of everything it made at some point along the way. That ratio is the signature of trend following on a single market: the profit comes from a few long moves, and the give-backs come from every range in between.

Look at the shape: long climbs during the trending stretches, deep give-backs during the ranges, and a line that is almost never flat because the rule is almost always in a position.
Look at the shape: long climbs during the trending stretches, deep give-backs during the ranges, and a line that is almost never flat because the rule is almost always in a position. NQ · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest
Read the max drawdown next to the net profit, and the trade count next to the average trade, before reading anything else.
Read the max drawdown next to the net profit, and the trade count next to the average trade, before reading anything else. NQ · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest

None of this says the rule or the indicator earned that money, and none of it says a reader can expect it. It is a record of one past run of one kept candidate. What it does show is the shape to expect from any adaptive-average rule used alone on daily index futures, including a VIDYA rule: the adaptation changes the number of crossings and the lag, but the equity curve keeps the trend-following profile.

How sensitive is the result to the VIDYA settings?

Judge an adaptive-average rule by how its neighbouring settings behave, not by the best single setting: a broad plateau of similar results points to a repeatable pattern, and a single spike points to noise that one setting happened to fit. A parameter plateau is a region of the settings grid in which neighbouring values produce results of the same general size and sign. Pardo (2008) makes this the centre of strategy optimization: the goal is a robust region, not a peak.

Trust a plateau, not a spike: in the left settings grid most cells around the kept setting are profitable, in the right grid only the kept setting is profitable and its neighbours are flat Trust a plateau, not a spike Filled = profit, gold = kept setting Plateau Spike A spike is one lucky setting. So: require most neighbours positive.
A plateau of neighbouring settings against a single spike. The spike is the shape of a setting that fitted one stretch of history.

The reason is the one from the previous section. The search above kept one cell of its grid. The box tells you how that cell did; it does not tell you how the cells around it did. If the CMO length one step shorter and one step longer, and the EMA length one step shorter and one step longer, all show a result of the same general size, the kept cell is representative of a region and the flattery from picking it is small. If the four neighbours are flat or negative, the kept cell is a spike, and most of its result is the luck of selection.

A practical way to read the grid:

  1. Lay the grid out as a table with the CMO length across the top and the EMA length down the side, each cell holding the net profit after costs or the profit factor.
  2. Mark the kept cell and look at the eight cells around it. Count how many are positive and how many are within roughly half of the kept cell's value.
  3. Decide the pass rule before you look. For example: at least six of eight neighbours positive, and at least four within half of the kept value. Write it down first.
  4. Confirm the plateau out of sample. Run the kept setting and two neighbours on data the grid never touched and check that the ranking among them is not reversed.

Brock, Lakonishok and LeBaron (1992) found that simple moving-average rules showed signal on almost a century of Dow Jones index data, and they also noted that their tests did not subtract trading costs. That pairing is the lesson for an adaptive average too: whether the line is fixed or adaptive, the question that decides the rule is how a region of settings behaves after costs, on data that did not choose them.

The next move is concrete. Take your own NQ daily bars, a VIDYA close-above/close-below rule, commission and slippage set to your broker's figures, and a grid of CMO lengths from 5 to 20 against EMA lengths from 8 to 40. Before you run it, write down the plateau rule you will accept. Then read the whole grid, find the kept cell's eight neighbours, and see whether the picture looks like the left panel of the figure or the right one.

Frequently asked questions

What is the VIDYA indicator?

VIDYA, the variable index dynamic average, is an exponential moving average whose smoothing speed changes bar by bar. A volatility index between 0 and 1, usually the absolute value of the Chande Momentum Oscillator, multiplies the fixed smoothing constant of an EMA. When price moves in one direction the index is near 1 and the line follows price closely; when price goes sideways the index drops and the line nearly stops moving.

Is VIDYA better than EMA?

VIDYA lags less in trends and crosses price less often in ranges than an EMA of the same base length, because its speed adapts. That is a property of its mechanism, not a measured result on any market. Both are trend-following averages, and a test of either on daily index futures shows few trades, a high time in market and a deep drawdown relative to profit. Whether a VIDYA rule beats an EMA rule on your market and bar size, after costs, is a question for a grid test on your own data.

How does VIDYA differ from KAMA?

Both are adaptive averages, but they adapt differently. KAMA uses an efficiency ratio, the net move divided by the sum of bar moves, and maps it onto a speed between a fixed fast limit and a fixed slow limit, so it never stops moving. VIDYA uses a volatility index, usually from the Chande Momentum Oscillator, with no lower limit, so the line can hold still when the index reads zero. In a range VIDYA tends to flatten while KAMA keeps drifting toward price.

What are typical VIDYA settings?

A widely used default pairs a CMO length of 9 with an EMA length of 12. Shorter lengths make the line faster and produce more price crossings and more cost; longer lengths make it slower with later turns and larger give-backs at trend ends. Test a grid of neighbouring values around the default with commission and slippage included, and prefer a setting that sits inside a region of similar results rather than the single best cell.

References

  • Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.
  • Sullivan, R., Timmermann, A., & White, H. (1999). Data-Snooping, Technical Trading Rule Performance, and the Bootstrap. The Journal of Finance, 54(5), 1647–1691.
  • Pardo, R. (2008). The Evaluation and Optimization of Trading Strategies (2nd ed.). John Wiley & Sons.
  • Brock, W., Lakonishok, J., & LeBaron, B. (1992). Simple Technical Trading Rules and the Stochastic Properties of Stock Returns. The Journal of Finance, 47(5), 1731–1764.