//+--------------------------------------------------------------------+
//|                        "Liste dObjets.mqh"          Utilisé dans : |
//|              "Liste dObjets (6).mq4" "Ind Liste dObjets (all).mq4" |
//|              "Liste dObjets EA.mq4" "Ind Liste dObjets (cha2).mq4" |
//+--------------------------------------------------------------------+

//Op_Shw2 = false;
//params[0] = exp_Level, params[1] = op_HiLo, params[2] = op_Exp
double ExtOpenBuffer[], ExtCloseBuffer[]/*, ExtLowHighBuffer[], ExtHighLowBuffer[]*/;
string liq_Type, liq_Type2;        double pr_Clo, reOpn_pr, reClo_pr;     // -> obj_prClots[pos] reOpn_prs[k] reClo_prs[k]

/* double haOpen, haClose, haHigh, haLow; -> utiliser ici en remplacement des iOpen(...), iClose(...), iHigh(...), iLow(...) */
bool f_mqh_code(int mode, int mqh_code, int pos, int prv_pos, int i, int k,double &params[]) { bool t_clo;
   bool op_HiLo=params[1], op_Exp=params[2];       // attention sur "Liste dObjets (6b).mq4" autre valeur possible de params[1]
   double day1_Open, day1_Close, this_Open, this_Close, this_High, this_Low;
   if (ha_Opt) { day1_Open = ha1Open;  day1_Close = ha1Close;     this_Open = haOpen;  this_Close = haClose;   this_High = haHigh;  this_Low = haLow; }
   else if (mode==1) { day1_Open = iOpen(NULL,0,Bars-i+1);        day1_Close = iClose(NULL,0,Bars-i+1);
      this_Open = iOpen(NULL,0,Bars-i);      this_Close = iClose(NULL,0,Bars-i);    this_High = iHigh(NULL,0,Bars-i);  this_Low = iLow(NULL,0,Bars-i); }
   else if (mode==2) { day1_Open = iOpen(sym_target,per_target,Bars-i+1);       day1_Close = iClose(sym_target,per_target,Bars-i+1);
      this_Open = iOpen(sym_target,per_target,Bars-i);            this_Close = iClose(sym_target,per_target,Bars-i);
      this_High = iHigh(sym_target,per_target,Bars-i);            this_Low = iLow(sym_target,per_target,Bars-i); }
#ifdef o_mqh
   liq_Type = obj_liqTypes[pos];    liq_Type2 = obj_liqTypes[prv_pos];
   pr_Clo = ha_Opt? haClose: obj_prClots[pos];
   reOpn_pr = ha_Opt? haClose: reOpn_prs[k];
   reClo_pr = ha_Opt? haClose: reClo_prs[k];
#endif

/* if (StrToTime("2020.8.25 12:07") == Time[Bars-i] || StrToTime("2020.8.25 12:08") == Time[Bars-i]) {
   Print("*** (1) "+TimeToStr(Time[Bars-i],TIME_DATE|TIME_MINUTES)+" "+DoubleToStr(this_Open,5)+" "+DoubleToStr(this_Close,5)+" "+DoubleToStr(this_High,5)+" "+DoubleToStr(this_Low,5)+" ***");
   Print("*** (2) "+TimeToStr(Time[Bars-i],TIME_DATE|TIME_MINUTES)+" "+DoubleToStr(haOpen,5)+" "+DoubleToStr(haClose,5)+" "+DoubleToStr(haHigh,5)+" "+DoubleToStr(haLow,5)+" ***"); } */

   switch (mqh_code) {
      case 0: /* t_clo = (iHigh(NULL,0,Bars-i) - iLow(NULL,0,Bars-i) > 0.0 &&            // cette option retirée double presque le résulat final **
            ((obj_liqTypes[pos]=="Buy" ? -1 : 1) * (obj_prClots[pos]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) > 0.3 &&
            ((obj_liqTypes[pos]=="Buy" ? -1 : 1) * (iClose(NULL,0,Bars-i) - iOpen(NULL,0,Bars-i+1)) > 20 * Point ||
            ((obj_liqTypes[pos]=="Buy" ? -1 : 1) * (iClose(NULL,0,Bars-i+1) - iOpen(NULL,0,Bars-i+1))) > 20 * Point)));/*
            (((obj_liqTypes[pos]=="Buy" ? -1 : 1) * (obj_prClots[pos]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) > 0.3 && 
            (!Op_OHL || (obj_liqTypes[pos]=="Buy"? -1: 1) * (iOpen(NULL,0,Bars-i) - (iHigh(NULL,0,Bars-i)+iLow(NULL,0,Bars-i)) / 2) > 20 * Point ||
            (obj_liqTypes[pos]=="Buy" ? -1 : 1) * (obj_prClots[pos]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) > 0.75)) ||
            ((obj_liqTypes[pos]=="Buy" ? -1 : 1) * (obj_prClots[pos] - iOpen(NULL,0,Bars-i)) > 20 * Point && 
            (obj_liqTypes[pos]=="Buy" ? -1 : 1) * (iOpen(NULL,0,Bars-i) - (iHigh(NULL,0,Bars-i)+iLow(NULL,0,Bars-i)) / 2) > 20 * Point &&
            (obj_liqTypes[pos]=="Buy" ? -1 : 1) * (iOpen(NULL,0,Bars-i) - (iOpen(NULL,0,Bars-i+1)+iClose(NULL,0,Bars-i+1)) / 2) > 20 * Point &&
            (obj_liqTypes[pos]=="Buy" ? -1 : 1) * (obj_prClots[pos]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) < 0.3)));*/
//    attention Op_OHL et op_HiLo -> 2 options de calcul différentes - alors que Op_HiLo est pour l'affichage de certains Labels    **

         t_clo = (((op_HiLo && this_High-this_Low > 0.0) || !op_HiLo) && ((fabs(params[0]-this_Close) > 0.001) || !op_Exp) && 
            ((liq_Type == "Buy" ? -1 : 1) * (pr_Clo - this_Open) / (this_High - this_Low) > 0.3 &&
            ((liq_Type == "Buy" ? -1 : 1) * (this_Close - day1_Open) > 20 * Point ||
            ((liq_Type == "Buy" ? -1 : 1) * (day1_Close - day1_Open)) > 20 * Point)));
         break;
      case 1: /* t_clo = (iHigh(NULL,0,Bars-i) - iLow(NULL,0,Bars-i) > 0.0 && 
            (((obj_liqTypes[pos]=="Buy" ? 1 : -1) * (reOpn_prs[k]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) > 0.3 && 
            (!Op_OHL || (obj_liqTypes[pos]=="Buy"? -1: 1) * (iOpen(NULL,0,Bars-i) - (iHigh(NULL,0,Bars-i)+iLow(NULL,0,Bars-i)) / 2) > 20 * Point)) ||
            ((obj_liqTypes[pos]=="Buy" ? 1 : -1) * (reOpn_prs[k] - iOpen(NULL,0,Bars-i)) > 20 * Point && 
            (obj_liqTypes[pos]=="Buy" ? 1 : -1) * (iOpen(NULL,0,Bars-i) - (iHigh(NULL,0,Bars-i)+iLow(NULL,0,Bars-i)) / 2) > 20 * Point &&
            (obj_liqTypes[pos]=="Buy" ? 1 : -1) * (reOpn_prs[k]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) < 0.3))); //*/

         t_clo = (this_High - this_Low > 0.0 && 
            (((liq_Type == "Buy" ? 1 : -1) * (reOpn_pr - this_Open) / (this_High - this_Low) > 0.3 && 
            (!Op_OHL || (liq_Type == "Buy"? -1: 1) * (this_Open - (this_High + this_Low) / 2) > 20 * Point)) ||
            ((liq_Type == "Buy" ? 1 : -1) * (reOpn_pr - this_Open) > 20 * Point && 
            (liq_Type == "Buy" ? 1 : -1) * (this_Open - (this_High + this_Low) / 2) > 20 * Point &&
            (liq_Type == "Buy" ? 1 : -1) * (reOpn_pr - this_Open) / (this_High - this_Low) < 0.3)));
         break;
      case 2:/*  t_clo = ((obj_liqTypes[pos]=="Buy" ? -1 : 1) * (obj_prClots[pos]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) > 0.3);
               HiLoVal = ((iHigh(NULL,0,Bars-i+5)-iLow(NULL,0,Bars-i+5)) + (iHigh(NULL,0,Bars-i+1)-iLow(NULL,0,Bars-i+1)) + (iHigh(NULL,0,Bars-i+2)-
                  iLow(NULL,0,Bars-i+2)) + (iHigh(NULL,0,Bars-i+3)-iLow(NULL,0,Bars-i+3)) + (iHigh(NULL,0,Bars-i+4)-iLow(NULL,0,Bars-i+4))) / Point / 5;
               MrktVal = (obj_liqTypes[pos]=="Buy"? 1: obj_liqTypes[pos]=="Sell"? -1: 0) * ((obj_liqTypes[pos]=="Buy"? j==i? iHigh(NULL,0,Bars-i): 
                  iLow(NULL,0,Bars-i): j==i? iLow(NULL,0,Bars-i): iHigh(NULL,0,Bars-i)) - reOpn_prs[k]) / Point; * /
            t_clo = (iHigh(NULL,0,Bars-i) - iLow(NULL,0,Bars-i) > 0.0 && 
            (((obj_liqTypes[pos]=="Buy" ? -1 : 1) * (reClo_prs[k]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) > 0.3 && 
            (!Op_OHL || (obj_liqTypes[pos]=="Buy"? -1: 1) * (iOpen(NULL,0,Bars-i) - (iHigh(NULL,0,Bars-i)+iLow(NULL,0,Bars-i)) / 2) > 20 * Point ||
            (obj_liqTypes[pos]=="Buy" ? -1 : 1) * (reClo_prs[k]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) > 0.75)) ||
            ((obj_liqTypes[pos]=="Buy" ? -1 : 1) * (reClo_prs[k] - iOpen(NULL,0,Bars-i)) > 20 * Point && 
            (obj_liqTypes[pos]=="Buy" ? -1 : 1) * (iOpen(NULL,0,Bars-i) - (iHigh(NULL,0,Bars-i)+iLow(NULL,0,Bars-i)) / 2) > 20 * Point &&
            (obj_liqTypes[pos]=="Buy" ? -1 : 1) * (iOpen(NULL,0,Bars-i) - (iOpen(NULL,0,Bars-i+1)+iClose(NULL,0,Bars-i+1)) / 2) > 20 * Point &&
            (obj_liqTypes[pos]=="Buy" ? -1 : 1) * (reClo_prs[k]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) < 0.3)/* ||
               (HighVal-MrktVal > HiLoVal * 2 && HighVal && MrktVal-HighVal < DDwnVal / 4*3)* /)); //*/

         t_clo = (this_High - this_Low > 0.0 && 
            (((liq_Type == "Buy" ? -1 : 1) * (reClo_pr - this_Open) / (this_High - this_Low) > 0.3 && 
            (!Op_OHL || (liq_Type == "Buy"? -1: 1) * (this_Open - (this_High + this_Low) / 2) > 20 * Point ||
            (liq_Type == "Buy" ? -1 : 1) * (reClo_pr - this_Open) / (this_High - this_Low) > 0.75)) ||
            ((liq_Type == "Buy" ? -1 : 1) * (reClo_pr - this_Open) > 20 * Point && 
            (liq_Type == "Buy" ? -1 : 1) * (this_Open - (this_High + this_Low) / 2) > 20 * Point &&
            (liq_Type == "Buy" ? -1 : 1) * (this_Open - (day1_Open + day1_Close) / 2) > 20 * Point &&
            (liq_Type == "Buy" ? -1 : 1) * (reClo_pr - this_Open) / (this_High - this_Low) < 0.3)));
         break;
      case 3: /* t_clo = (iHigh(NULL,0,Bars-i) - iLow(NULL,0,Bars-i) > 0.0 && 
            ((obj_liqTypes[prv_pos]=="Buy" ? -1 : 1) * (obj_prClots[pos]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) > 0.3 &&
            ((obj_liqTypes[prv_pos]=="Buy" ? -1 : 1) * (iClose(NULL,0,Bars-i) - iOpen(NULL,0,Bars-i+1)) > 20 * Point ||
            ((obj_liqTypes[prv_pos]=="Buy" ? -1 : 1) * (iClose(NULL,0,Bars-i+1) - iOpen(NULL,0,Bars-i+1))) > 20 * Point))); //*/

         t_clo = (this_High - this_Low > 0.0 && 
            ((liq_Type2 == "Buy" ? -1 : 1) * (pr_Clo - this_Open) / (this_High - this_Low) > 0.3 &&
            ((liq_Type2 == "Buy" ? -1 : 1) * (this_Close - day1_Open) > 20 * Point ||
            ((liq_Type2 == "Buy" ? -1 : 1) * (day1_Close - day1_Open)) > 20 * Point)));
         break;
      case 4: /* t_clo = (iHigh(NULL,0,Bars-i) - iLow(NULL,0,Bars-i) > 0.0 &&                                    // boucle des reOps Label_Arrow_Test(Type= 1,
            (((obj_liqTypes[prv_pos]=="Buy" ? 1 : -1) * (reOpn_prs[k]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) > 0.3 && 
            (!Op_OHL || (obj_liqTypes[prv_pos]=="Buy"? -1: 1) * (iOpen(NULL,0,Bars-i) - (iHigh(NULL,0,Bars-i)+iLow(NULL,0,Bars-i)) / 2) > 20 * Point)) ||
            ((obj_liqTypes[prv_pos]=="Buy" ? 1 : -1) * (reOpn_prs[k] - iOpen(NULL,0,Bars-i)) > 20 * Point && 
            (obj_liqTypes[prv_pos]=="Buy" ? 1 : -1) * (iOpen(NULL,0,Bars-i) - (iHigh(NULL,0,Bars-i)+iLow(NULL,0,Bars-i)) / 2) > 20 * Point &&
            (obj_liqTypes[prv_pos]=="Buy" ? 1 : -1) * (reOpn_prs[k]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) < 0.3))); //*/

         t_clo = (this_High - this_Low > 0.0 && 
            (((liq_Type2 == "Buy" ? 1 : -1) * (reOpn_pr - this_Open) / (this_High - this_Low) > 0.3 && 
            (!Op_OHL || (liq_Type2 == "Buy"? -1: 1) * (this_Open - (this_High + this_Low) / 2) > 20 * Point)) ||
            ((liq_Type2 == "Buy" ? 1 : -1) * (reOpn_pr - this_Open) > 20 * Point && 
            (liq_Type2 == "Buy" ? 1 : -1) * (this_Open - (this_High + this_Low) / 2) > 20 * Point &&
            (liq_Type2 == "Buy" ? 1 : -1) * (reOpn_pr - this_Open) / (this_High - this_Low) < 0.3)));
         break;
      case 5: /* t_clo = ((obj_liqTypes[pos]=="Buy" ? -1 : 1) * (obj_prClots[pos]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) > 0.3);
               t_clo = (iHigh(NULL,0,Bars-i) - iLow(NULL,0,Bars-i) > 0.0 && 
            (((obj_liqTypes[prv_pos]=="Buy" ? -1 : 1) * (reClo_prs[k]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) > 0.3 && 
            (!Op_OHL || (obj_liqTypes[prv_pos]=="Buy"? -1: 1) * (iOpen(NULL,0,Bars-i) - (iHigh(NULL,0,Bars-i)+iLow(NULL,0,Bars-i)) / 2) > 20 * Point ||
            (obj_liqTypes[prv_pos]=="Buy" ? -1 : 1) * (reClo_prs[k]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) > 0.75)) ||
            ((obj_liqTypes[prv_pos]=="Buy" ? -1 : 1) * (reClo_prs[k] - iOpen(NULL,0,Bars-i)) > 20 * Point && 
            (obj_liqTypes[prv_pos]=="Buy" ? -1 : 1) * (iOpen(NULL,0,Bars-i) - (iHigh(NULL,0,Bars-i)+iLow(NULL,0,Bars-i)) / 2) > 20 * Point &&
            (obj_liqTypes[prv_pos]=="Buy" ? -1 : 1) * (iOpen(NULL,0,Bars-i) - (iOpen(NULL,0,Bars-i+1)+iClose(NULL,0,Bars-i+1)) / 2) > 20 * Point &&
            (obj_liqTypes[prv_pos]=="Buy" ? -1 : 1) * (reClo_prs[k]-iOpen(NULL,0,Bars-i)) / (iHigh(NULL,0,Bars-i)-iLow(NULL,0,Bars-i)) < 0.3))); //*/

         t_clo = (this_High - this_Low > 0.0 && 
            (((liq_Type2 == "Buy" ? -1 : 1) * (reClo_pr - this_Open) / (this_High - this_Low) > 0.3 && 
            (!Op_OHL || (liq_Type2 == "Buy"? -1: 1) * (this_Open - (this_High + this_Low) / 2) > 20 * Point ||
            (liq_Type2 == "Buy" ? -1 : 1) * (reClo_pr - this_Open) / (this_High - this_Low) > 0.75)) ||
            ((liq_Type2 == "Buy" ? -1 : 1) * (reClo_pr - this_Open) > 20 * Point && 
            (liq_Type2 == "Buy" ? -1 : 1) * (this_Open - (this_High + this_Low) / 2) > 20 * Point &&
            (liq_Type2 == "Buy" ? -1 : 1) * (this_Open - (day1_Open + day1_Close) / 2) > 20 * Point &&
            (liq_Type2 == "Buy" ? -1 : 1) * (reClo_pr - this_Open) / (this_High - this_Low) < 0.3)));
         break;
      case 6:
         break;
      case 7:
         break;
/*      case 1:
         break;
      case 1:
         break;
      case 1:
         break;
      case 1:
         break;
      case 1:
         break;
      case 1:
         break;
      case 1:
         break;
      case 1:
         break;
      case 1:
         break;
      case 1:
         break;
      default:   
*/     }
   return(t_clo); }

bool f_mqh_code_EA(int mqh_code, int pos, int prv_pos, int i, string liq_typ, double pr_clo, double reopn_pr, double reclo_pr, double &params[]) {
   liq_Type = liq_typ;     liq_Type2 = liq_typ;     pr_Clo = pr_clo;     reOpn_pr = reopn_pr;       reClo_pr = reclo_pr;
   bool t_clo = f_mqh_code(1, mqh_code, pos, prv_pos, i, -1, params);   // <- récupérer ici exp_level
   return(t_clo); }

bool HA_Bull(int mode, double vOpen, double vClose, double vHigh, double vLow, int vBar, long vChart) {
/*   haOpen = (ExtOpenBuffer[i-1]+ExtCloseBuffer[i-1])/2;
   haClose=(open[i]+high[i]+low[i]+close[i])/4;
   haHigh=MathMax(high[i],MathMax(haOpen,haClose));
   haLow=MathMin(low[i],MathMin(haOpen,haClose)); */

   if (mode==2) vBar = iBarShift(NULL, 0, iTime(sym_target,per_target,vBar), false);
   ha1Open = vBar >= (mode==2? iBars(sym_target,per_target): Bars)-1? haOpen: 
      ExtOpenBuffer[(mode==2? iBars(sym_target,per_target): Bars)-vBar-2];
   ha1Close = vBar >= (mode==2? iBars(sym_target,per_target): Bars)-1? haClose: 
      ExtCloseBuffer[(mode==2? iBars(sym_target,per_target): Bars)-vBar-2];
   haOpen = vBar >= (mode==2? iBars(sym_target,per_target): Bars)-1? vOpen: 
      ExtOpenBuffer[(mode==2? iBars(sym_target,per_target): Bars)-vBar-1];
   haClose = vBar >= (mode==2? iBars(sym_target,per_target): Bars)-1? vClose: 
      ExtCloseBuffer[(mode==2? iBars(sym_target,per_target): Bars)-vBar-1];
   haHigh = MathMax(vHigh, MathMax(haOpen, haClose));
   haLow = MathMin(vLow, MathMin(haOpen, haClose));

/*   if (ha_Opt) { DrawArrow_HA(haOpen, vBar, 3, (haOpen < haClose), vChart);
      DrawArrow_HA(haClose, vBar, 3, (haOpen < haClose), vChart);
      DrawArrow_HA(haHigh, vBar, 2, (haOpen < haClose), vChart);
      DrawArrow_HA(haLow, vBar, 1, (haOpen < haClose), vChart); } //*/

   return(haOpen < haClose); }

