Level 5 — MasteryEntry, Exit & Trade Management

Entry, Exit & Trade Management

90 minutes60 marksprintable — key stays hidden on paper

Level: 5 (Mastery — cross-domain: probability, calculus, and algorithmic reasoning) Time limit: 90 minutes Total marks: 60

Notation: RR denotes one unit of initial risk (entry price minus stop distance, in currency per share). All "R-multiples" are trade outcomes expressed in units of RR. RR denotes reward-to-risk ratio.


Question 1 — Expectancy, Sizing & the Ruin Boundary (24 marks)

A systematic swing trader defines a setup with the following rules:

  • Enter long only when price closes above the 20-day high (breakout) AND the ATR(14) is above its 50-day median (volatility filter).
  • Initial stop = entry 1.5×ATR- 1.5\times\text{ATR} (an ATR-based stop).
  • Backtest over 200 signals gives: win rate p=0.40p = 0.40; average winner =+2.5R= +2.5R; average loser =1.0R= -1.0R (losers hit the full stop).

(a) Derive the general formula for per-trade expectancy EE in R-multiples given win rate pp, average win WW (in RR) and average loss LL (in RR, entered as a positive magnitude). Compute EE for this system. (4)

(b) The trader risks a fixed fraction ff of equity per trade (i.e. a loss of 1R1R costs ff of current equity). Show that the expected logarithmic growth per trade is g(f)=pln(1+fW)+(1p)ln(1fL).g(f) = p\ln(1+ fW) + (1-p)\ln(1 - fL). Derive the first-order condition g(f)=0g'(f)=0 and solve for the growth-optimal fraction f\*f^\* (Kelly). Compute f\*f^\* numerically for this system. (8)

(c) Using the system's numbers, compute the expected equity multiple after N=100N=100 independent trades if the trader risks the full f\*f^\* each trade, versus half-Kelly (f\*/2f^\*/2). Use multiple=eNg(f)\text{multiple} = e^{N\,g(f)}. State which you would deploy live and give one risk-management reason. (6)

(d) Prove that if E0E \le 0 then g(0)0g'(0) \le 0, and interpret what this means for taking any positive position size. (6)


Question 2 — Structure Stops, Trailing Logic & Break-even (20 marks)

A trade is entered at \100.Theinitialstructurestopisplacedatthelastswinglow. The initial structure stop is placed at the last swing low $96.ATR(14). ATR(14) =$2.00$.

(a) Compute the initial risk RR in dollars. If the profit target is set at a minimum RR of 1:21{:}2, give the target price. (3)

(b) The trader uses a chandelier trailing stop: stopt=maxHighSince Entry3×ATR\text{stop}_t = \max\text{HighSince Entry} - 3\times\text{ATR}. Over 5 days the intraday highs are 102,105,104,109,108102, 105, 104, 109, 108 (ATR constant at 2.002.00). Tabulate the trailing stop each day and state the day the stop first moves to break-even or better. (6)

(c) Write pseudocode (any clear syntax) for a function manage_trade(prices, entry, atr, R) that returns the exit price and the realized R-multiple, applying: (i) a break-even stop after price reaches +1R+1R unrealised, then (ii) the chandelier trail thereafter. State your assumptions about intrabar fills. (7)

(d) Explain, referencing "cut losers quickly," why moving to a break-even stop too early can reduce expectancy even though it feels safer. Support with one sentence linking to the win-rate/average-win trade-off. (4)


Question 3 — Scaling Out: Optimising a Two-Target Exit (16 marks)

A trade risks 1R1R. The trader will scale out: sell fraction xx of the position at +1R+1R (a "profit-book"), and let the remaining (1x)(1-x) ride to either +4R+4R (probability q=0.35q=0.35, conditional on reaching +1R+1R) or back to break-even (i.e. 0R0R, probability 1q1-q). Assume the +1R+1R level is always reached before resolution.

