Loading…

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

SettingDefaultWhat it does
SymbolSymbol to study, blank = this chart's symbol
TimeframePERIOD_H1Timeframe to study
Max bars3000Most recent bars to include
Swing window5Bars each side required to confirm a swing high/low
Tolerance line pips3.0Allowed dip past the line before a segment is rejected as invalid
Break threshold pips5.0Close-through distance required to call a break genuine
Max extension bars200Furthest a line is projected forward looking for a break
Follow bars10Bars after the break checked for follow-through
Continue threshold pips8.0Move needed in the break direction to call it a continuation
Save csvtrueWrite every break event to a CSV file

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Support & Resistance · Fractals · Trend · Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria