Download MetaTrader 5
To add comments, please log in or register
Do you know that MQL5 can create custom graphical tools?
aligato999
17
aligato999 2016.05.11 07:21 

hi guys,

 

i have recently created my own EA, but there is more than 30 error which i have no idea how to fix.

Sorry, im not from IT background. and i was using the expert advisor builder instead of typing the code myself.

 

i need help............... 

 

//+------------------------------------------------------------------+

//| This MQL is generated by Expert Advisor Builder                  |

//|                http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ |

//|                                                                  |

//|  In no event will author be liable for any damages whatsoever.   |

//|                      Use at your own risk.                       |

//|                                                                  |

//+------------------- DO NOT REMOVE THIS HEADER --------------------+


#define SIGNAL_NONE 0

#define SIGNAL_BUY   1

#define SIGNAL_SELL  2

#define SIGNAL_CLOSEBUY 3

#define SIGNAL_CLOSESELL 4


#property copyright

#property link


extern int MagicNumber = 0;

extern bool SignalMail = False;

extern bool EachTickMode = False;

extern double Lots = 0.1;

extern int Slippage = 3;

extern bool UseStopLoss = True;

extern int StopLoss = 20;

extern bool UseTakeProfit = True;

extern int TakeProfit = 20;

extern bool UseTrailingStop = True;

extern int TrailingStop = 0;


int BarCount;

int Current;

bool TickCheck = False;

//+------------------------------------------------------------------+

//| expert initialization function                                   |

//+------------------------------------------------------------------+

