Trading Strategies
Chapter: 4.6 Trading Strategies Level: 3 — Production (from-scratch derivations, code-from-memory, explain-out-loud) Time Limit: 45 minutes Total Marks: 60
Instructions: Show all working. For code questions, pseudocode is accepted if logic is complete and unambiguous. Round money to 2 decimals, indicator values to 2 decimals unless stated.
Question 1 — Breakout & Opening Range Breakout (12 marks)
A stock's opening 15-minute range is: High = \502.00$495.00$.
(a) State the long and short ORB entry, and derive the initial stop-loss for each using the opposite end of the opening range. (3)
(b) You risk \3{,}000$ per trade. For the long ORB entry with the range-based stop, compute the position size (whole shares). (3)
(c) Set a profit target at a reward:risk ratio of (range-width risk). Give the target price for the long. (2)
(d) Explain-out-loud: why do many traders add a volume confirmation and a retest filter to raw ORB, and what failure mode does each address? (4)
Question 2 — RSI System from Scratch (10 marks)
(a) Write, from memory, the formula for RSI given average gain and average loss over periods, and state the range of RSI. (3)
(b) Over 5 periods the up-moves and down-moves (absolute) are: gains , losses . Using simple averages (), compute , , , and . (5)
(c) State one reason RSI(14) generates poor signals in a strong trend, and how a system fixes it. (2)
Question 3 — Moving-Average Crossover Code-from-Memory (12 marks)
(a) Write pseudocode for a fast/slow SMA crossover system that generates a long signal on a bullish cross and exit on a bearish cross. Inputs: price series P, fast period f, slow period s. (6)
(b) Compute the 3-period SMA for the series at the last two available points. (3)
(c) Explain-out-loud one structural weakness of crossover systems in ranging markets and one filter that mitigates it. (3)
Question 4 — MACD Derivation (10 marks)
(a) From memory, define the MACD line, the signal line, and the histogram in terms of EMAs. Use standard parameters. (4)
(b) Given and , compute the MACD line. If the signal line = , compute the histogram and state the momentum interpretation. (3)
(c) The EMA smoothing multiplier is . Compute for and use it to find today's if yesterday's and today's price = . (3)
Question 5 — VWAP Intraday (8 marks)
(a) Write the VWAP formula and explain why intraday traders treat VWAP as a fair-value / mean line. (3)
(b) Three trades occurred: 100 sh @ \20$21$22$. Compute VWAP. (3)
(c) Explain-out-loud a VWAP mean-reversion long setup vs. a VWAP trend-continuation long setup. (2)
Question 6 — Strategy Selection & Gap Trading (8 marks)
(a) A stock gaps up on high volume above prior resistance. Classify this as a likely breakaway vs exhaustion gap and justify with 2 observable criteria. (3)
(b) Explain the gap-fill trade logic and give the stop-placement rule you would use. (3)
(c) Match each market condition to the most appropriate strategy: (i) tight sideways range, (ii) strong sustained trend, (iii) sharp overextension into a supply zone. (2)
Answer keyMark scheme & solutions
Question 1 (12)
(a) Range width .
- Long entry: break above High \Rightarrow \502.00= $495.00$. (1)
- Short entry: break below Low \Rightarrow \495.00= $502.00$. (1)
- Rationale: opposite end invalidates the breakout thesis. (1)
(b) Per-share risk (long) . Position shares (round down). (3)
(c) Risk = ; reward = . Target = 502.00 + 14.00 = \mathbf{\516.00}$. (2)
(d) (1 each, max 4)
- Volume confirmation addresses false/low-conviction breakouts — breaks on thin volume often fail; volume shows real participation.
- Retest filter addresses whipsaw — waiting for price to hold above the level on a pullback confirms it flipped resistance→support and improves entry risk/reward.
- Together they cut the ORB "first-candle fakeout" failure common in low-liquidity opens.
Question 2 (10)
(a) , . Range –. (3)
(b) . (1) . (1) . (1) . (2)
(c) In a strong trend RSI stays overbought/oversold (e.g. >70) for long stretches, so counter-trend signals fail. Fix: use RSI only in direction of trend, shift bands (e.g. 40–80 in uptrend), or use RSI for pullback entries not reversals. (2)
Question 3 (12)
(a) (6, marks for computing both SMAs, storing prev cross state, generating long/exit)
for i in range(s-1, len(P)):
fast = mean(P[i-f+1 : i+1])
slow = mean(P[i-s+1 : i+1])
prev_fast = mean(P[i-f : i])
prev_slow = mean(P[i-s : i])
if prev_fast <= prev_slow and fast > slow:
signal[i] = "LONG" # bullish cross
elif prev_fast >= prev_slow and fast < slow:
signal[i] = "EXIT" # bearish cross
else:
signal[i] = "HOLD"
(b) , 3-SMA:
- at index 3 (10,12,14→13,14): . (1.5)
- at index 4: . (1.5)
(c) Weakness: in ranges the MAs interweave producing repeated whipsaw crosses and losses. (1.5) Mitigation: add a trend/volatility filter (ADX threshold, price-vs-longer-MA slope, or minimum separation between MAs) to trade only when trending. (1.5)
Question 4 (10)
(a) (1 each, max 4)
- MACD line .
- Signal line .
- Histogram .
- = fast EMA, slow EMA, signal EMA periods.
(b) MACD . (1) Histogram (positive). (1) Interpretation: MACD above signal with positive/widening histogram ⇒ bullish momentum increasing. (1)
(c) . (1) . (2)
Question 5 (8)
(a) . (1.5) It is the volume-weighted average traded price of the session, so it represents the average participant's cost basis / fair value — price above VWAP favors buyers, below favors sellers. (1.5)
(b) Numerator . Volume . VWAP = 10600/500 = \mathbf{\21.20}$. (3)
(c) (1 each)
- Mean-reversion long: price dips well below VWAP in a rangey market → buy anticipating snap-back toward VWAP.
- Trend-continuation long: price holds above rising VWAP, pulls back to VWAP and bounces → buy in direction of trend using VWAP as dynamic support.
Question 6 (8)
(a) Likely breakaway gap (1): justified by (i) high volume confirming conviction, and (ii) gap clears prior resistance starting a new leg (not into resistance). (2)
(b) Gap-fill logic: gaps (esp. common/area gaps with weak follow-through) tend to be "filled" as price retraces to the prior close; trade toward the pre-gap close. (2) Stop: just beyond the gap extreme (the gap-day high for a short-the-gap-up fill, or low for gap-down). (1)
(c) (i) → range trading (fade support/resistance); (ii) → trend-following / MA crossover; (iii) → reversal / supply-demand zone trade. (2, all three correct)
[
{"claim":"ORB long position size floor(3000/7)=428","code":"import math; result = math.floor(3000/7.0)==428"},
{"claim":"ORB 2:1 target = 516","code":"result = 502.00 + 2*(502.00-495.00) == 516.00"},
{"claim":"RSI with G=1.2 L=1.0 is 54.55","code":"RS=1.2/1.0; rsi=100-100/(1+RS); result = round(rsi,2)==54.55"},
{"claim":"3-SMA last two points 13 and 14","code":"P=[10,12,14,13,15]; a=(P[1]+P[2]+P[3])/3; b=(P[2]+P[3]+P[4])/3; result = (a==13.0 and b==14.0)"},
{"claim":"MACD=2.20 histogram=0.70","code":"macd=148.20-146.00; hist=macd-1.50; result = (round(macd,2)==2.20 and round(hist,2)==0.70)"},
{"claim":"EMA12 today approx 148.63","code":"k=2/13; ema=151.00*k+148.20*(1-k); result = round(ema,2)==148.63"},
{"claim":"VWAP = 21.20","code":"num=100*20+200*21+200*22; vwap=num/500; result = round(vwap,2)==21.20"}
]