Skip to content
FXNook HubBeta

Alex / MTF Moving Average Indicator for MT4

MetaTrader 4IndicatorMITCompiled · build 2425
Compile logCompiled
MetaEditor build 2425 · MT4 · 1 Dec 2026, 10:21 UTCcompiling FXN_MTFMovingAverage.mq4✓ Result: 0 errors, 0 warnings, 3.6 soutput FXN_MTFMovingAverage.ex4 · 18 KBsha256 8afe908a1509aa3f…1ecab9d4

Files version 1.0

FileLinesSize
FXN_MTFMovingAverage.mq41536 KB
FXN_MTFMovingAverage.ex4 compiled by the Lab–18 KB
FXN_MTFMovingAverage.mq4153 lines
//+------------------------------------------------------------------+//| FXN_MTFMovingAverage.mq4                                         |//| FXNook Lab Hub starter library - MIT licence                     |//| https://lab.fxnook.com/hub                                       |//+------------------------------------------------------------------+#property copyright "FXNook Lab (MIT licence)"#property link      "https://lab.fxnook.com/hub"#property version   "1.00"#property description "A moving average from a higher timeframe drawn on the current chart, as steps or a smoothed line."#property strict#property indicator_chart_window#property indicator_buffers 1#property indicator_color1  clrOrange#property indicator_width1  2enum ENUM_MTF_DRAW{   MTF_STEP   = 0,   // Steps (one flat value per higher-timeframe bar)   MTF_SMOOTH = 1    // Smoothed (straight line between higher-timeframe values)};//--- inputssinput string            InpSep1      = "=== Moving average ===";  // ---- Moving average ----input ENUM_TIMEFRAMES    InpTimeframe = PERIOD_H4;   // Higher timeframe to take the average frominput int                InpPeriod    = 50;          // Moving average period (in higher-timeframe bars)input ENUM_MA_METHOD     InpMethod    = MODE_EMA;    // Moving average typeinput ENUM_APPLIED_PRICE InpPrice     = PRICE_CLOSE; // Price usedsinput string            InpSep2      = "=== Display ===";         // ---- Display ----input ENUM_MTF_DRAW      InpDrawMode  = MTF_STEP;    // Drawing modeinput color              InpColor     = clrOrange;   // Line colourinput int                InpWidth     = 2;           // Line width (1-5)input int                InpMaxBars   = 5000;        // Chart bars to draw (0 = all bars)//--- buffersdouble BufMa[];//--- stateint g_tf = PERIOD_H4;
Sign in to read all the code and download it

It is free. A free account lets you see every line, copy it, download the source and open a copy in your Lab. The compiled file can be downloaded without an account.

Sign in Create a free account

Version history

  1. Version 1.0Live1 Dec 2026

    First version.

    Source · Compiled