2026-03-28 18:30:48 +00:00
|
|
|
# L1Trend
|
2026-03-28 21:16:50 +02:00
|
|
|
# Examples from the article [Applying L1 Trend Filtering in MetaTrader 5](https://www.mql5.com/en/articles/21142)
|
2026-03-28 21:01:01 +02:00
|
|
|
|
2026-03-28 21:15:51 +02:00
|
|
|

|
|
|
|
|
|
|
|
|
|
# File Structure
|
2026-03-28 21:01:01 +02:00
|
|
|
|
|
|
|
|
## 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\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\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).
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## 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.
|