int init() {

   BarCount = Bars;


   if (EachTickMode) Current = 0; else Current = 1;


   return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function                                 |

//+------------------------------------------------------------------+

int deinit() {

   return(0);

}

//+------------------------------------------------------------------+

//| expert start function                                            |

//+------------------------------------------------------------------+

int start() {

   int Order = SIGNAL_NONE;

   int Total, Ticket;

   double StopLossLevel, TakeProfitLevel;




   if (EachTickMode && Bars != BarCount) TickCheck = False;

   Total = OrdersTotal();

   Order = SIGNAL_NONE;


   //+------------------------------------------------------------------+

   //| Variable Begin                                                   |

   //+------------------------------------------------------------------+



double Buy1_1 = iMA(NULL, PERIOD_H1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 1);

double Buy1_2 = iMA(NULL, PERIOD_H1, 15, 0, MODE_SMA, PRICE_CLOSE, Current + 1);

double Buy2_1 = iMA(NULL, PERIOD_H1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);

double Buy2_2 = iMA(NULL, PERIOD_H1, 15, 0, MODE_SMA, PRICE_CLOSE, Current + 0);


double Sell1_1 = iMA(NULL, PERIOD_H1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 1);

double Sell1_2 = iMA(NULL, PERIOD_H1, 15, 0, MODE_SMA, PRICE_CLOSE, Current + 1);

double Sell2_1 = iMA(NULL, PERIOD_H1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);

double Sell2_2 = iMA(NULL, PERIOD_H1, 15, 0, MODE_SMA, PRICE_CLOSE, Current + 0);


double CloseBuy1_1 = iMA(NULL, PERIOD_H1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 1);

double CloseBuy1_2 = iMA(NULL, PERIOD_H1, 15, 0, MODE_SMA, PRICE_CLOSE, Current + 1);

double CloseBuy2_1 = iMA(NULL, PERIOD_H1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);

double CloseBuy2_2 = iMA(NULL, PERIOD_H1, 15, 0, MODE_SMA, PRICE_CLOSE, Current + 0);


double CloseSell1_1 = iMA(NULL, PERIOD_H1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 1);

double CloseSell1_2 = iMA(NULL, PERIOD_H1, 15, 0, MODE_SMA, PRICE_CLOSE, Current + 1);

double CloseSell2_1 = iMA(NULL, PERIOD_H1, 5, 0, MODE_SMA, PRICE_CLOSE, Current + 0);

double CloseSell2_2 = iMA(NULL, PERIOD_H1, 15, 0, MODE_SMA, PRICE_CLOSE, Current + 0);



   

   //+------------------------------------------------------------------+

   //| Variable End                                                     |

   //+------------------------------------------------------------------+


   //Check position

   bool IsTrade = False;


   for (int i = 0; i < Total; i ++) {

      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

      if(OrderType() <= OP_SELL &&  OrderSymbol() == Symbol()) {

         IsTrade = True;

         if(OrderType() == OP_BUY) {

            //Close


            //+------------------------------------------------------------------+

            //| Signal Begin(Exit Buy)                                           |

            //+------------------------------------------------------------------+


                     if (CloseBuy1_1 > CloseBuy1_2 && CloseBuy2_1 < CloseBuy2_2) Order = SIGNAL_CLOSEBUY;



            //+------------------------------------------------------------------+

            //| Signal End(Exit Buy)                                             |

            //+------------------------------------------------------------------+


            if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {

               OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);

               if (SignalMail) 

               if (!EachTickMode) BarCount = Bars;

               IsTrade = False;

               continue;

            }

            //Trailing stop

            if(UseTrailingStop && TrailingStop > 0) {                 

               if(Bid - OrderOpenPrice() > Point * TrailingStop) {

                  if(OrderStopLoss() < Bid - Point * TrailingStop) {

                     OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);

                     if (!EachTickMode) BarCount = Bars;

                     continue;

                  }

               }

            }

         } else {

            //Close


            //+------------------------------------------------------------------+

            //| Signal Begin(Exit Sell)                                          |

            //+------------------------------------------------------------------+


                  if (CloseSell1_1 > CloseSell1_2 && CloseSell2_1 < CloseSell2_2) Order = SIGNAL_CLOSESELL;



            //+------------------------------------------------------------------+

            //| Signal End(Exit Sell)                                            |

            //+------------------------------------------------------------------+


            if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {

               OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);

               if (SignalMail) 

               if (!EachTickMode) BarCount = Bars;

               IsTrade = False;

               continue;

            }

            //Trailing stop

            if(UseTrailingStop && TrailingStop > 0) {                 

               if((OrderOpenPrice() - Ask) > (Point * TrailingStop)) {

                  if((OrderStopLoss() > (Ask + Point * TrailingStop)) || (OrderStopLoss() == 0)) {

                     OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * TrailingStop, OrderTakeProfit(), 0, DarkOrange);

                     if (!EachTickMode) BarCount = Bars;

                     continue;

                  }

               }

            }

         }

      }

   }


   //+------------------------------------------------------------------+

   //| Signal Begin(Entry)                                              |

   //+------------------------------------------------------------------+


   if (Buy1_1 < Buy1_2 && Buy2_1 > Buy2_2) Order = SIGNAL_BUY;


   if (Sell1_1 < Sell1_2 && Sell2_1 > Sell2_2) Order = SIGNAL_SELL;



   //+------------------------------------------------------------------+

   //| Signal End                                                       |

   //+------------------------------------------------------------------+


   //Buy

   if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {

      if(!IsTrade) {

         //Check free margin

         if (AccountFreeMargin() < (1000 * Lots)) {

            Print

            return(0)

         }


         if (UseStopLoss) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0;

         if (UseTakeProfit) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0;


         Ticket = "OrderSend Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel"

            if (Ticket > 0) {"

            if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {

Print

if (SignalMail) SendMail

} else {

Print

}

         }

         if (EachTickMode) TickCheck = True;

         if (!EachTickMode) BarCount = Bars;

         return(0);

      }

   }


   //Sell

      "if" (Order = SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {""

      if(!IsTrade) {

         //Check free margin

         if (AccountFreeMargin() < (1000 * Lots)) {

            Print

            return(0);

         }


         if (UseStopLoss) StopLossLevel = Bid + StopLoss * Point; else StopLossLevel = 0.0;

         if (UseTakeProfit) TakeProfitLevel = Bid - TakeProfit * Point; else TakeProfitLevel = 0.0;


         Ticket = OrderSend Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel,

         if(Ticket > 0) {

            if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {

Print

if (SignalMail) SendMail

} else {

Print

}

         }

         if (EachTickMode) TickCheck = True;

         if (!EachTickMode) BarCount = Bars;

         return(0);

      }

   }


   if (!EachTickMode) BarCount = Bars;


   return(0);

}