void HA_Buffers(int mode) { int i,pos;
//   double haOpen,haHigh,haLow,haClose;
   if ((ha_Opt && (mode==2? iBars(sym_target,per_target): Bars)<=10) || !ha_Opt) return;
/*   ArraySetAsSeries(ExtOpenBuffer,false);
   ArraySetAsSeries(ExtCloseBuffer,false);
   ArraySetAsSeries(ExtLowHighBuffer,false);
   ArraySetAsSeries(ExtHighLowBuffer,false);
   if(iOpen(NULL,0,Bars-1) < iClose(NULL,0,Bars-1)) {
      ExtLowHighBuffer[0] = iLow(NULL,0,Bars-1);
      ExtHighLowBuffer[0] = iHigh(NULL,0,Bars-1); }
   else {
      ExtLowHighBuffer[0] = iHigh(NULL,0,Bars-1);
      ExtHighLowBuffer[0] = iLow(NULL,0,Bars-1); } */
   if (mode == 2) {
      ExtOpenBuffer[0] = iOpen(sym_target,per_target,iBars(sym_target,per_target)-1);
      ExtCloseBuffer[0] = iClose(sym_target,per_target,iBars(sym_target,per_target)-1); }
   else { ExtOpenBuffer[0] = iOpen(NULL,0,Bars-1);
      ExtCloseBuffer[0] = iClose(NULL,0,Bars-1); }

   pos = 1;   for(i = pos; i < (mode==2? iBars(sym_target,per_target): Bars); i++) {
      haOpen = (ExtOpenBuffer[i-1] + ExtCloseBuffer[i-1]) / 2;
      if (mode==2) haClose = (iOpen(sym_target,per_target,iBars(sym_target,per_target)-i-1)+
         iHigh(sym_target,per_target,iBars(sym_target,per_target)-i-1) +
         iLow(sym_target,per_target,iBars(sym_target,per_target)-i-1) +
         iClose(sym_target,per_target,iBars(sym_target,per_target)-i-1)) / 4;
      else haClose = (iOpen(NULL,0,Bars-i-1)+iHigh(NULL,0,Bars-i-1)+iLow(NULL,0,Bars-i-1)+iClose(NULL,0,Bars-i-1))/4;
/*      haHigh = MathMax(iHigh(NULL,0,Bars-i-1), MathMax(haOpen,haClose));
      haLow = MathMin(iLow(NULL,0,Bars-i-1), MathMin(haOpen,haClose));
      if(haOpen<haClose) {
         ExtLowHighBuffer[i] = haLow;
         ExtHighLowBuffer[i] = haHigh; }
      else {
         ExtLowHighBuffer[i] = haHigh;
         ExtHighLowBuffer[i] = haLow; } */
      ExtOpenBuffer[i] = haOpen;
      ExtCloseBuffer[i] = haClose;              /* if (i > Bars-10) {

      Print("** ExtOpenBuffer[i-2] ",ExtOpenBuffer[i-2]," ExtOpenBuffer[i-1] ",ExtOpenBuffer[i-1]," ExtOpenBuffer[i] ",ExtOpenBuffer[i]," | ",i," ... ");
      Print(" (suite) ExtCloseBuffer[i-2] ",ExtCloseBuffer[i-2]," ExtCloseBuffer[i-1] ",ExtCloseBuffer[i-1]," ExtCloseBuffer[i] ",ExtCloseBuffer[i]," ... ");
      Print(" (suite) iOpen(Bars-i-1) ",iOpen(NULL,0,Bars-i-1)," iHigh(Bars-i-1) ",iHigh(NULL,0,Bars-i-1)," iLow(Bars-i-1) ",iLow(NULL,0,Bars-i-1)," iClose(Bars-i-1) ",iClose(NULL,0,Bars-i-1)," ... ");
      Print(" (suite) iOpen(Bars-i) ",iOpen(NULL,0,Bars-i)," iHigh(Bars-i) ",iHigh(NULL,0,Bars-i)," iLow(Bars-i) ",iLow(NULL,0,Bars-i)," iClose(Bars-i) ",iClose(NULL,0,Bars-i)," ... ");
      Print(" (suite) iOpen(Bars-i+1) ",iOpen(NULL,0,Bars-i+1)," iHigh(Bars-i+1) ",iHigh(NULL,0,Bars-i+1)," iLow(Bars-i+1) ",iLow(NULL,0,Bars-i+1)," iClose(Bars-i+1) ",iClose(NULL,0,Bars-i+1)," ... ");
      Print(" (suite) TimeToStr(Bars-i-1) ",TimeToStr(iTime(NULL,0,Bars-i-1),TIME_DATE|TIME_MINUTES)," TimeToStr(Bars-i) ",TimeToStr(iTime(NULL,0,Bars-i),TIME_DATE|TIME_MINUTES),
         " TimeToStr(Bars-i+1) ",TimeToStr(iTime(NULL,0,Bars-i+1),TIME_DATE|TIME_MINUTES)," **"); } */ }
   return; }

