How It Works
- Compute the MACD line — the 12-bar EMA minus the 26-bar EMA — and its signal line, a 9-bar EMA of the MACD itself.
- Buy when the MACD line crosses above its signal line: momentum has turned up faster than its own recent trend.
- Sell when the MACD line crosses back below the signal line.
Worked example. MACD has been recovering: yesterday −0.4 against a signal of −0.2, today +0.1 against −0.1. The line has crossed above its signal — buy. When MACD later drops back through the signal line, the position closes.
The Math Behind The Indicators
Everything runs on closing prices of the traded timeframe: P is a close, Pt today's close, and N counts bars — one bar is one candle of that timeframe, so 20 bars on a 1h chart is 20 hours.
- Exponential Moving Average (EMA)
- A running average that blends each new close into yesterday's value, so old prices fade away gradually instead of dropping out all at once. The blend factor α is larger for shorter periods, which makes short EMAs faster to react.
- EMAt = α · Pt + (1 − α) · EMAt−1, α = 2N + 1
- Example: With N = 19, α = 2 / 20 = 0.1. If yesterday's EMA was 100 and today's close is 110, the new EMA is 0.1·110 + 0.9·100 = 101 — it moves toward the new price but keeps most of its history.
- MACD
- The distance between a fast 12-bar EMA and a slow 26-bar EMA. When the fast average pulls above the slow one, MACD is positive and upward momentum is building. The signal line — a 9-bar EMA of the MACD itself — smooths it, so crossings between the two mark shifts in momentum.
- MACD = EMA12 − EMA26, Signal = EMA9(MACD)
- Example: If EMA12 = 105 and EMA26 = 102, MACD = +3: the recent trend runs above the longer one. With the signal line at 2.5, MACD sits above its signal — momentum is strengthening.
Example Chart
Example Chart
The Metrics
| Metric | Calculation | What it shows |
|---|---|---|
| Price Change % | change = Plast − P0P0 × 100 The traded market's own close against its first close over the same window, as a percentage. | What the market did while the rule was running — the benchmark every other row here is read against. A rule that made 40% in a market that made 120% lost to doing nothing. |
| Trades | N = count(closed positions) How many positions the rule opened and closed over the window. | The sample behind every other figure, and what the fees are charged on. Two rules with the same return are not the same rule if one took nine trades and the other took nine hundred. |
| Win Rate % | W%n = winsnn × 100 Of the first n trades, how many closed above the cash they opened with after fees. Plotted trade by trade, so the line is the rate so far rather than a final figure. | How often the rule is right, which is not how much it makes. A rule can win a third of its trades and still lead, if the third it wins pays for the two it loses. |
| Cumulative P&L % | PnL%n = n∑i=1(fi − 1) × 100 Each trade's percentage result added up, net of fees. A sum rather than a compounding, so a 10% gain and a 10% loss cancel. | What the rule returned per trade, with position size taken out of it. It answers whether the edge is in the trades themselves, where the equity curve answers what the account did with them. |
| Equity | En = E0 n∏i=1fi The account compounded through every trade — the whole balance goes into the next position. Drawn net of fees as a solid line and gross of them as a dotted one. | The account itself, which is the only figure a reader actually ends up with. The gap between the two lines is what the fees took, and it widens with every trade rather than staying a fixed share. |
| Cumulative Fees | Fn = n∑i=1(Ci φ + Xi φ) Fee charged on the way into each position and again on the way out, at rate phi, on the capital actually committed — so the bill grows with the account as well as with the trade count. | The cost of trading, in the account's own units. It is the one line here that only ever rises, and the one a rule cannot trade its way out of. |
| Rolling Sharpe | Sharpet = mean(rdaily)sd(rdaily) × √365 Mean daily return over its deviation, annualized on a 365-day year because crypto has no weekend. Taken on the account marked to market every bar — open positions included, not just closed ones — and read off at each trade's exit. | Return per unit of the swing it took to get it. It is the heaviest weight in the composite score, because an account that doubled calmly and one that doubled violently are not the same result. |