Overview This indicator utilizes the Directional Movement Index (DMI) combined with a for-loop to provide a robust trend analysis (ADX is not a part of this indicator).
Settings
DMI ForLoop Settings: Start Length (a): The initial length for DMI calculation (inclusive). End Length (b):The final length for DMI calculation (inclusive). EMA Length (c): The length for the Exponential Moving Average applied to the DMI values, in order so smoothen the signal.
Signal Settings: Signal Mode: Determines the mode of signal calculation. Options are "Fast", "Slow", "Thresholds Crossing", and "Fast Threshold". Default is "Fast". 1. Slow: is a simple crossing of the midline (0). 2. Fast: positive signal depends if the current "DMIema" is above "DMIema[1]" or above 0.99, otherwise the signal is negative. 3. Thresholds Crossing: simple ta.crossover and ta.crossunder of the user defined threshold for Long and Short. 4. Fast Threshold: signal changes if the value of "DMIema" changes by more than user defined threshold against the current signal.
Functionality The DMI ForLoop indicator calculates an array of DMI values over a specified range of lengths, then averages these values and applies an EMA for smoothing. The result is a dynamic trend indicator that adapts to market conditions.
DMI Calculation: The indicator iterates through lengths from Start Length to End Length, calculating the positive and negative directional movement (DM) for each period and calculates the average of all the signals at the end. A custom function version of the DMI is used here in order to use DMI with "series" inputs.