Skip to content
← Back to the research library
MQL5 SOURCE COLLECTION / Trend Following

Hull Moving Average: Turning Points

Combines a moving-average direction condition with a faster turning-point pattern and percentage exits.

MT5 / MQL5Original sourceDependency + source issues

H1 · Published 28 October 2026

Source inspectionLimited static review
MetaEditor compilationNot performed
Backtest / live recordNot supplied

How the source is structured

  1. Create two handles for the custom HMA indicator.
  2. On a new H1 bar, compare the slower slope with a three-value turning pattern in the faster buffer.
  3. Attempt a fixed-volume long or short with percentage-based exit prices.

Default inputs

As supplied; these are not optimized or recommended settings.
Volume0.1 lot
Declared fast / slow periods7 / 50
Stop / target inputs0.5% / 0.5%
Indicator periodH1
BEFORE YOU TEST

Source-review notes

These observations come from reading this uploaded version. They are not compiler output or a complete code audit. The download retains the source as supplied.

SOURCE LINES 26–27

Both indicator handles use the fast-period inputs. The declared slow-period settings are not passed to the second handle.

SOURCE LINES 53–56

The buy take-profit is calculated below the ask, in the same direction as the buy stop loss.

SOURCE LINES 25–29, 44–46

Indicator-handle validity and CopyBuffer results are not checked.

Dependencies

Market\HMA Color with Alerts MT5.ex5 is required and was not supplied. The referenced custom indicator is not part of this download.

Source & attribution

The original filename includes 'Rene'; the source contains no author or license declaration.

Included in the Edge Quant source collection with existing notices preserved. Free download does not imply a new license grant.

Original filename: Hull Moving Average Rene.mq5
Encoding: UTF-8

Inspect the original source

The browser preview is decoded for reading; the download keeps the original file bytes.

Direct .mq5 file ↓
Expand full MQL5 source · 70 lines
#include <Trade/Trade.mqh>input double Lots = 0.1;input double TpPercent = 0.5;input double SlPercent = 0.5;input ENUM_TIMEFRAMES HmaTimeframe = PERIOD_H1;input int HmaFastPeriod = 7;input ENUM_MA_METHOD HmaFastMethod = MODE_LWMA;input ENUM_APPLIED_PRICE HmaFastAppPrice = PRICE_CLOSE;input int HmaSlowPeriod = 50;input ENUM_MA_METHOD HmaSlowMethod = MODE_LWMA;input ENUM_APPLIED_PRICE HmaSlowtAppPrice = PRICE_CLOSE;int hmaHandleFast;int hmaHandleSlow;datetime timestamp;CTrade trade;int OnInit(){      hmaHandleFast = iCustom(_Symbol,HmaTimeframe,"Market\\HMA Color with Alerts MT5.ex5","",HmaFastPeriod,HmaFastMethod,HmaFastAppPrice,"",false,false,false,false,"","",false,false);      hmaHandleSlow = iCustom(_Symbol,HmaTimeframe,"Market\\HMA Color with Alerts MT5.ex5","",HmaFastPeriod,HmaFastMethod,HmaFastAppPrice,"",false,false,false,false,"","",false,false);     return(INIT_SUCCEEDED);  }void OnDeinit(const int reason){     }void OnTick(){      datetime time0 = iTime(_Symbol,HmaTimeframe,0);      if(timestamp != time0){         timestamp = time0;                  double hmaFast[],hmaSlow[];         CopyBuffer(hmaHandleFast,MAIN_LINE,1,3,hmaFast);         CopyBuffer(hmaHandleSlow,MAIN_LINE,1,2,hmaSlow);                  double ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);         double bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);                  if(hmaSlow[1] > hmaSlow[0]){            if(hmaFast[2] > hmaFast[1] && hmaFast[1] < hmaFast[0]){               double sl = ask - ask*SlPercent/100;               double tp = ask - ask*TpPercent/100;                              trade.Buy(Lots,_Symbol,ask,sl,tp);                        }         }else if (hmaSlow[1] < hmaSlow[0]){               if (hmaFast[2] < hmaFast[1] && hmaFast[1] > hmaFast[0]){                  double sl = bid + bid*SlPercent/100;                  double tp = bid - bid*TpPercent/100;                                    trade.Sell(Lots,_Symbol,bid,sl,tp);               }           }      }  }

SHA-256: ab8680f94c8713381f0b6e67db5aebeea8d71e10e709d6731750b5dca06b0f0a

Educational source material, not investment advice. No profitability, execution quality or live-readiness claim is made for this upload.