need help for MA indicator

 

Hi, I would like to ask for helping code for MA indicator.

This code below is belong to an EA. But it seems not work well. Can anyone help advise me? Thank you.

 int    Fast_Price = PRICE_CLOSE;
   int    Fast_Mode  = MODE_EMA;
   int    Fast_Period=10;
   maF1=iMA(Symbol(),0,Fast_Period,0,Fast_Mode,Fast_Price,0);

   int    Slow_Price = PRICE_CLOSE;
   int    Slow_Mode  = MODE_EMA;
   int    Slow_Period=50;
   maS1=iMA(Symbol(),0,Slow_Period,0,Slow_Mode,Slow_Price,0);

   double DVBuySell=0.0011;
   double DVStayOut=0.0079;

   diverge=(maF1-maS1);
   
   ObjectDelete("Cmmt");
   ObjectCreate("Cmmt", OBJ_TEXT, 0, Time[20], High[20]+(10*p));
   ObjectSetText("Cmmt","Divergence="+DoubleToStr(diverge,4),10,"Arial",White);
   if( diverge>= DVBuySell       && diverge<= DVStayOut       ) BUYme=true;
   if( diverge<=(DVBuySell*(-1)) && diverge>=(DVStayOut*(-1)) ) SELLme=true;
 
Taproum: But it seems not work well. Can anyone help advise me?
  1. Why did you post your MT4 question in the Root / MT5 General section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. "Doesn't work" is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.

    Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.

  3. Help you with what? You haven't stated a problem, you haven't even stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help

    Or pay someone. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum

Reason: