int ticket, itmp_, itmp=0, Per_240;       bool Bull, t_Sent=false;

int OnInit() {
   Comment("** Entry_Points_Pro Ind - en cours **");
   return(INIT_SUCCEEDED); }

int start() { if (Period() < 30) { bool tst=false;         string temp, name;          itmp_ = itmp;
      if (ObjectsTotal()) for (int pos=0; pos < ObjectsTotal() && ! tst; pos ++) { name = ObjectName(pos);
            tst = name == "eFess_ Success rate";         temp = ObjectGetString(0, name, OBJPROP_TEXT);
            itmp = tst && StringSubstr(temp, StringLen(temp) - 1) == "%"? StrToInteger(StringSubstr(temp, StringLen(temp) - 3, 2)): 0; }
if ((! itmp_ || itmp_ != itmp) && tst) Print("*** eFess_ Success rate! - " + name + " - " + temp + " - " + IntegerToString(itmp) + " ***");

      t_Sent = OrdersTotal();       if (t_Sent && ! ticket) { ticket = GlobalVariableGet(Symbol() + "_ticket_240");
         if (ticket > 0) Per_240 = GlobalVariableGet(Symbol() + "_Period"); }          if (! Per_240) Per_240 = 1;
      t_Sent = ticket;        Bull = t_Sent && OrderSelect(ticket, SELECT_BY_TICKET) && ! OrderCloseTime() && ! OrderType();

      if (iCustom(NULL, 0, "Entry_Points_Pro.ex4", "", 1000, "", 0, 0, 500, "", 0, "", "08:00", "21:00", "", 1, 90,
         2, DeepSkyBlue, Red, LimeGreen, LightSkyBlue, "", (GlobalVariableGet(Symbol() + "_ticket_240") > 0? true: false), 2, 0) > 0.0 &&
      GlobalVariableCheck(Symbol() + "_ticket_240") && (floor(TimeCurrent() / (60 * Per_240)) == floor(GlobalVariableGet(Symbol() + "_tim1_240") / (60 * Per_240)) ||
      (floor(TimeCurrent() / (60 * Per_240)) - floor(GlobalVariableGet(Symbol() + "_tim1_240") / (60 * Per_240)) < 2 && itmp >= 72)) &&
      t_Sent && ! Bull) { GlobalVariableSet(Symbol() + "_M5_Buy", 1);            GlobalVariableSet(Symbol() + "_M5_tim1", TimeCurrent());
Alert("*** BUY M5! - " + TimeToStr(TimeCurrent(), TIME_MINUTES) + " ***"); }

      if (iCustom(NULL, 0, "Entry_Points_Pro.ex4", "", 1000, "", 0, 0, 500, "", 0, "", "08:00", "21:00", "", 1, 90,
         2, DeepSkyBlue, Red, LimeGreen, LightSkyBlue, "", (GlobalVariableGet(Symbol() + "_ticket_240") > 0? true: false), 3, 0) > 0.0 &&
      GlobalVariableCheck(Symbol() + "_ticket_240") && (floor(TimeCurrent() / (60 * Per_240)) == floor(GlobalVariableGet(Symbol() + "_tim1_240") / (60 * Per_240)) ||
      (floor(TimeCurrent() / (60 * Per_240)) - floor(GlobalVariableGet(Symbol() + "_tim1_240") / (60 * Per_240)) < 2 && itmp >= 72)) &&
      t_Sent && Bull) { GlobalVariableSet(Symbol() + "_M5_Sell", 1);             GlobalVariableSet(Symbol() + "_M5_tim2", TimeCurrent());
Alert("*** SELL M5! - " + TimeToStr(TimeCurrent(), TIME_MINUTES) + " ***"); }

      if (! iCustom(NULL, 0, "Entry_Points_Pro.ex4", "", 1000, "", 0, 0, 500, "", 0, "", "08:00", "21:00", "", 1, 90,
      2, DeepSkyBlue, Red, LimeGreen, LightSkyBlue, "", (GlobalVariableGet(Symbol() + "_ticket_240") > 0? true: false), 2, 0) && GlobalVariableGet(Symbol() + "_M5_Buy")) {
         GlobalVariableSet(Symbol() + "_M5_Buy", 0);           GlobalVariableSet(Symbol() + "_M5_tim1", 0); }
      if (! iCustom(NULL, 0, "Entry_Points_Pro.ex4", "", 1000, "", 0, 0, 500, "", 0, "", "08:00", "21:00", "", 1, 90,
      2, DeepSkyBlue, Red, LimeGreen, LightSkyBlue, "", (GlobalVariableGet(Symbol() + "_ticket_240") > 0? true: false), 3, 0) && GlobalVariableGet(Symbol() + "_M5_Sell")) {
         GlobalVariableSet(Symbol() + "_M5_Sell", 0);          GlobalVariableSet(Symbol() + "_M5_tim2", 0); } }

   return(0); }

void OnDeinit(const int reason) { Comment(""); }