(a) Write the expected R-multiple of the whole trade as a function Rˉ(x)\bar R(x). (4)

(b) Show Rˉ(x)\bar R(x) is linear in xx; determine its slope and hence whether the optimal xx (to maximise expectancy) is 00 or 11. Interpret this result against the psychological appeal of scaling out. (6)

(c) Now suppose scaling out reduces the variance of the outcome. Compute Rˉ(x)\bar R(x) and the outcome variance at x=0x=0 and x=1x=1, and argue in terms of the ratio (expectancy/standard deviation) — a per-trade "Sharpe" — which xx a risk-averse trader might prefer. (6)


End of paper.

Answer keyMark scheme & solutions

Question 1

(a) Expectancy is the probability-weighted sum of outcomes: E=pW(1p)L.E = pW - (1-p)L. (2 — correct construction) With p=0.40, W=2.5, L=1.0p=0.40,\ W=2.5,\ L=1.0: E=0.40(2.5)0.60(1.0)=1.00.6=+0.40R.E = 0.40(2.5) - 0.60(1.0) = 1.0 - 0.6 = +0.40R. (2 — value) The system has a positive edge of 0.40R0.40R per trade.

(b) Each trade multiplies equity by (1+fW)(1+fW) with prob pp and (1fL)(1-fL) with prob 1p1-p. Log-growth per trade is the expected log-return: g(f)=pln(1+fW)+(1p)ln(1fL).g(f)=p\ln(1+fW)+(1-p)\ln(1-fL). (2 — setup) Differentiate: g(f)=pW1+fW(1p)L1fL=0.g'(f)=\frac{pW}{1+fW}-\frac{(1-p)L}{1-fL}=0. (2) Cross-multiplying: pW(1fL)=(1p)L(1+fW).pW(1-fL)=(1-p)L(1+fW). Expand: pWpWLf=(1p)L+(1p)LWfpW - pWLf = (1-p)L + (1-p)LWf. pW(1p)L=fWL[p+(1p)]=fWL.pW-(1-p)L = f\,WL\,[p+(1-p)] = f\,WL. So f\*=pW(1p)LWL=EWL.\boxed{f^\*=\frac{pW-(1-p)L}{WL}=\frac{E}{WL}.} (2 — derivation) Numerically: f\*=0.402.5×1.0=0.16f^\*=\dfrac{0.40}{2.5\times1.0}=0.16, i.e. risk 16% of equity per trade. (2)

(c) Compute gg at each fraction. A loss of 1R1R costs fraction ff; note W=2.5W=2.5 means a winner returns fWfW of equity.

At f\*=0.16f^\*=0.16: 1+fW=1+0.16×2.5=1.401+fW = 1+0.16\times2.5 = 1.40; 1fL=10.16=0.841-fL = 1-0.16 = 0.84. g=0.4ln1.40+0.6ln0.84=0.4(0.33647)+0.6(0.17435)=0.134590.10461=0.02998.g=0.4\ln 1.40 + 0.6\ln 0.84 = 0.4(0.33647)+0.6(-0.17435)=0.13459-0.10461=0.02998. Multiple over 100 trades: e100×0.02998=e2.99820.0e^{100\times0.02998}=e^{2.998}\approx 20.0. (3)

At half-Kelly f=0.08f=0.08: 1+fW=1.201+fW=1.20; 1fL=0.921-fL=0.92. g=0.4ln1.20+0.6ln0.92=0.4(0.18232)+0.6(0.08338)=0.072930.05003=0.02290.g=0.4\ln1.20+0.6\ln0.92=0.4(0.18232)+0.6(-0.08338)=0.07293-0.05003=0.02290. Multiple: e100×0.02290=e2.2909.87e^{100\times0.02290}=e^{2.290}\approx 9.87. (3)

Deploy half-Kelly: full Kelly has extreme drawdowns (Kelly maximises growth but the equity path is very volatile; a run of losses at 16%/trade produces a punishing drawdown and, with estimation error in p,Wp,W, can overbet into ruin). Half-Kelly keeps ~75% of the growth with far lower variance — consistent with "cut losers / preserve capital." (1 mark choice + 1 mark reason within the 6)

