This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community

MQL4 Question


Back to topics list
avatar
9
borko 2005.01.28 20:53 
The code below is supposed to indicate a MA Cross but it does not. Maybe I am wrong.

macurrent=iMA(NULL,0,5,0,MODE_LWMA,PRICE_CLOSE,0);
macurrentslow=iMA(NULL,0,10,0,MODE_LWMA,PRICE_CLOSE,0);
if (MathAbs(macurrentslow-macurrent)==0)
{Comment("CROSS............");}
else{Comment(macurrent,"|",macurrentslow,"|",MathAbs(macurrentslow-macurrent));}
if (MathAbs(macurrentslow-macurrent)==0)
{
Print("Cross");
Alert("CROSS");
}
avatar
4464
Slawa 2005.02.02 11:49 
insufficient condition. should be:
if((prevvalue1<prevvalue2 && currentvalue1>=currentvalue2) || (prevvalue1>prevvalue2 && currentvalue1<=currentvalue2)) Alert("Crossing...")
Back to topics list  
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets