Loading…

Swing Failure Pattern

A swing failure pattern here means one specific thing: a bar's wick breaches the most recently confirmed swing high or swing low by at least a minimum distance, and that same bar's close lands back on the near side of the level. Some published versions of this pattern accept the breach on one bar and the close-back on a later bar; this one does not. The wick and the rejection close have to happen on the same bar, or nothing is marked. That is a narrower net - fewer signals - traded deliberately for a stricter, less ambiguous definition. The level being tested is always the single nearest confirmed swing on that side, not every historical swing on the chart. A swing only becomes eligible once it has held for the configured number of bars on both sides. Once a level is swept and fails (the pattern this indicator marks), it is retired - a fresh confirmed swing is needed before that side can fire again. If a bar instead closes cleanly beyond a level rather than rejecting back inside it, that level is also retired, because a clean break is a real move through structure, not a failure, and is no longer a meaningful level to test against. A minimum penetration distance, in pips, keeps a level from being retired by a fractional-point wick that barely pokes past it - broker noise, not a genuine test of the level. Notes and limitations - The wick and the rejection close must be the same bar. A breach on one bar followed by a close-back on a later bar is not marked by this indicator - that is a deliberate design choice, not an oversight. - Only the nearest confirmed swing on each side is tracked; older swings further away are not considered once a newer one has confirmed. - A level is retired the first time it is either swept-and-failed (marked) or cleanly broken (not marked) - either way, the next signal on that side needs a fresh confirmed swing first. - Because the reference swing itself needs InpSwingLookback bars either side to confirm, and the failure test itself only completes on the failure bar's own close, this is a record of a completed event, not a live warning issued while the bar is still forming.

Indicator · MT5 · v1.0 · Free

About Swing Failure Pattern

Swing Failure Pattern is an indicator for MetaTrader 5. It draws buy and sell arrows on the chart and can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Swing lookback, Min penetration pips and Show level line. MQL source code included.

Files in the download: SwingFailure.ex5, SwingFailure.mq5, SwingFailure.txt.

Settings

SettingDefaultWhat it does
Swing lookback3Bars each side required to confirm the swing (K)
Min penetration pips0.5Minimum intrabar breach past the level, in pips
Show level linetrueDraw a short segment at the swept level
AlertstrueAlert once, on the SFP bar's close

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 → Indicators.
  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 indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Buy/Sell Arrows · Alerts · MT5 Indicator · MQL5 Source Code

MetaTrader 4 & 5 indicators · PolyMaria