RobotFX curates the best open-source MetaTrader code to inspire your trading automation.
The idea behind the indicator
Waves are determined by two moving averages: a fast SMA based on closing prices and a slow LWMA based on the weighted price ((H+L+2C)/4). As long as the fast moving average is above the slow one, an uptrend is in progress; as long as it is below, a downtrend is in progress. If the distance between them is less than the threshold (the ‘Trigger sensitivity (points)’ parameter), the price is considered to be in the ‘neutral zone’ and the trend does not change.

When one wave is replaced by another, the indicator takes the completed wave and identifies its extreme. For an uptrend, this is the high; for a downtrend, the low. An arrow is drawn at this point. Consequently, the arrow appears with a delay, after the wave has changed, but is placed on the bar of the extreme itself and is not redrawn on closed bars.
Grid trading done right – try the robust Grid Expert Advisor for controlled risk. Details here.
Waves are counted simultaneously across three timeframes:
- High pivot (red arrows) — large waves, slow LWMA = High period, fast SMA = High period / 7;
- Low pivot (dark gold arrows) — medium-sized waves, slow LWMA = Low period, fast SMA = Low period / 5;
- Lowest pivot (purple arrows) — small waves with fixed periods of 2 and 5.
How to interpret the readings
- The arrows indicate the most recent confirmed market peaks and troughs. The larger the timeframe, the more significant the level. A combination of arrows of different colours at a single extreme indicates a strong peak or trough.
- The HTL and LTL lines are drawn through the last two pivots of the same name. The resistance line is drawn through two declining peaks, and the support line through two rising troughs. They extend to the right by a specified proportion (parameters: HTL: extension factor; LTL: extension factor). A breakout of such a line indicates a change in the trend structure. The HTL is drawn based on major waves, whilst the LTL is based on medium-sized waves.
- The FTL forecast line runs from the most recent major peak to the moving average of the highs and is recalculated on each new bar. This is a dynamic resistance reference point.
External parameters
Basic
- High period — the period for large waves;
- Low period — the period for medium-sized waves;
- Trigger sensitivity (points) — the neutral zone threshold in points (the higher the value, the less frequently the waves change);
- Forecast high trend line — enable the forecast line;
- Keep lines after indicator removal — do not delete lines when the indicator is removed;
- Show author label on chart — display the author’s label on the chart.
Semafor Drawing Adjustment
- Draw high pivot semaphore, Draw low pivot semaphore, Draw lowest pivot semaphore — enable arrows for each level.
High Trend Lines Adjustment (the same applies to Low Trend Lines Adjustment, prefixed with LTL)
- HTL: draw lines — to draw lines;
- HTL: resistance colour and HTL: support colour — resistance and support colours;
- HTL: line style and HTL: line width — style and thickness;
- HTL: extension factor — by how much to extend the line to the right;
- HTL: lines kept on chart — how many of the most recent lines to keep on the chart;
- HTL: min bars between pivots — the minimum number of bars between two pivots for drawing a line.
High Semaphore Adjustment (the same applies to Low Semaphore Adjustment)
- High pivot: text alert — text alert;
- High pivot: sound file — sound file;
- High pivot: arrow offset (points) — offset of the arrow from the extreme point;
- High pivot: arrow code — arrow symbol code (Wingdings).
Lowest Semaphore Adjustment
- Lowest pivot: arrow code — the code for the arrow symbol.
Forecast Trend Line Adjustment
- FTL: colour, FTL: line style, FTL: line width — line appearance;
- FTL: extension factor — extension of the line to the right.
Usage
The indicator works on any instrument and timeframe. Copy the file to the MQL5\Indicators folder, compile it and drag it onto the chart. To obtain more frequent signals, reduce the High period and Low period; to obtain ‘calmer’ waves, increase them. On fast timeframes and instruments with 5-digit pricing, it is advisable to increase the Trigger sensitivity (points).
Authorship
Based on the open-source MQL4 code for the Waves Auto Trend Indicator (WATL) by idealfx. This version is a port to MQL5.
Ported to MQL5 by Evgeniy ZhdanBuild better strategies with RobotFX professional tools – check them out.
78763