OPEN-SOURCE SCRIPT

Market Structure BOS/CHoCH + Break Follow-Through [ForexCracked]

722
🔵 OVERVIEW

Most market structure indicators stop at the break. This one keeps counting after it.

It draws the structure the way you already read it: confirmed swing highs and lows tagged HH, HL, LH and LL, a solid line at the level that would flip the current structure, and a BOS or CHoCH label the moment a bar closes through a swing. Then it does the part most structure tools stop short of. For every break it watches what price did next, files the outcome, and prints the counted result on the chart with the sample size next to it.

So the label on a break does not just say BOS. It says BOS, and that on this chart breaks like this one reached 1 ATR beyond the level before snapping back 116 times out of the last 200.

🔵 THE ANSWER IS THERE BEFORE THE BREAK

The two live levels, the last confirmed swing high and swing low that price has not yet closed through, are drawn as blocks at the right edge of the chart, teal above price and pink below. Each block is captioned with the break it would be under the current structure (BOS or CHoCH), the price, the distance, and what breaks of that kind did here: "BOS above 1.08420 · 12p · 1.0 ATR reached 116/200 (58%) · typical run to 1.08790".

The block's height is not decoration. It is the measured median run after breaks of that class on this symbol, so the top of the teal block is a price that breaks like this one typically reached. Medians print from eight samples and percentages from the minimum n. Below that the block falls back to the follow-through distance and its caption reads "finish line at" instead of "typical run to". A block never draws thinner than the minimum block height, and when that floor is what sets its height the caption reads "run floor at".

🔵 HOW A BREAK IS MEASURED

A break is a bar that closes through a live swing level. It is a BOS if it goes with the current structure and a CHoCH if it goes against it and flips it.

From the next bar the script runs a race with two finish lines the same distance from the level: 1 ATR beyond it in the break direction, and 1 ATR back through it on the other side. ATR is frozen at the break bar so later volatility cannot move the finish lines. Whichever is touched first decides the outcome: reached, or snapped back. If one bar touches both lines it is filed as snapped back, the conservative reading. If neither is touched within 30 bars the outcome is filed as neither. Nothing is estimated and nothing is fitted. Every figure is a count of price events on the chart in front of you, over the last 200 filed breaks of that class, and the n printed beside it is the real count.

Wick-only breaks, where a bar trades through a level but closes back inside, are measured with the same race in their own class. They are never drawn as events (the level's block border turns dashed once it has been wicked), but their number sits on the level's caption, so "should I wait for the close" gets an answer from your own symbol instead of a rule of thumb.

🔵 THE RUN BOX

After each close break a box is drawn from the level in the direction of the break. Its height is the median run for that class, its width the median bars it took to reach the finish line, and its caption prints the far edge as a price. The box then records what this particular break did: the border thickens when the finish line is reached, the box hollows and its border goes dashed when the break snaps back, and it fades if neither happens. The last few breaks stay on the chart as filled or hollow shapes, so the recent record is visible without reading a single number.

The break label itself is frozen at the moment of the break. It shows what the tool said at the time, never a hindsight figure. Only the outcome is added to it afterwards.

🔵 THE SWINGS

Swings are confirmed by price, not by counting bars. A swing high is confirmed the first time a bar closes a set number of ATR below it, and a close through the previous swing confirms the swing in between. There is no lookback length to tune and the same setting reads the same on gold, indices, crypto and forex. Tags land on the swing bar when the swing confirms, so they appear a few bars after the extreme printed. That is confirmation lag, not repainting. No tag, break line or break label is ever moved; only the outcome text is added to a label later. The two right-edge blocks and the panel are redrawn every bar by design, so their height follows the current ATR.

🔵 WHAT IS ON THE CHART

• HH, HL, LH and LL tags on confirmed swings (the first swing of each side is tagged H or L)

• A dashed border on a block means that level has already been wicked without a close through it

• A solid structure line at the level that would flip the current structure, teal under price while bullish and pink above it while bearish, with the dealing range shaded between it and the other live level

• A block at each live level, projected into the space right of price, captioned with the break type, the price, the distance and the counted result for breaks like it

• A line from each broken swing to the bar that closed through it, with a BOS or CHoCH label carrying the count as it stood at that moment

• A run box after each break, filled or hollow depending on what the break did

• A compact panel restating the structure, the two levels, the class counts and the last break

🔵 WHAT THIS IS NOT

This script draws no entries, no stops, no targets and no arrows. It has no order blocks, no fair value gaps, no sessions and no higher timeframe calls. It does not tell you to trade a break. It does not map liquidity pools, equal highs and lows or session extremes, does not count how often price reaches them, and does not mark sweeps or reversals. It is the structure map with the follow-through counted, so you can see on your own symbol whether the breaks you are reading have tended to carry on or to come straight back.

🔵 HOW TO USE

• Read the two blocks first. The block above is the level a close must clear and what happened after closes like that; the block below is the level a close must lose. The prices are printed.

• Treat the follow-through percentage as a base rate for this class on this chart, not as a forecast for this break. One hundred and sixteen out of 200 is a description of the past.

• Use the class split. If close breaks on your chart reach 1 ATR far more often than wick-only breaks, waiting for the close is worth its cost here. If the two numbers are close, it is not.

• Watch the run box after a break rather than the label. A box that hollows out is a break that snapped back, and the structure line will tell you where the next flip sits.

• Lower the swing setting to 1.0 ATR to see internal structure, raise it to 2.0 or more on choppy symbols so only real pullbacks count as swings.

🔵 SETTINGS

• Swing confirmation (x ATR): the close distance from the running extreme that confirms a swing (default 1.5)

• Follow-through distance (x ATR): the two finish lines, the same distance either way from the level (default 1.0)

• Outcome window (bars): how long the race runs before the outcome is filed as neither (default 30)

• Breaks kept per class: the rolling window every count is taken over (default 200), and the minimum n before a percentage prints (default 20)

• Chart: break lines to keep, run boxes to keep, minimum block height, how far the blocks project right, the dashboard and its position, colours

• Works on any symbol and any timeframe. Charts with little history print n below the minimum until the numbers fill in

🔵 ALERTS

• Bullish BOS, bearish BOS, bullish CHoCH, bearish CHoCH, each on the closing bar

• Wick-only break: price traded through a structure level and closed back inside

• Break reached its follow-through distance

• Break snapped back

• Price within a quarter of an ATR of a live structure level

The engine is close-based, so set alerts to fire once per bar close.

⚠️ DISCLAIMER

BOS and CHoCH are community terms for market structure. This is independent work and is not affiliated with or endorsed by any educator or course.

The percentages are counted descriptions of what happened after past breaks on this chart, not predictions. A class that reached its follow-through distance 70 times in 100 can snap back today. Samples vary by symbol and timeframe, and small samples are unreliable by nature, which is why every figure carries its n and prints nothing below the minimum. Nothing here is a trade signal. Results depend on market conditions, settings, and your own execution and risk management. Shared for educational and research purposes. Not financial advice.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.