Specification
Create an indicator which will detect the trends of M1, M5, M15, M30, H1, H4, D1 and W1 timeframes, and display them on the chart. The indicator will be able to show the current trend directions for all those timeframes, based on multiple indicators. The final trend detection decision will be a confluence of the results of the selected indicators.
The indicator should expose the below listed input parameters.
- Enable SMA (bool with Yes/No options)
- SMA Period (integer, default:200)
- Enable Three MAs (bool with Yes/No options)
- Three MA1 (integer, default:21)
- Three MA2 (integer, default:50)
- Three MA3 (integer, default:200)
- Enable ZigZag (bool with Yes/No options)
- Enable ADX (bool with Yes/No options)
- ADX Trend Level (integer, default:17)
- Enable High/Low Direction (bool with Yes/No options)
- Look Back Bars (integer, default 83)
The effect of each input parameter is detailed below.
Enable SMA
'Yes' option will enable the Simple Moving Average calculation for trend detection. We will use 200 period as default.
Enable Three MAs
'Yes' option will enable Three Moving Averages. If this option is 'Yes', the next three related parameters are taken into effect for the moving average periods. 21, 50 and 200 are default values.
- Trend is up if at a given timeframe all moving averages are plotted in correct rising order on bar closure.
- Trend is down if at a given timeframe all moving averages are plotted in correct falling order on bar closure.
Enable ZigZag
'Yes' option will make use of the ZigZag indicator for the trend detection.
- Trend is up if every next local maximum of price chart is higher than previous local maximum and each subsequent local minimum of price chart is also higher than previous local minimum.
- Trend goes down if each subsequent local minimum of price chart is lower than previous local minimum, and each subsequent local maximum of price chart is also lower than previous local maximum.
Enable ADX
'Yes' option will use Average Directional Movement Index indicator for detection.
- Trend goes up, if the +DI line is higher than the -DI line.
- Trend goes down, if the +DI line is lower than the -DI line.
Enable High/Low Direction
'Yes' option will use the following rules for trend detection.
- If the highest point in the last 'Look Back Bars' candles is closer to the current candle, than the lowest price point, the trend is upwards.
- If the lowest point in the last 'Look Back Bars' candles is closer to the current candle, than the highest price point, the trend is downwards.
Important Note
I am not too fussy about the graphical panel of the indicator but it should be something nice.
The code should be well documented, either externally or internally with inline comments. The code should also be cleanly written and modular enough for me to pull from this indicator and put in another MQL4 program easily.
Also, I will have all rights reserved for this indicator, and the coder should withdraw all his/her copyright for this code.