trades (trade_id, symbol, traded_at, price) is a tape of trades. Trades are ordered by traded_at; trades at the same moment are ordered by trade_id.
A trade is a breakout when its price is strictly higher than every one of the 5 trades before it in the same symbol — the previous five trades, not the previous five minutes. When fewer than 5 trades came before, compare with however many there are. A symbol's first trade has nothing to compare with and is never a breakout.
- •
prior_max — the highest price among those previous trades (NULL for the first trade) - •
is_breakout — TRUE or FALSE, never NULL
Columns: trade_id, symbol, traded_at, price, prior_max, is_breakout. Sort by symbol, traded_at, trade_id.