Level 3 — ProductionIndicators & Oscillators

Indicators & Oscillators

45 minutes60 marksprintable — key stays hidden on paper

Chapter: 3.4 Indicators & Oscillators Level: 3 — Production (from-scratch derivations, code-from-memory, explain-out-loud) Time limit: 45 minutes Total marks: 60

Instructions: Show all working. Where code is requested, pseudocode or Python is acceptable but formulas must be explicit. Round to 2 decimals unless stated.


Question 1 — EMA from scratch (10 marks)

(a) Derive the EMA smoothing multiplier kk for a period NN and state the recursive update formula. (3)

(b) Given the closing prices [10, 11, 12, 13, 14], seed the EMA with the first value (EMA1=10EMA_1 = 10) and compute EMA2EMA5EMA_2 \ldots EMA_5 for a 3-period EMA. Show each step. (5)

(c) Explain out loud (2–3 sentences) why EMA reacts faster to price changes than an SMA of the same period. (2)


Question 2 — RSI derivation (12 marks)

(a) Write the RSI formula in terms of average gain and average loss, and the RSRS ratio. (3)

(b) Given these 7 consecutive daily closes [44, 44.5, 44.2, 45, 46, 45.5, 46.5], compute the 6-period RSI using simple averages of gains and losses over the 6 price changes. Show the gains/losses table. (6)

(c) State the standard overbought and oversold thresholds and explain what a bearish RSI divergence looks like. (3)


Question 3 — MACD code-from-memory (10 marks)

(a) From memory, write the three MACD component formulas (MACD line, signal line, histogram) using standard 12/26/9 parameters. (4)

(b) Write pseudocode for computing the MACD line and histogram given a price array and an ema(arr, n) helper. (4)

(c) Explain what a MACD histogram crossing from negative to positive tells a trader. (2)


Question 4 — Bollinger Bands & ATR (10 marks)

(a) Derive the upper and lower Bollinger Band formulas for a 20-period band at 2 standard deviations. (3)

(b) For prices [20, 22, 24, 22, 22] (treat as the full window, use population std), compute the middle band, standard deviation, and upper/lower bands at 2σ. (5)

(c) Define a "Bollinger squeeze" and state one indicator commonly paired to confirm the breakout direction. (2)


Question 5 — VWAP & Stochastic (10 marks)

(a) Write the VWAP formula and compute VWAP for these intraday bars (use typical price = (H+L+C)/3):

Bar High Low Close Volume
1 11 9 10 100
2 13 11 12 300
3 15 13 14 100

Show the cumulative TP×Vol and cumulative Vol. (6)

(b) Write the %K formula for the stochastic oscillator and compute %K given: current close = 47, lowest low = 40, highest high = 50 over the lookback. (2)

(c) Explain what %D is relative to %K. (2)


Question 6 — Explain out loud: ADX, OBV & indicator overload (8 marks)

(a) State what ADX measures and the conventional threshold that separates a trending from a non-trending market. (2)

(b) Describe how OBV is updated on an up-day vs a down-day. (3)

(c) Explain the concept of "indicator overload" and give one practical rule to avoid it. (3)

Answer keyMark scheme & solutions

Question 1 (10)

(a) Multiplier: k=2N+1k = \dfrac{2}{N+1}. (1) Recursion: EMAt=Ptk+EMAt1(1k)EMA_t = P_t \cdot k + EMA_{t-1}\cdot(1-k). (2)

(b) For N=3N=3: k=2/4=0.5k = 2/4 = 0.5. (1)

  • EMA1=10EMA_1 = 10 (seed)
  • EMA2=11(0.5)+10(0.5)=10.5EMA_2 = 11(0.5) + 10(0.5) = 10.5 (1)
  • EMA3=12(0.5)+10.5(0.5)=11.25EMA_3 = 12(0.5) + 10.5(0.5) = 11.25 (1)
  • EMA4=13(0.5)+11.25(0.5)=12.125EMA_4 = 13(0.5) + 11.25(0.5) = 12.125 (1)
  • EMA5=14(0.5)+12.125(0.5)=13.062513.06EMA_5 = 14(0.5) + 12.125(0.5) = 13.0625 \approx 13.06 (1)

(c) EMA weights recent prices more heavily via the multiplier kk, while SMA weights all NN values equally; older data never fully drops out but decays exponentially, so new prices shift the EMA immediately. (2)

Question 2 (12)

(a) RS=Avg GainAvg LossRS = \dfrac{\text{Avg Gain}}{\text{Avg Loss}}; RSI=1001001+RSRSI = 100 - \dfrac{100}{1+RS}. (3)

(b) Price changes (6): +0.5, −0.3, +0.8, +1.0, −0.5, +1.0 (2)

  • Gains: 0.5, 0.8, 1.0, 1.0 → sum = 3.3; Avg Gain = 3.3/6 = 0.55 (1)
  • Losses: 0.3, 0.5 → sum = 0.8; Avg Loss = 0.8/6 = 0.1333 (1)
  • RS=0.55/0.13333=4.125RS = 0.55/0.13333 = 4.125 (1)
  • RSI=100100/(1+4.125)=10019.512=80.49RSI = 100 - 100/(1+4.125) = 100 - 19.512 = 80.49 (1)

