Hire someone if you don't know how to program at all. People here won't do your job for free.
input int MAperiod =21;//MA Period input ENUM_MA_METHOD MAmethod =MODE_SMA;//MA Method input ENUM_APPLIED_PRICE MAapplied =PRICE_CLOSE;//MA Applied Price
//In OnCalculate or a function int index=0; //Set to 1 if you want to only compare with closed bars double ma_value=TickNormalize(iMA(_Symbol,0,MAperiod,0,MAmethod,MAapplied,index)); if(Close[index]>ma_value) { //Price is above MA } if(Close[index]<ma_value) { //Price is below MA }
.
double TickNormalize(double price) { double ts=SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE); double adjustedForTickSize=NormalizeDouble(MathRound(price/ts)*ts,_Digits); return(adjustedForTickSize); }
Keith Watford
TickNormalize

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How can I get the price to compare with a MA in mql4?
I wanna make a condition if the price is upper the MA shows only buys arrow upper the MA, if the price is bellow the MA shows only sells bellow the MA.