ALMA Trend Target MT4
- Indicadores
-
Cao Minh Quang
Welcome to my profile. I am a developer MQL4 and MQL5.
Telegram: https://t.me/storevan
Thanks and regards! - Versão: 1.0
- Ativações: 5
ALMA Trend Target is an ALMA-based trend identification system that combines slope-normalized momentum confirmation with standard deviation band validation to determine trend state, and automatically generates a complete position planning framework on each trend flip including a structure-derived stop loss, R-multiple take profit targets with proximity highlighting, and a risk zone visualization that tracks target hits and stop events throughout the position's active lifecycle.
How It Works
- ALMA Calculation: The Arnaud Legoux Moving Average is calculated from the selected source over the configured length with the configured offset and sigma parameters, providing a smoothed low-lag baseline.
- Slope Measurement: The ALMA change over the configured slope lookback bars is divided by ATR, producing a normalized slope score that measures directional momentum independently of price scale.
- Deviation Band Construction: Standard deviation over the deviation length multiplied by the confirmation multiplier produces the upper and lower confirmation bands around the ALMA.
- Trend Flip Detection: A bullish flip requires slope above the minimum threshold and close above the upper confirmation band simultaneously. A bearish flip requires slope below the negative threshold and close below the lower confirmation band. Flips are only registered when the new state differs from the current state.
- Conviction Scoring: The conviction score combines doubled slope magnitude with distance-weighted separation between price and ALMA, normalized to a 0-1 range that drives ribbon transparency and candle gradient intensity.
Key Features
The indicator combines Arnaud Legoux Moving Average calculation for trend baseline, standard deviation band construction for displacement confirmation, ATR-normalized slope scoring for momentum significance, conviction scoring from slope and distance for gradient scaling, swing structure lookback for stop loss derivation with ATR clamping, and a multi-array position management system that tracks active and historical positions with target proximity gradients and hit state tracking.
- ALMA Trend Engine: Calculates the ALMA with configurable length, offset, and sigma, measures the normalized slope over the configured lookback, derives deviation bands for displacement confirmation, and flips trend state when both slope and displacement conditions are simultaneously satisfied.
- Position Planning Engine: On each trend flip, derives stop price from swing structure within the lookback clamped by ATR multipliers, calculates risk distance, R-multiple targets, and creates the complete set of glow-and-core dual-layer lines, risk box, target zones, inter-target bands, and R-multiple labels as a unified position framework.
- Bullish Trend State (Green): Active when slope exceeds the minimum threshold upward and close is above the upper deviation band.
- Bearish Trend State (Red): Active when slope exceeds the minimum threshold downward and close is below the lower deviation band.
- Bullish Trend Signal: Green arrow below the bar when both slope and displacement conditions flip bullish, triggering a long position framework with structure-derived stop below entry and up to four equidistant R-multiple targets above.
- Bearish Trend Signal: Red arrow above the bar when both slope and displacement conditions flip bearish, triggering a short position framework with structure-derived stop above entry and up to four equidistant R-multiple targets below.
User Inputs:
- Max Bars: Limit the number of candles used for calculation.
- ALMA Source (Default: PRICE_CLOSE):Price source used for the ALMA trend calculation..
-
ALMA Length (Default: 14):Number of bars used to calculate the ALMA moving average. Higher values produce a smoother, slower trend line.
-
ALMA Offset (Default: 0.25): Controls the balance between responsiveness and smoothness. Higher values shift weighting toward recent price action.
-
ALMA Sigma (Default: 6.0): Controls the smoothness of the ALMA curve. Higher values produce a smoother line with less noise.
-
Deviation Length (Default: 34): Number of bars used to calculate the standard deviation bands around the ALMA for trend confirmation.
-
Trend Confirmation (0.0 - 3.0, Default: 0.65): Multiplier applied to the deviation bands. Higher values require price to move further from the ALMA before confirming a trend.
-
Slope Length (1 - 10, Default: 3): Number of bars back used to measure the ALMA's slope for trend confirmation.
-
Minimum Slope (0.0 - 1.0, Default: 0.08): Minimum slope strength, relative to ATR, required to confirm a trend direction.
-
ATR Length (Default: 14): Number of bars used to calculate the Average True Range, used for slope normalization and stop distance.
-
Show history target (Default: True): If true, historical Buy/Sell entry zones and target projections remain visible on the chart for backtesting analysis.
-
Show Take Profit Levels (Default: True): Toggles the visual display of the projected TP zones.
-
Stop Structure Lookback (Default: 12): Number of bars back used to locate swing structure for stop loss placement.
-
Minimum Stop ATR (0.25 - 3.0, Default: 0.75): Minimum stop distance allowed, expressed as a multiple of ATR.
-
Maximum Stop ATR (1.0 - 8.0, Default: 3.0): Maximum stop distance allowed, expressed as a multiple of ATR.
-
Projection Length (Default: 10): Number of bars the entry, stop, and target lines are projected forward from the current bar.
- Styles: Configure the visibility and color of chart objects.
- Alert/Notification: Allows send alert or notification to mobile
- Integration EA: Provide EA parameters as global variables
Prefix_ENTRY_PRICE: (double) Entry price
Prefix_ENTRY_TIME: (double) Entry time
Prefix_TRADE_DIRECTION: (1) = BUY; (-1) = SELL
Prefix_SL_PRICE: (double) Stoploss price
Prefix_TP1_PRICE: (double) Takeprofit 1 price
Prefix_TP2_PRICE: (double) Takeprofit 2 price
Prefix_TP3_PRICE: (double) Takeprofit 3 price
Whether you're a beginner looking for clearer entries or an experienced trader wanting visual SL/TP targets with minimal noise, ALMA Trend Target can become your go-to trading companion.
