Examples
Research: what follows a sweep?
A study of raw events. Each sweep (one aggressive order through several prices) becomes a study, grouped by size of the sweep. The Report shows, for each group and side, the price change after 30 seconds, 2 and 5 minutes, and the outcome of a 6-tick target against a 6-tick stop, with confidence intervals by day.
research "After a sweep" { overlay: true }
type Event { time: time, side: string, name: string, price: float }
minLevels = input.int("Min prices traded", 2, min: 2)
on trade(t) {
if not na(t.levels) and t.sweep_end and t.levels >= minLevels {
group = t.levels >= 4 ? "Sweep 4+ prices" : "Sweep 2-3 prices"
study(Event { time: t.time, side: t.is_buy ? "buy" : "sell", name: group, price: t.price },
horizons: [30s, 2m, 5m], target: 6 ticks, stop: 6 ticks, cost: 1 tick)
}
}
compare(by: ["side", "rth"], ci: 1000)What to notice:
- any object with
time,side,nameandpricecan be studied; no pattern is needed; - each group keeps a single target/stop geometry, so its break-even win rate is meaningful;
compareputs the two sweep groups side by side, split by side and by RTH / ETH.