Problem and output

The inputs are an OHLCV series and indicator parameters; the outputs are indicator values, signals and the conditions under which those signals fail. The aim is to reproduce the arithmetic by hand and judge whether different indicators add independent information, not to find a winning combination.

Inputs and data requirements

Adjusted close, high, low and volume at a fixed frequency, long enough for the parameters; the default MACD setting of 12/26/9 needs at least 34 bars (26 to form the first MACD value, then 9 MACD values to form the signal line, with the first one overlapping). Volume is not an input to the four indicators here, but it can test whether a signal comes with abnormal turnover. The example uses 10 hypothetical trading days: closes 20, 21, 22, 21, 23, 24, 23, 25, 26, 25; highs 20.5, 21.5, 22.5, 21.5, 23.5, 24.5, 23.5, 25.5, 26.5, 25.5; lows 19.5, 20.5, 21.5, 20.5, 22.5, 23.5, 22.5, 24.5, 25.5, 24.5.

Assumptions

Closes are in trading-day order; SMA and EMA use closes; the stochastic window is 5 days; for hand calculation the MACD example uses 3/6/3 rather than the 12/26/9 default; values are rounded to two decimals; EMAs use the first SMA as seed. The EMA weights recent prices more heavily, so it responds to new price changes faster than an SMA of the same length; an SMA's average lag is about (n-1)/2 bars.

The SMA convention used here — the average price over a set period, read as a direction of trend, smoother at longer windows but with larger lag — follows the Fidelity indicator pages [1].

Steps

  1. SMA5: 21.4 on day 5 and 24.6 on day 10.
  2. EMA5: seed with the day-5 SMA of 21.4, α = 2/(5+1) = 0.3333, and iterate to 24.48 on day 10.
  3. MACD (3/6/3): EMA3 = 25.00, EMA6 = 24.17, MACD line = 0.83; the signal line, a 3-day EMA of MACD seeded at the day-6 value of 1.1667, is 0.96.
  4. Stochastic: %K = (25-22.5)/(26.5-22.5)×100 = 62.5; %D is the average of the last three %K values (90.0, 87.5, 62.5), equal to 80.0.
  5. Record the signals: price is above a rising average, but MACD is below its signal line and %K is below %D.

The default 12/26/9 setting (a 12-period EMA minus a 26-period EMA, with a 9-period EMA of MACD as the signal line) and the warning that MACD whipsaws back and forth inside a trading range come from the Fidelity MACD page [2].

Scope note: the stochastic oscillator in this article is computed on the fast convention — %K is not smoothed, and %D is the simple three-day average of %K. The registered source page describes the slow stochastic, which smooths %K once more, so the two must not be conflated. Separately, the statements that "the average lag of an SMA is about (n−1)/2 bars" and that "12/26/9 needs at least 26+9−1=34 bars" are arithmetic consequences of the indicator definitions, like the rest of the formulas here: a methodological derivation, not wording from the registered source.

Figure

INV-014: three-stage chain SMA and EMA: Same price series; Stochastic: %K and %D; Record conflicts: Do not force a story when signals disagree START SMA and EMA Same price series MECHANISM Stochastic %K and %D CHECK Record conflicts Do not force a story when signals disagree
Figure 1: a three-stage chain in INV-014 — SMA and EMA → Stochastic → Record conflicts. The three stages form a judgment chain, not the only path; labels come from the article text and carry no statistics. The sample is the article argument and units are marked in the text.

Interpreting the result

One data set produces mixed signals: the trend is up while momentum is weakening. In the example EMA5 sits below SMA5 because the latest price fell from 26 to 25 and the EMA reacts faster; if prices keep rising, the relationship reverses. Indicators are transformations of price, not new information; MACD and the moving average share the same closes, and the stochastic shares the same highs and lows. 62.5 and 80.0 are positions, not probabilities. The 3/6/3 settings and the 5-day window are chosen for hand calculation; 12/26/9 or 14 days would give different values. When signals conflict, check the window and the data before adding more indicators.

The stochastic oscillator measures where the close sits inside the high-low range of a set number of periods, runs from 0 to 100, is conventionally read against 80 and 20 as overbought and oversold, and is described as most effective in wide ranges or slow trends — the Fidelity stochastic page [3].

Failure conditions

  • data are unadjusted, or too few bars make early values incomparable
  • parameters are optimised repeatedly until the chart looks good
  • different software defaults are treated as the same indicator
  • whipsaws in ranging markets, where MACD crosses back and forth
  • 80 and 20 are treated as objective thresholds
  • indicator values are fed into other indicators without checking definitions and windows
  • costs, slippage and taxes are ignored
  • overlapping windows are used for significance tests, which overstates the sample

Verification

Change windows and parameters and check whether signals survive; measure hit rate and payoff out of sample; compare with a simple benchmark; report the full parameter grid, not only the best result; report signal counts, hit rates and maximum drawdown for both default and alternative settings.

