- Moving Average
- MT5 Moving Average Touch Indicator
- Cross!
Hello community, I would like someone to create a simple MT5 indicator for me, but I haven't been able to find one like it here. The characteristics of the MT5 indicator are: it consists of an exponential moving average that can be adjusted to the desired period, and it gives an audible alert only once when the price touches (not crosses) the moving average, or when the price makes a pullback on the moving average. There should also be an option to set the distance of the price from the moving average. For example : setting the value to "0" means there will be an audible Alert when the price touches the EMA, and setting it to "2" means the indicator will give an alert when the price is within 2 pips of the EMA.
Here's another coder's custom moving averages indicator. Just select EMA and turn on Alerts in the inputs.
Note that there are no pullback nor padding alerts coded into the indicator. The coder has kindly provided source code which can be modified.
Assuming that you put the indicator in your MT5==>Data Folder==>MQL5==>Indicators folder, you need to compile the mq5 file or just restart MT5 which will automatically compile mq5 files.
Thank you Ryan L Johnson, I did indeed compile the code, but unfortunately it gives 130 errors, which is why the platform doesn't accept it.
There is oder alternative ?
Sorry about that. I've been trading for several decades so I've had the ex5 file since 2019. Unfortunately, the source code is no longer MQL5 compliant.
In any event, I found Conor Mcnamara's indicator which seems to be more in line with your requirements aside from having arrows instead of Alerts and being hardcoded to SMA. I just hardcoded EMA and real Alerts into it (attached)
The original SMA indicator is at:
Moving Average with alerts on price crossovers
Conor Mcnamara, 2023.07.30 15:19
I wanted to build a moving average which would create an alert when the price moves over the line by a user defined amount of points. It creates both bullish and bearish signals depending on the direction of market price moving through the MA. It is designed for slow length moving averages (default is 200-day MA). EDIT: I now added a second version of the indicator which uses Arrow buffers instead of ObjectCreate.(Edited).
Attachment removed by moderator as per poster's request.
Sorry about that. I've been trading for several decades so I've had the ex5 file since 2019. Unfortunately, the source code is no longer MQL5 compliant.
In any event, I found Conor Mcnamara's indicator which seems to be more in line with your requirements aside from having arrows instead of Alerts and being hardcoded to SMA. I just hardcoded EMA and real Alerts into it (attached)
The original SMA indicator is at:
(Edited).my original indicator was more so about crossing the price (with a point filter for confirmation)
If the criteria is not about crossing the price:
1. Find when the price is very close to the moving average (not crossing)
if( fabs(MA[i] - close[i]) <= 10 * Point() ){ }
2. Examine the momentum to confirm a divergence from the moving average
input double InpMomThreshold = 0.02; // Momentum Divergence Threshold
double curr_mom = Momentum[i]; bool BuyingMomentum = (curr_mom > 100 + InpMomThreshold); bool SellingMomentum = (curr_mom < 100 - InpMomThreshold);
I hate to say go to freelance, but hopefully you can understand code that was given and modify things (iMA, and iMomentum)
the momentum value provided by iMomentum is always normalized around 100, that's why you use it that way
- the momentum divergence will never be true at the same time that the price is close to/touching the moving average, so you have to create a global variable for state tracking and set a flag to true when the price is close to the MA...and then when that is true, you wait for the momentum divergence to be true.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use