Free lesson · Charts & patterns
Known strategy families: from chart idea to complete rules
Open interactive lessonPractice calculationsExplore labs
Start with the idea
The useful output of chart study is a falsifiable trading specification. Begin with an entry event and write down the first moment it is known. Then connect the proposed exposure to a loss budget and an exit.
Symbols, units & horizon
- Q: nonnegative integer quantity
- E: positive account equity in currency
- f: fraction of equity budgeted to the hypothetical stop loss
- v: currency value per price point per unit
- P_entry,P_stop,P_target: assumed entry, stop and target prices
- c_unit: estimated currency cost per position unit
- ⌊ ⌋: floor, round down
- | |: absolute distance
- Payoff ratio: target-distance to stop-distance ratio, not measured expectancy
When and why to use this
Use strategy families as research baselines and teaching examples. The most relevant comparison is the improvement over simpler rules after comparable exposure, execution delays and costs.
A setup is a condition. A strategy also needs a universe, observation clock, entry, sizing, invalidation, exit and cost model. “Buy a bullish candle” leaves most of the economically important decisions unspecified. Build one complete version first, then test modifications as separate research trials.
| Family | A testable starting specification | When it can fail |
|---|---|---|
| Donchian / channel breakout | Close above the previous n-bar high; enter next executable price; trailing exit or time stop; position size scaled to volatility | Range-bound whipsaws, overnight gaps, crowding and delayed entry |
| Moving-average trend following | Fast average crosses slow average after the close; act next period; reverse or exit on the opposite crossing | Repeated crossings with no sustained trend, parameter mining |
| Trend pullback / flag | Prior trend filter, bounded retracement, then resumption above a known local level; explicit invalidation and deadline | A trend transition turns a shallow pullback into a large reversal |
| Range or band mean reversion | Define a stable trailing range; enter after an extreme and a specified re-entry condition; exit near centre or on invalidation | A structural breakout continues beyond the “cheap” boundary |
| Opening-range breakout | Freeze the first specified minutes of the session, then trade a defined crossing; use session-specific costs and exit time | Auction effects, timezones, news spikes and falsely assumed stop fills |
| Pairs / relative-value reversion | Fit a stable spread on training data, enter on a frozen score rule, hedge both legs and exit on convergence or model failure | Structural breaks, borrow recalls, asymmetric fills and financing |
Solve a position loss budget
- Currency budget is E×f. One unit loses v×|entry−stop| plus assumed round-trip currency cost c_unit if stopped at the specified price.
- Require Q×loss_per_unit≤E f. Divide by positive loss_per_unit and round down for integer units. Compute target distance divided by stop distance separately.
E=$10,000, f=.01, v=1, entry=50, stop=48, c_unit=.10: Q=floor(100/2.10)=47. Target=54 gives a geometric ratio 4/2=2, before costs.
The stop-distance calculation budgets a hypothetical loss if the stop fills at the assumed price. It does not cap actual loss. Gaps, slippage, correlated positions and changing liquidity can exceed the budget. A 2:1 target-to-stop ratio is a proposed geometry, not an expected payoff ratio: partial exits, gaps, time exits and missed fills alter realised wins and losses.
For each family, write a small research card: why a counterparty might repeatedly pay you; which variables distinguish favourable from unfavourable contexts; the exact information timestamp; expected holding time; capacity; and a condition under which you would abandon the hypothesis. Compare to a simple same-exposure baseline. More filters should earn their complexity through incremental out-of-sample benefit.
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
from math import floor
def stop_budget(equity, risk_fraction, entry, stop, target, point_value=1, unit_cost=0):
distance=abs(entry-stop)
if equity<=0 or not 0<risk_fraction<=1 or distance==0 or point_value<=0 or unit_cost<0:
raise ValueError("Invalid budget, price distance or unit costs")
loss_per_unit=point_value*distance+unit_cost
return floor(equity*risk_fraction/loss_per_unit),abs(target-entry)/distance
print(stop_budget(10000,.01,50,48,54,unit_cost=.1))Continue learning
Candles, Structures & Pattern Research — all lessons- First principles: what a candle actually records
- Doji, hammer, shooting star and long-body bars
- Engulfing, inside bars and multi-candle sequences
- Trends, ranges, breakouts and chart structures
- Indicators as arithmetic: ATR, moving averages, RSI and bands
- Known strategy families: from chart idea to complete rules
- Pattern recognition: rules, features, shapelets and image models
- Quantitative recognition I: build a causal candle feature table
- Quantitative recognition II: shapelets and constrained dynamic time warping
- Quantitative recognition III: causal encoders and contrastive learning
- Quantitative recognition IV: GAF images, CNNs, transformers and visual-model audits
- Quantitative recognition V: calibrate, abstain and test the complete strategy
- Research review: what the evidence does and does not establish
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations