Job finished
Specification
I have an EA that opens trades when certain conditions are met in a M5 chart. I would like to include a trend filter in the EA, so it will only place trades in the direction of the trend selected.
The filter should be called Trend Locking. It has to calculate the trend direction in all Timeframes M1, M5, M15, M30, 1H, 4H, D1, W1 and MN. You have to be able to select the Timeframes you want to use as a filter (can be no one or multiple) in the options of the EA. The EA can then only place trades in the same direction as the trend of the Time frames selected. Examples:
M1 trend: Stationary
M5 trend: Falling
M15 trend: Rising
M30 trend: Falling
1H trend: Rising
4H trend: Rising
D1 trend: Rising
W1 trend: Rising
MN trend: Falling
Trend Locking selected 4H and D1. EA must place only LONG trades.
Trend Locking selected M30 and M5. EA must place only SHORT trades.
Trend Locking selected M15 and M30. EA CANNOT place ANY trade as trend in M15 and M30 are different.
Trend Locking selected M1. EA CANNOT place ANY trade as trend in M1 is neither Falling or Rising.
Trend Locking selected M1 and M5. EA CANNOT place ANY trade as trend in M1 and M5 are different.
Trend Locking selected 1H, 4H and D1. EA must place only LONG trades.
To calculate the trend direction, we will use a Simple Moving Average of the price of the asset and the Average Directional Movement Index (ADX). There must be the option to select the period of the SMA as well as the one for the ADX in the EA options.
The Trend will be Falling if the SMA ROC (Rate Of Change) is <0.00 and the ADX ROC is >0.00 (ADX positive slope)
The Trend will be Rising if the SMA ROC is >0.00 and the ADX ROC is >0.00 (ADX positive slope)
All the rest of combinations of SMA ROC and ADX ROC will be considered as Stationary.
ROC Formula: (Most recent closing price - Closing price 1 period ago) / Closing price 1 period ago
There must be the option to deactivate the ADX filter and calculate the trend direction only with the SMA conditions, regardless of the ADX ROC value.