Loading…

Trend Exhaustion Harvest

Riding a trend is the easy half of a trend-following system; getting out before it gives the trade back is the hard half. Any single exhaustion signal fires constantly on ordinary trending days for reasons that have nothing to do with the trend actually ending: a volume spike on routine news, a momentum wobble mid-trend that resolves and continues, or price legitimately running hot for several bars during a genuine breakout. Exiting on any one of these alone gives back most of a good trend to false alarms. This system checks three genuinely independent exhaustion signals every bar the position is open. A volume climax compares the current bar's tick volume against its own recent average - a burst of participation often marking capitulation or a blow-off. A momentum divergence checks whether price has printed a fresh extreme (a new high for a long position, a new low for a short) that RSI does not confirm - a classic, well-known warning that the move's underlying momentum has already turned before price has. A stretch measure checks how many ATRs the close currently sits from a moving average - an unusually large distance being the ordinary definition of overextension. Only when at least InpMinExhaustionSignals of these three agree, in the direction that would hurt the held position, does the system harvest the trade and close it. Every exit logs which of the three signals fired. Entries are deliberately simple - a fast/slow moving-average cross - because the point of this submission is the exit ensemble, not a novel entry method. Notes and limitations - The exhaustion ensemble only evaluates while a position is open; it plays no role in entries, by design. - Volume here is tick volume (iVolume), the only volume MQL4 has access to on most FX-style symbols - not exchange traded volume. - The initial ATR stop is a hard backstop, not the primary exit; most winning trades are expected to close via the exhaustion ensemble rather than the stop. - Only one position is held at a time per chart/magic combination. - Requires AutoTrading enabled to open or close anything.

Expert advisor · MT4 · v1.0 · Free

About Trend Exhaustion Harvest

Trend Exhaustion Harvest is an expert advisor (trading robot) for MetaTrader 4 based on RSI, Moving Average and ATR. It increases the lot size after a losing trade (martingale) and can size trades from your balance and risk percent. It has 18 settings, such as Entry fast ma, Entry slow ma and Volume avg period. MQL source code included.

Files in the download: TrendExhaustionHarvest.ex4, TrendExhaustionHarvest.mq4, TrendExhaustionHarvest.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Entry fast ma10Fast MA period for the trend-following entry
Entry slow ma30Slow MA period for the trend-following entry
Volume avg period20Bars used to average tick volume for the climax check
Volume multiplier2.0Climax fires when a bar's volume exceeds average * this
Rsi period14RSI period used for the divergence check
Divergence lookback20Bars searched for the prior swing extreme in the divergence check
Stretch ma period20MA period the stretch measure is taken from
Atr period14ATR period used for both the stretch measure and the stop
Stretch atr multiple3.0Stretch fires when price is this many ATRs from the stretch MA
Min exhaustion signals2Minimum of the 3 exhaustion signals required to exit (supermajority)
Atr stop multiplier3.0Initial stop distance = ATR * this multiplier
Use risk sizingfalseSize by percent risk instead of a fixed lot
Risk percent1.0Percent of equity risked per trade, when risk sizing is on
Fixed lots0.10Lot size when risk sizing is off, or as a fallback
Magic number20260613Magic number for orders opened by this EA
Slippage pips3Slippage tolerance, in pips
Max retries5Attempts per trade action before giving up
Retry wait ms500Pause between attempts, milliseconds

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Moving Average · ATR · Volume · Divergence · Momentum · Buy/Sell Arrows · Trend · News Trading · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria