Trendline Break Follow Through Study
Drawing a trendline by eye and asking "does this work" is not measurable - two traders draw different lines through the same chart. This script fits trendlines the way a disciplined trader would: it finds swing highs and swing lows with a symmetric fractal window, then connects CONSECUTIVE same-side swings only if every bar between the two points actually stayed on the correct side of the connecting line, within a small tolerance. A pair of swing lows with a dip below the line somewhere in between is not a valid support trendline and is rejected outright, not silently fitted anyway. Once a line is accepted, it is projected forward and the first bar whose close genuinely punches through it by a threshold is recorded as the break. What happens over a fixed number of bars afterward is then classified as continuation (price kept moving in the break's direction past a threshold), reversal (price came back the other way past a threshold), or chop (neither). Support breaks and resistance breaks are reported separately, because there is no reason a trader should assume an uptrend line breaking down behaves the same as a downtrend line breaking up. Notes and limitations - Only trendlines built from two CONSECUTIVE same-side swings are considered - a line skipping over an intervening swing is not fitted, which keeps the method mechanical rather than a matter of judgement. - At most one break is recorded per accepted line segment - once a line is broken its validity as a barrier is spent, and the script does not attempt to detect a later re-test or a second break of the same line. - The outcome window is measured from the break bar's own close, not the bar's high/low excursion - a sharp spike that reverses within the follow-up window can still be scored a reversal if the closes settle that way. - This is a descriptive study, not a trading signal. It ignores spread and slippage, and a small sample of accepted lines on a short history should not be read as a reliable edge either way.
Script · MT5 · v1.0 · Free
About Trendline Break Follow Through Study
Trendline Break Follow Through Study is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 10 settings, such as Symbol, Timeframe and Max bars. MQL source code included.
Files in the download: TrendlineBreakStudy.ex5, TrendlineBreakStudy.mq5, TrendlineBreakStudy.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol | Symbol to study, blank = this chart's symbol | |
| Timeframe | PERIOD_H1 | Timeframe to study |
| Max bars | 3000 | Most recent bars to include |
| Swing window | 5 | Bars each side required to confirm a swing high/low |
| Tolerance line pips | 3.0 | Allowed dip past the line before a segment is rejected as invalid |
| Break threshold pips | 5.0 | Close-through distance required to call a break genuine |
| Max extension bars | 200 | Furthest a line is projected forward looking for a break |
| Follow bars | 10 | Bars after the break checked for follow-through |
| Continue threshold pips | 8.0 | Move needed in the break direction to call it a continuation |
| Save csv | true | Write every break event to a CSV file |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Support & Resistance · Fractals · Trend · Alerts · MT5 Script · MQL5 Source Code