EA maybe wrong?

 

hi eveyone i recently develope a new EA but is not working.

Could anyone help me to find out whats wrong on my code please?

P.s. if need it i could provide more information of what is the strategy wich i want to code 

 
  1. "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. We can't see your broken code. There are no mind readers here and our crystal balls are cracked.

  2. Your code isn't TXT it's MT4. Why did you post your MT4 question in the Root / MT5 EA 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.

  3. ticket = OrderSend(Symbol(), type, NormalizeDouble(volume, LotDigits), NormalizeDouble(price, Digits()), MaxSlippage, 0, 0, ordername, MagicNumber, 0, clr);
    Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong

  4.    if(Cross(1, iFractals(NULL, PERIOD_H4, MODE_UPPER, 0) < iFractals(NULL, PERIOD_H4, MODE_UPPER, 0)) //Fractals crosses below Fractals
       && iMA(NULL, PERIOD_H4, 20, 0, MODE_EMA, PRICE_CLOSE, 0) < iMA(NULL, PERIOD_H4, 50, 0, MODE_EMA, PRICE_CLOSE, 0) //Moving Average < Moving Average
       && TradesCount(OP_BUY) + TradesCount(OP_SELL) == iMA(NULL, PERIOD_H4, 20, 0, MODE_EMA, PRICE_CLOSE, 0) //Open Trades is equal to Moving Average
       && iMA(NULL, PERIOD_M30, 20, 0, MODE_EMA, PRICE_CLOSE, 0) < iMA(NULL, PERIOD_M30, 50, 0, MODE_EMA, PRICE_CLOSE, 0) //Moving Average < Moving Average
    
    Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling (or moving my eyes) back and forth trying to read it. Don't copy and past code, write self documenting code.
    double upFractH4  = iFractals(NULL, PERIOD_H4, MODE_UPPER, 0);
    double H4EMA20    = iMA(NULL, PERIOD_H4, 20, 0, MODE_EMA, PRICE_CLOSE, 0);
    double H4EMA50    = iMA(NULL, PERIOD_H4, 50, 0, MODE_EMA, PRICE_CLOSE, 0);
    double M30EMA20   = iMA(NULL, PERIOD_M30, 20, 0, MODE_EMA, PRICE_CLOSE, 0);
    double M30EMA50   = iMA(NULL, PERIOD_M30, 50, 0, MODE_EMA, PRICE_CLOSE, 0);
    if(Cross(1, upFractH4 < upFractH4) //Fractals crosses below Fractals
    && H4EMA20 < H4EMA50 //Moving Average < Moving Average
    && TradesCount(OP_BUY) + TradesCount(OP_SELL) == H4EMA20 //Open Trades is equal to Moving Average
    && M30EMA20 < M30EMA50 //Moving Average < Moving Average
    
    When is x < x ever going to be true?
  5. When do you ever expect a fractal to form on bar zero or one?
  6. When is a count ever going to be equal to a Moving average? Doubles are rarely equal.
              The == operand. - MQL4 and MetaTrader 4 - MQL4 programming forum
  7. You are looking at bar zero. You will get intermittent signals as price crosses moving averages. Perhaps you should look at bar one.
  8. On MT4: Unless the current chart is the specific pair/TF referenced, you must handle 4066/4073 errors.
              Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum

  9.       if(IsTradeAllowed())
            {
             ticket = myOrderSend(OP_SELL, price, TradeSize, "");
             if(ticket <= 0) return;
            }
          else //not autotrading => only send alert
             myAlert("order", "");
          myOrderModifyRel(ticket, 0, TP);
          myOrderModifyRel(ticket, SL, 0);
    If trading isn't allowed or the send fails, what are you modifying? Why don't you set the TP/SL when you open the order?
 
leoleo1833: could you help me to build this  EA please? .i buid this ea with EAbuider
  1. Help you with what? You haven't stated a problem.
    learn to code it or pay (Freelance) someone to code it. We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
              No free help
              urgent help.

  2. EA builder, EATree, fxDreema, FxPro, Online Forex Expert Advisor Generator, Quant, Visual Trader Studio, MQL5 Wizard, etc. are all the same. You will get something quick, but then you will spend a much longer time trying to get it right, than if you learned the language up front, and then just wrote it.
    • Since you haven't learned MQL4/5, therefor there is no common language for us to communicate.
      If we tell you what you need, you can't code it.
      If we give you the code, you don't know how to integrate it into yours.
      We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem, but we are not going to debug your hundreds of lines of code. You are essentially going to be on your own.

    • EA builder makes bad code counting up while closing multiple orders.
      EA builder makes bad code Bars is unreliable (max bars on chart) volume is unreliable (miss ticks) Always use time. New candle - MQL4 forum
      EA builder makes bad code, not adjusting for 4/5 digit brokers, TP/SL and slippage.
      EA builder makes bad code, not adjusting for ECN brokers. (pre-Build 500)
      EA builder makes bad code, not checking return codes.
      EATree uses objects on chart to save values - not persistent storage (files or GV+Flush.) No recovery (crash/power failure.)
Reason: