Trb buy sell
Marks closes that break the highest high or lowest low of the prior 50 bars.
trb_buy_sell is a range-breakout rule. For each bar it takes the highest high and the lowest low of the k bars before it, leaving out the current bar. Buy fires when the close is above that high, and sell when the close is below that low, with each level moved by band and optionally held to confirm_days bars in a row. Buy and sell are separate outputs with no position logic, so neither one closes the other.
How to read it
- Buy and sell are markers on the candles, not a pane below the price.
- A buy marker means the close cleared the highest high of the 50 bars before it. A sell marker means the close undercut the lowest low of those bars.
- At defaults the markers are frequent: about 24 buy and 26 sell events a day, and a typical run lasts about 1.6 bars, so many are single-bar blips.
- Read a marker as a range break, not as a trade: nothing ties a buy to a later sell.
What it outputs
- Buy
- Fires on each bar whose close is above the highest high of the k bars before it, times (1 + band). Band 0 means a plain break of that high.
- Sell
- Fires on each bar whose close is below the lowest low of the k bars before it, times (1 - band). Band 0 means a plain break of that low.
When it fires
A buy fires on each bar whose close clears the prior k bars' high, and a sell on each bar under their low, both shifted by band. With confirm_days above 1, it marks only the bar the run reaches that length. It means price broke the recent range, not that the break will hold.
Settings
- k
- Bars the range looks back over, not counting the current bar; 50 is 50 minutes on one-minute bars. Longer raises the high a buy must clear and lowers the low a sell must undercut, so markers thin out. Shorter reacts to small swings and gives more.
- band
- Moves both levels by that fraction of price. Positive makes buy and sell both harder: the close must clear the high by the band, or undercut the low by it. Negative makes both easier. At 1 neither can fire; at -1 both fire on almost every bar.
- confirm_days
- Bars in a row the close must stay past the level. The marker lands on the bar the run reaches that length, once per run, so 1 marks every break and higher values keep only breaks that hold.
Pitfalls
- No position logic: a buy does not close out an earlier sell, so both can sit on the chart together.
- Most markers last one bar: the average run is about 1.6 bars at defaults. Raise k or confirm_days to thin them out.
- Band near 1 switches the rule off and near -1 floods it, so only small band values are useful.