void DrawArrow_HA(double LinePrice,int BarNum,int Code,bool Bullish,long vChart) {
//   if (vChart) BarNum = iBarShift(NULL, 0, iTime(sym_target,per_target,BarNum), false);
   string ArrowName = "H-A_Test_Arr"+(Bullish?"-Up_":"-Down_")+IntegerToString(Code)+"-"+IntegerToString(BarNum)+"-"+LinePrice;
   if (! ObjectCreate(ArrowName,OBJ_ARROW,0,Time[BarNum],LinePrice) && ha_Buff) {}         //vChart,
//      Print("** ArrowName ",ArrowName," LinePrice ",LinePrice," BarNum ",BarNum," Code ",Code," Bullish ",Bullish," Error ",GetLastError()," **");
   ObjectSet(ArrowName, OBJPROP_STYLE, STYLE_SOLID);
   ObjectSet(ArrowName, OBJPROP_ARROWCODE, Code);
//   ObjectSet(ArrowName, OBJPROP_COLOR, Bullish? clrDeepSkyBlue: clrYellow);
   ObjectSet(ArrowName, OBJPROP_COLOR, Bullish? clrLime: clrDeepPink);
   ObjectSet(ArrowName, OBJPROP_SELECTABLE, 0);
   ObjectSet(ArrowName, OBJPROP_SELECTED, 0);
   ObjectSet(ArrowName, OBJPROP_WIDTH, 1);
//   ObjectSet(ArrowName, OBJPROP_BACK, true);
}

/* for(i=pos; i<rates_total; i++)
     {
      haOpen=(ExtOpenBuffer[i-1]+ExtCloseBuffer[i-1])/2;
      haClose=(open[i]+high[i]+low[i]+close[i])/4;
      haHigh=MathMax(high[i],MathMax(haOpen,haClose));
      haLow=MathMin(low[i],MathMin(haOpen,haClose));
      if(haOpen<haClose)
        {   // ici la barre est bleue -> bull
         ExtLowHighBuffer[i]=haLow;
         ExtHighLowBuffer[i]=haHigh;
        }
      else
        {   // ici la barre est jaune -> bear
         ExtLowHighBuffer[i]=haHigh;
         ExtHighLowBuffer[i]=haLow;
        }
      ExtOpenBuffer[i]=haOpen;
      ExtCloseBuffer[i]=haClose;
     } */
