Examples from the article "Applying L1 Trend Filtering in MetaTrader 5"
  • MQL5 98.8%
  • Python 1.2%
Find a file
2026-04-14 00:22:20 +03:00
Experts Examples from the article "Applying L1 Trend Filtering in MetaTrader 5" 2026-04-13 17:44:41 +03:00
Files Examples from the article "Applying L1 Trend Filtering in MetaTrader 5" 2026-04-13 16:31:10 +03:00
Images Examples from the article "Applying L1 Trend Filtering in MetaTrader 5" 2026-04-13 21:57:41 +03:00
Indicators Examples from the article "Applying L1 Trend Filtering in MetaTrader 5" 2026-04-03 23:16:47 +03:00
Scripts Examples from the article "Applying L1 Trend Filtering in MetaTrader 5" 2026-04-13 16:31:10 +03:00
L1Trend.mqproj Examples from the article "Applying L1 Trend Filtering in MetaTrader 5" 2026-04-03 23:18:45 +03:00
L1Trend_Demo.mq5 Examples from the article "Applying L1 Trend Filtering in MetaTrader 5" 2026-04-03 23:16:47 +03:00
README.md Examples from the article "Applying L1 Trend Filtering in MetaTrader 5" 2026-04-14 00:22:20 +03:00

L1 Trend Filter methods in MQL5

Examples from the article Applying L1 Trend Filtering in MetaTrader 5

Demo1

Demo2

File Structure

Scripts

  • MQL5\Scripts\TestL1Trend.mq5
    Test script for calculating the L1 trend on model data (random walk).

  • MQL5\Scripts\TestL1TrendFloatDouble.mq5
    Test script for calculating the L1 trend on model data (random walk) for double and float vectors.

  • MQL5\Scripts\L1TrendRandomWalk.mq5
    Test script for calculating the L1 trend on model data (random walk) for double vectors.

  • MQL5\Scripts\TestL1TrendFilterSP500.mq5
    Test script for calculating the L1 trend on S&P 500 index price data.

  • MQL5\Scripts\TestScalingBrownianMotion.mq5
    Script for calculating the power-law dependence of λmax for Brownian motion.

  • MQL5\Scripts\TestScalingSymbol.mq5
    Script for calculating the power-law dependence of λmax for the price series of a selected symbol.

  • MQL5\Scripts\L1TrendImageDenoise.mq5
    Example script for L1 Trend image denoise.

  • MQL5\Scripts\PlotData.py
    Python script for analyzing the effectiveness of applying the L1 filter to trading signals.


Data Files

  • MQL5\Files\snp500.txt
    Data file used by test scripts (log of the S&P 500 index price series).
  • MQL5\Files\*.bmp
    Sample images used for L1 Trend Filter image denoising.

Indicators

  • MQL5\Indicators\L1TrendFilter.mq5
    Indicator for calculating the L1 trend.

  • MQL5\Indicators\L1TrendFilter_Slope.mq5
    Indicator for calculating the rate of change (slope) of the L1 trend.

  • MQL5\Indicators\L1TrendFilter_SlopeSign.mq5
    Indicator for calculating the sign of L1 trend changes.

  • MQL5\Indicators\L1Volatility.mq5
    Indicator for calculating residual volatility (difference between closing prices and the L1 trend).

  • MQL5\Indicators\L1VolatilitySmoothed.mq5
    Indicator for calculating smoothed residual volatility.

  • MQL5\Indicators\L1VolatilityAbsolute.mq5
    Indicator for calculating absolute volatility.

  • MQL5\Indicators\L1VolatilityNormalized.mq5
    Indicator for calculating normalized volatility using ATR (Average True Range) and the L1 trend.

  • MQL5\Indicators\L1VolatilityNormalizedSmoothed.mq5
    Indicator for calculating smoothed normalized volatility.

  • MQL5\Indicators\L1VolatilityRegime.mq5
    Market regime detection indicator.

  • MQL5\Indicators\L1VolatilityRegimeColor.mq5
    Color version of the market regime detection indicator.


Expert Advisors

  • MQL5\Experts\MovingAverageFilteredL1.mq5
    Expert Advisor based on a Moving Average strategy with L1 filtering.

  • MQL5\Experts\MACDFilteredL1.mq5
    Expert Advisor based on a MACD strategy with L1 filtering.

  • MQL5\Experts\ADXFilteredL1.mq5
    Expert Advisor based on an ADX strategy with L1 filtering.

  • MQL5\Experts\EMAFilteredL1.mq5
    Expert Advisor based on crossover of two EMAs with L1 filtering.

  • MQL5\Experts\DonchianChannelBreakoutFilteredL1.mq5
    Expert Advisor based on Donchian Channel Breakout Strategy with L1 filtering.

  • MQL5\Experts\ATRChannelBreakoutFilteredL1.mq5
    Expert Advisor based on Average True Range Channel Breakout Strategy with L1 filtering.


EURUSD Trend Market (2025,H1)

Demo3

1. L1 Trend Filter for Moving Average Strategy

Demo3

No filters

Demo4

Demo5

L1 Trend Filter for Close signals

Demo6

Demo7

Results for all filters (Moving Average)

Demo8 Demo9 Demo10


2. L1 Trend Filter for MACD Strategy

Demo11

No filters

Demo12

Demo13

L1 Trend Filter for Close signals

Demo14

Demo15

Results for all filters (MACD)

Demo16 Demo17 Demo18


3. L1 Trend Filter for ADX Strategy

Demo19

No filters

Demo20

Demo21

L1 Trend Filter for Close signals

Demo22

Demo23

Results for all filters (ADX)

Demo24 Demo25 Demo26


4. L1 Trend Filter for EMA Strategy

Demo27

No filters

Demo28

Demo29

L1 Trend Filter for Close signals

Demo30

Demo31

Results for all filters (EMA)

Demo32 Demo33 Demo34


L1 Trend Filter Results for Channel Breakout Strategies (Fast Signals)


5. L1 Trend Filter for Donchian Channel Breakout Strategy

Demo35

No filters

Demo36

Demo37

L1 Trend Filter for Close signals

Demo38

Demo39


6. L1 Trend Filter for ATR (Average True Range) Channel Breakout Strategy

Demo40

No filters

Demo41

Demo42

L1 Trend Filter for Close signals

Demo43

Demo44

LambdaMax Scaling Laws

Scaling Law for Random Walk

Demo45

Scaling Law for EURUSD

Demo46

Scaling Law for USDJPY

Demo47

Scaling Law for GBPUSD

Demo48


L1 Trend SP500

Demo49


L1 Trend Indicators

Demo50


L1 Trend Volatility Indicators

Demo51


L1 Trend Filter for Image Denoising

L1 Trend Filter for Image Denoising (2016) Procedia Computer Science 93:495-502

Samples source

Demo52

L1 Trend Filter Results

Demo53 Demo54 Demo55 Demo56 Demo57 Demo58