//+------------------------------------------------------------------+

Files:
aligato999
17
aligato999 2016.05.11 07:22  

there are 2 of them.

//+------------------------------------------------------------------+

//|                                                  fxeabuilder.mq4 |

//|                                                      fxeabuilder |

//|                                       http://www.fxeabuilder.com |

//+------------------------------------------------------------------+


#property copyright "fxeabuilder.com"

#property link "www.fxeabuilder.com"


// External variables

extern double LotSize = 0.1;

extern double StopLoss = 20;

extern double TakeProfit = 20;

extern double TrailingStopLimit = 0;

extern double TrailingStopStop = 0;

extern int MagicNumber = 23310;



// Global variables

int LongTicket;

int ShortTicket;

double RealPoint;




// Init function

int init()

{

      RealPoint = RealPipPoint(Symbol());

     

}



// Start function

int start()

        //Variables

        

// Long

;OrderSelect(LongTicket,SELECT_BY_TICKET);

  if(OrderCloseTime() != 0 || LongTicket == 0)


                

                    

bool buy_condition_1 = iMA(NULL, PERIOD_H1, 5, 0, MODE_SMA, PRICE_CLOSE, 1)  < iMA(NULL, PERIOD_H1, 15, 0, MODE_SMA, PRICE_CLOSE, 1)   ;

bool buy_condition_2 = iMA(NULL, PERIOD_H1, 5, 0, MODE_SMA, PRICE_CLOSE, 0)  > iMA(NULL, PERIOD_H1, 15, 0, MODE_SMA, PRICE_CLOSE, 0)  ;



                                 

if(buy_condition_1), buy_condition_2)

{

OrderSelect(ShortTicket,SELECT_BY_TICKET);

if(OrderCloseTime() == 0 && ShortTicket > 0)

{

bool Closed = OrderClose(ShortTicket,OrderLots(),Ask,0,Red);

}


LongTicket = OrderSend(Symbol(),OP_BUY,LotSize,Ask,0,0,0,"Buy Order",MagicNumber,0,Green);

OrderSelect(LongTicket,SELECT_BY_TICKET); 

double OpenPrice = OrderOpenPrice();

            

             

            if(StopLoss > 0) double LongStopLoss = OpenPrice - (StopLoss * RealPoint);

            if(TakeProfit > 0) double LongTakeProfit = OpenPrice + (TakeProfit * RealPoint);

            

            

if(LongStopLoss > 0 || LongTakeProfit > 0) 

{

               bool LongMod = OrderModify(LongTicket,OpenPrice,LongStopLoss, LongTakeProfit,0);

}

ShortTicket = 0;

}

}

               

//Close long

      if (OrdersTotal() > 0)

{              

                

                    

                

                    

                    

bool close_buy_condition_1 = iMA(NULL, PERIOD_H1, 5, , MODE_SMA, PRICE_CLOSE, 1)  > iMA(NULL, PERIOD_H1, 15, , MODE_SMA, PRICE_CLOSE, 1)   ;

bool close_buy_condition_2 = iMA(NULL, PERIOD_H1, 5, , MODE_SMA, PRICE_CLOSE, 0)  < iMA(NULL, PERIOD_H1, 15, , MODE_SMA, PRICE_CLOSE, 0)  ;


                    

if( close_buy_condition_1    close_buy_condition_2   )

{

OrderSelect(LongTicket,SELECT_BY_TICKET);

if(OrderCloseTime() == 0 && LongTicket > 0)

{


Closed = OrderClose(LongTicket,OrderLots(),Bid,0,Red);

LongTicket = 0;

}

   }

}

                               

// Short

OrderSelect(ShortTicket,SELECT_BY_TICKET);

if(OrderCloseTime() != 0 || ShortTicket == 0)