(c) Overbought 70\geq 70, oversold 30\leq 30. (1) Bearish divergence: price makes a higher high while RSI makes a lower high, signalling weakening momentum and possible reversal down. (2)

Question 3 (10)

(a)

  • MACD line =EMA12(P)EMA26(P)= EMA_{12}(P) - EMA_{26}(P) (2)
  • Signal line =EMA9(MACD line)= EMA_9(\text{MACD line}) (1)
  • Histogram =MACD lineSignal line= \text{MACD line} - \text{Signal line} (1)

(b) (4)

macd_line = ema(prices,12) - ema(prices,26)   # element-wise
signal    = ema(macd_line, 9)
histogram = macd_line - signal

(1 mark macd line, 1 signal, 1 histogram, 1 correct alignment/element-wise.)

(c) Histogram crossing from negative to positive means the MACD line has crossed above the signal line — a bullish momentum shift / buy signal. (2)

Question 4 (10)

(a) Middle =SMA20= SMA_{20}; Upper =SMA20+2σ= SMA_{20} + 2\sigma; Lower =SMA202σ= SMA_{20} - 2\sigma. (3)

(b) Mean =(20+22+24+22+22)/5=110/5=22= (20+22+24+22+22)/5 = 110/5 = 22 (1) Deviations: −2,0,2,0,0 → squares 4,0,4,0,0 → sum 8; variance =8/5=1.6=8/5=1.6; σ=1.6=1.2649\sigma=\sqrt{1.6}=1.2649 (2)

  • Upper =22+2(1.2649)=24.53= 22 + 2(1.2649) = 24.53 (1)
  • Lower =222(1.2649)=19.47= 22 - 2(1.2649) = 19.47 (1)

(c) A squeeze is when the bands contract (low volatility, narrow band width), often preceding a breakout. (1) Pair with ADX (or MACD/volume/OBV) to confirm breakout direction. (1)

Question 5 (10)

(a) VWAP=(TPiVi)ViVWAP = \dfrac{\sum (TP_i \cdot V_i)}{\sum V_i}. (1) Typical prices: Bar1 (11+9+10)/3=10(11+9+10)/3=10; Bar2 (13+11+12)/3=12(13+11+12)/3=12; Bar3 (15+13+14)/3=14(15+13+14)/3=14. (2)

  • TP×Vol: 10(100)=100010(100)=1000; 12(300)=360012(300)=3600; 14(100)=140014(100)=1400; sum =6000=6000 (1)
  • Cumulative Vol =500=500 (1)
  • VWAP=6000/500=12.0VWAP = 6000/500 = 12.0 (1)

(b) %K=CLlowHhighLlow×100=47405040×100=70\%K = \dfrac{C - L_{low}}{H_{high} - L_{low}}\times 100 = \dfrac{47-40}{50-40}\times100 = 70 (2)

(c) %D is the smoothing (typically 3-period SMA) of %K — it acts as the signal line. (2)

Question 6 (8)

(a) ADX measures trend strength (not direction); ADX > 25 conventionally indicates a trending market, below ~20 indicates non-trending/weak. (2)

(b) Up-day (close > prev close): OBV += volume. Down-day (close < prev close): OBV −= volume. Unchanged: OBV stays the same. (3)

(c) Indicator overload = stacking many correlated indicators that give redundant/conflicting signals, causing analysis paralysis and false confidence. (2) Rule: use a small set from different categories (e.g., one trend, one momentum, one volume). (1)

[
  {"claim":"EMA5 for 3-period EMA equals 13.0625","code":"k=Rational(1,2)\ne=10\nfor p in [11,12,13,14]:\n    e=p*k+e*(1-k)\nresult=(e==Rational(209,16)) and (float(e)==13.0625)"},
  {"claim":"RSI over 6 changes equals ~80.49","code":"ag=Rational(33,10)/6\nal=Rational(8,10)/6\nrs=ag/al\nrsi=100-100/(1+rs)\nresult=abs(float(rsi)-80.4878)<0.01"},
  {"claim":"Bollinger upper/lower bands at 2 sigma","code":"import sympy as sp\nvals=[20,22,24,22,22]\nm=sp.Rational(sum(vals),5)\nvar=sp.Rational(sum((v-m)**2 for v in vals),5)\nsd=sp.sqrt(var)\nup=float(m+2*sd)\nlo=float(m-2*sd)\nresult=abs(up-24.5298)<0.01 and abs(lo-19.4702)<0.01"},
  {"claim":"VWAP equals 12.0","code":"num=10*100+12*300+14*100\nden=100+300+100\nresult=Rational(num,den)==12"},
  {"claim":"Stochastic %K equals 70","code":"k=(47-40)/(50-40)*100\nresult=k==70"}
]