17
by chris006
AI conversion mq4 -> mq5
Please convert this indicator from mq4 to mq5
I've converted the indicator to advanced_adx.mq5. I haven't compiled or tested it, so please compile it and send me any errors.
Inputs and plots: TimeFrame, ADXPeriod and Interpolate are unchanged, and so are the five plots with their colours and widths.
Colour logic: the colour rules are the same as in the MQ4 version.
When +DI is above -DI: strong up if the ADX is rising, weak up if it is falling.
Otherwise: weak down if the ADX is falling, strong down if it is rising.
Oldest bar: the oldest bar is "strong up".
ADX source: the values come from MT5's built-in ADX. Its smoothing differs slightly from the MT4 iADX, so the numbers are close to the MQ4 version but not identical.
Higher timeframe:
Method: the MQ4 version made 6 iCustom calls plus iBarShift for every bar. The MQ5 version runs a hidden copy of the indicator on the higher timeframe and reads its buffers once per call.
Normal ticks: only the last 3 higher-timeframe bars are re-read.
Interpolation: Interpolate gives the same linear ramp across each higher-timeframe bar as before.
Missing data: if the higher-timeframe data isn't ready, a 1-second timer retries.
Warm-up: the first 2 × ADXPeriod bars, where the ADX isn't formed yet, are no longer drawn.
The file is in /mnt/user-data/outputs:
advanced_adx.mq5