Reproduction

SMA_n = ΣC/n; EMA_t = EMA_{t-1} + α(C_t - EMA_{t-1}), with α = 2/(n+1); MACD = EMA_12 - EMA_26, signal = 9-day EMA of MACD; %K = (C - L_n)/(H_n - L_n) × 100, %D = SMA_3(%K). One window and adjustment must run through the whole chart.

Related

  • Required prerequisite: Trend, Price and Volume (INV-013).
  • Related reading: Trend, Price and Volume (INV-013), Building an Investment Research Process (INV-005), Covariance and Correlation (RES-010).

Figures in plain language

The three figures below check the mechanism, boundary and comparison in this article; labels come from its own sections, not new data.

Common Technical Indicators: Calculation and Limits: mechanism chain Common Technical Indicators: Calculation and Limits — three-step structure: problem, mechanism, judgment. Labels come from the article's sections, not new data. Common Technical Indicators: Calculation and Limits: mechanism chain Labels come from the article's sections; all three steps matter. Problem Recompute SMA, EMA, MACD and… Recompute SMA, EMA, MACD and the stochastic oscillator from the same hypothe… Reproduction Reproduction: SMA_n = ΣC/n… Reproduction: SMA_n = ΣC/n; EMA_t = EMA_{t-1 } + α(C_t - EMA_{t-1})… Inputs and data requirements Adjusted close, high, low and… Adjusted close, high, low and volume at a fixed frequency, long enough… Reading order: test the problem, then the mechanism, then whether the judgment overreaches. If a middle step lacks evidence, later conclusions are hypotheses, not facts. Structural illustration, not a new data chart; sample is the article's own argument.
Figure 2: Common Technical Indicators: Calculation and Limits — mechanism chain: problem, mechanism, judgment. Sample: the article's own argument; units as stated in the text.
Common Technical Indicators: Calculation and Limits: boundary Separates conditions where the claim holds from those where it fails; a local example is not universal. Common Technical Indicators: Calculation and Limits: when does it hold? Check the conditions before the conclusion If conditions, definitions or samples change, recompute the conclusion Holds data are unadjusted, or too few bars make early values incomparable parameters are optimised repeatedly until… Fails / rewrite The inputs are an OHLCV series and indicator parameters; the outputs are indicator values, signals… Boundary illustration; sample is the article's own argument; units as stated in the text.
Figure 3: Common Technical Indicators: Calculation and Limits — boundary: when the claim holds, and when it fails. Sample: the article's own argument; units as stated in the text.
Common Technical Indicators: Calculation and Limits: object, conditions and common mistakes Three rows compare the concept, its conditions and common mistakes; comparison is not equivalence and does not replace a definition. Common Technical Indicators: Calculation and Limits: object, conditions and common mistakes at a glance This article Commonly confused Object Recompute SMA, EMA, MACD and the… Adjacent concepts / common claims Conditions data are unadjusted, or too few bars make… The inputs are an OHLCV series and indicator parameters; the… Check Define first, then compare; never judge labels only Correlation is not causation; a local case is not universal Comparison illustration; sample is the article's own argument; units as stated in the text.
Figure 4: Common Technical Indicators: Calculation and Limits — comparison of object, conditions and common mistakes. Sample: the article's own argument; units as stated in the text.

Exercises

  1. Calculation. With the example, how far apart are SMA5 and EMA5 on day 10?
  2. Judgement. MACD is 0.83 and the signal line is 0.96. What does the common rule say?
  3. Concept. Why is a stochastic reading of 80 not an 80% chance of a decline?
Suggested answers
  1. 24.60 - 24.48 = 0.12.
  2. A bearish crossover; it is a rule, not a forecast.
  3. 80 is a position within the window's range, contains no out-of-sample frequency, and is therefore not a probability.

Sources

  1. Fidelity Investments. “Technical Indicator Guide: Simple Moving Average (SMA).” (来源条款只允许指向其域名首页的外链,故此处不设超链接;URL 记录在来源元数据中) (accessed 2026-10-30)
  2. Fidelity Investments. “Technical Indicator Guide: MACD.” (来源条款只允许指向其域名首页的外链,故此处不设超链接;URL 记录在来源元数据中) (accessed 2026-10-30)
  3. Fidelity Investments. “Technical Indicator Guide: Slow Stochastic.” (来源条款只允许指向其域名首页的外链,故此处不设超链接;URL 记录在来源元数据中) (accessed 2026-10-30)

Worked demo

Read-through check: can you say three things?

No recitation needed. Tick each sentence below and see whether you can explain the mechanism, one worked example and one boundary in your own words.

Ticked 0 / 3

The numbers are teaching assumptions that show relationships, not forecasts or investment advice.

This article has passed the current publication gate. Factual, calculation and translation revisions update both language versions together.

Back to station