{

 

                

                                    

bool sell_condition_1 = iMA(NULL, PERIOD_H1, 5, , MODE_SMA, PRICE_CLOSE, 1)  < iMA(NULL, PERIOD_H1, 15, , MODE_SMA, PRICE_CLOSE, 1)   ;

bool sell_condition_2 = iMA(NULL, PERIOD_H1, 5, , MODE_SMA, PRICE_CLOSE, 0)  > iMA(NULL, PERIOD_H1, 15, , MODE_SMA, PRICE_CLOSE, 0)  ;

  

                                    

if( sell_condition_1    sell_condition_2   )

{

  

OrderSelect(LongTicket,SELECT_BY_TICKET);

if(OrderCloseTime() == 0 && LongTicket > 0)

{


Closed = OrderClose(LongTicket,OrderLots(),Bid,0,Red);

}

ShortTicket = OrderSend(Symbol(),OP_SELL,LotSize,Bid,0,0,0,"Sell Order",MagicNumber,0,Red);

OrderSelect(ShortTicket,SELECT_BY_TICKET); 

OpenPrice = OrderOpenPrice();

            

            

            if(StopLoss > 0) double ShortStopLoss = OpenPrice + (StopLoss * RealPoint);

            if(TakeProfit > 0) double ShortTakeProfit = OpenPrice - (TakeProfit * RealPoint);

            

if(ShortStopLoss > 0 || ShortTakeProfit > 0) 

{

               bool ShortMod = OrderModify(ShortTicket,OpenPrice,ShortStopLoss, ShortTakeProfit,0);

}

LongTicket = 0;

}

}

                             


                

//Close Short

if (OrdersTotal() > 0)

{

 

                 

                                     

bool close_sell_condition_1 = iMA(NULL, PERIOD_H1, 5, , MODE_SMA, PRICE_CLOSE, 1)  > iMA(NULL, PERIOD_H1, 15, , MODE_SMA, PRICE_CLOSE, 1)   ;

bool close_sell_condition_2 = iMA(NULL, PERIOD_H1, 5, , MODE_SMA, PRICE_CLOSE, 0)  < iMA(NULL, PERIOD_H1, 15, , MODE_SMA, PRICE_CLOSE, 0)  ;


 

if( close_sell_condition_1    close_sell_condition_2   )

{

OrderSelect(ShortTicket,SELECT_BY_TICKET);

if(OrderCloseTime() == 0 && ShortTicket > 0)

{


Closed = OrderClose(ShortTicket,OrderLots(),Ask,0,Red);

ShortTicket = 0;

}

                        }

}

 

return(0);

}



// Pip Point Function

double RealPipPoint(string Currency)

{

int CalcDigits = MarketInfo(Currency,MODE_DIGITS);

if(CalcDigits == 2 || CalcDigits == 3) double CalcPoint = 0.01;

else if(CalcDigits == 4 || CalcDigits == 5) CalcPoint = 0.0001;

return(CalcPoint);

}

         

Files:
Keith Watford
Moderator
7896
Keith Watford 2016.05.11 08:23  

You now know that EA builders create poor quality code.

This forum is more about coders helping coders.

Fernando Carreiro
1440
Fernando Carreiro 2016.05.11 08:26  

Please stop using Code Generators! They produce very bad code and the users here are not going to fix those errors for you.

So, you either, learn to code or pay someone to fix it or code a new EA for you (see either the "Documentation", the "Book" or the "Freelance" sections).

If you really want to use a Code Generator, then contact the "makers" and have them fix it. They have a Forum too, so post your complaints and a request for fixes there.

whroeder1
13602
whroeder1 2016.05.11 13:20  

aligato999: i have recently created my own EA, but there is more than 30 error which i have no idea how to fix.

//| This MQL is generated by Expert Advisor Builder                  |
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

    • We hate EA builder
    • You couldn't be bothered to learn mql4, therefor there is no common language for us to communicate.
    • There are only two choices: learn to code it, or pay someone. We're not going to code it FOR you. 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 lines of code.
    • 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
    • EA builder makes bad code Not adjusting for 4/5 digit brokers
    • EA builder makes bad code not adjusting for ECN brokers.
    • 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/reboot.)
aligato999
17
aligato999 2016.05.11 17:34  

ok guys, thanks all.

 

i will find someone to look into it . :)))

 

^^ 

/
To add comments, please log in or register