(d) g(f)=pW1+fW(1p)L1fLg'(f)=\dfrac{pW}{1+fW}-\dfrac{(1-p)L}{1-fL}. At f=0f=0: g(0)=pW(1p)L=E.g'(0)=pW-(1-p)L=E. (3) If E0E\le0 then g(0)0g'(0)\le0: log-growth is non-increasing as you leave zero position size, so any positive ff gives g(f)<g(0)=0g(f)<g(0)=0 (equity erodes in the long run). Interpretation: with no positive expectancy, no position size — however clever the sizing — creates a compounding edge; the only optimal size is zero. This is the mathematical statement of "don't trade a negative-expectancy setup." (3)


Question 2

(a) R = 100-96 = \4.00(initialrisk=entrystructurestop).(1)TargetatRR(initial risk = entry − structure stop). *(1)* Target at RR1{:}2:: +2R = +$8aboveentryabove entry\Rightarrowtarget**target=$108$**. (2)

(b) Chandelier stop == (highest high since entry) 3×2=HH6- 3\times2 = \text{HH} - 6. Track running max of highs:

Day High Running HH Stop = HH−6 Notes
1 102 102 96 = initial stop
2 105 105 99 below break-even
3 104 105 99 HH unchanged
4 109 109 103 ≥ 100: first at/above break-even
5 108 109 103 HH unchanged (trailing never lowers)

(4 for table) Break-even (100\ge100) is first reached on Day 4 (stop =103>100=103>100). (2)

(c) Pseudocode (assume stops fill at the stop price; check stop against each bar's low; unrealised profit measured off the bar high):

function manage_trade(prices, entry, atr, R):
    stop = entry - R              # initial structure/ATR stop
    hh = entry
    be_armed = false
    for bar in prices:            # bar has .high, .low, .close
        # 1) update highest high
        hh = max(hh, bar.high)
        # 2) arm break-even once +1R touched
        if not be_armed and bar.high >= entry + R:
            be_armed = true
            stop = max(stop, entry)          # move to break-even
        # 3) chandelier trail (only tightens upward)
        if be_armed:
            stop = max(stop, hh - 3*atr)
        # 4) check for stop hit this bar
        if bar.low <= stop:
            exit = stop
            return exit, (exit - entry)/R    # realized R-multiple
    exit = prices.last.close                  # exit at end if never stopped
    return exit, (exit - entry)/R

(5 for correct logic: BE arming, upward-only trail, stop-hit check; 2 for stated assumption on intrabar fill.)

(d) Moving to break-even too early converts many trades that would have retraced then continued into scratch (0R) exits and truncates would-be winners at the low end, cutting the average win WW. Because expectancy E=pW(1p)LE=pW-(1-p)L, shrinking WW (and only slightly raising effective pp of non-losses) can lower EE even though loss frequency feels reduced — the "safety" is paid for by giving up right-tail R-multiples that the whole edge depends on. "Cut losers quickly" applies to real adverse structure breaks, not to normal noise near entry. (4)


Question 3

(a) Portion xx books +1R+1R. Portion (1x)(1-x) resolves to +4R+4R (prob qq) or 0R0R (prob 1q1-q): Rˉ(x)=x(1)+(1x)[q(4)+(1q)(0)]=x+(1x)4q.\bar R(x)=x(1)+(1-x)\big[q(4)+(1-q)(0)\big]=x+(1-x)\,4q. (4) With q=0.35q=0.35: 4q=1.44q=1.4, so Rˉ(x)=x+1.4(1x)=1.40.4x\bar R(x)=x+1.4(1-x)=1.4-0.4x.

(b) Rˉ(x)=1.40.4x\bar R(x)=1.4-0.4x is linear; slope =0.4<0=-0.4<0. (3) Hence expectancy is maximised at the lower endpoint x=0x=0 (hold the full position for the runner), giving Rˉ(0)=1.4R\bar R(0)=1.4R; scaling everything at +1R+1R gives Rˉ(1)=1.0R\bar R(1)=1.0R. (2) Interpretation: scaling out feels good (locks profit, boosts hit rate) but here it reduces expectancy because the runner has a positive edge worth more than the booked 1R1R; the psychological comfort costs return. (1)

(c) Outcomes of the whole trade as a function of the runner's resolution:

  • With prob qq: R=x+(1x)4=43xR = x + (1-x)4 = 4-3x.
  • With prob 1q1-q: R=x+0=xR = x + 0 = x.

Mean Rˉ(x)=1.40.4x\bar R(x)=1.4-0.4x (from (a)). Variance: Var=q(1q)[(43x)x]2=q(1q)(44x)2=16q(1q)(1x)2.\mathrm{Var}=q(1-q)\big[(4-3x)-x\big]^2=q(1-q)(4-4x)^2=16q(1-q)(1-x)^2. (2 — derivation) With q(1q)=0.35×0.65=0.2275q(1-q)=0.35\times0.65=0.2275:

  • x=0x=0: mean =1.40=1.40, Var =16(0.2275)(1)=3.64=16(0.2275)(1)=3.64, sd =1.908=1.908; ratio =1.40/1.908=0.734=1.40/1.908=0.734.
  • x=1x=1: mean =1.00=1.00, Var =0=0, sd =0=0; ratio undefined/\infty (a certain +1R+1R). (2)

Argument: the full-runner (x=0x=0) has higher expectancy but lower per-trade Sharpe (0.734) and real downside dispersion. Scaling fully out (x=1x=1) yields a certain +1R+1R — zero variance — so a strongly risk-averse trader (minimising ruin/drawdown, or with poor edge estimates) may prefer larger xx despite lower mean, trading ~0.4R of expectancy for elimination of variance. The rational choice is an interior compromise if a smoothness/drawdown constraint is added; on pure expectancy alone, x=0x=0 wins. (2)

[
  {"claim":"Expectancy E = 0.40R for Q1a","code":"p=Rational(4,10);W=Rational(5,2);L=1;E=p*W-(1-p)*L;result=(E==Rational(4,10))"},
  {"claim":"Kelly fraction f* = 0.16","code":"p=Rational(4,10);W=Rational(5,2);L=1;E=p*W-(1-p)*L;f=E/(W*L);result=(f==Rational(16,100))"},
  {"claim":"100-trade full-Kelly multiple ~20.0","code":"import sympy as sp;g=sp.Float('0.4')*sp.log(sp.Float('1.40'))+sp.Float('0.6')*sp.log(sp.Float('0.84'));m=sp.exp(100*g);result=(abs(m-20.0)<0.5)"},
  {"claim":"Half-Kelly multiple ~9.87","code":"import sympy as sp;g=sp.Float('0.4')*sp.log(sp.Float('1.20'))+sp.Float('0.6')*sp.log(sp.Float('0.92'));m=sp.exp(100*g);result=(abs(m-9.87)<0.3)"},
  {"claim":"Chandelier stop reaches break-even (>=100) on Day4","code":"highs=[102,105,104,109,108];hh=100;days=[];\nfor i,h in enumerate(highs,1):\n    hh=max(hh,h);days.append((i,hh-6))\nfirst=[d for d,s in days if s>=100][0];result=(first==4)"},
  {"claim":"Scaling expectancy R-bar(0)=1.4 and R-bar(1)=1.0","code":"q=Rational(35,100);f=lambda x:x+(1-x)*4*q;result=(f(0)==Rational(14,10) and f(1)==1)"},
  {"claim":"Variance at x=0 is 3.64","code":"q=Rational(35,100);V=16*q*(1-q)*(1-0)**2;result=(V==Rational(364,100))"}
]