Avere il prezzo aperto della candela in un'ora specifica. - pagina 4

 
Kane59:

Mi dispiace molto,

Ho solo quello ma è vero che ho dimenticato "UpdateHSeSpeciales".


Si chiama in "init" quando inizia il programma.

OK, ho testato questa funzione e sembra funzionare bene.

Per rendere la vita più facile e un po' più sicura perché non fai così...

extern string     Heures="09:00;15:00;19:00;23:00;";

datetime          HeureSH[];   // datetime NOT string


   if (HeureSH( iTime(Symbol(),PERIOD_H1,0),TIME_MINUTES) )  // pass datetime to HeureSH


//+------------------------------------------------------------------+
void UpdateHSeSpeciales()
   {
   string hour1 = "";
   int count1 = 0;
   for(int k = 0; k < StringLen(Heures); k++)
      {
      if(StringSubstr(Heures, k, 1) != ";")
         {
         hour1 = hour1 + StringSubstr(Heures, k, 1);
         }
      else
         {
         ArrayResize(HeureSH, ArraySize(HeureSH)+1);
         HeureSH[count1] = StrToTime(hour1);  //  convert string to datetime
         hour1 ="";
         count1 +=1;
         }   
      }
   }

bool HeureSH(datetime now1)  // parameter is a datetime
   {
   for(int k = 0; k < ArraySize(HeureSH); k++)
      {
      if(now1 == HeureSH[k])
         {
         return(true);
         }
      }
   
   return(false);
   }

così invece di lavorare con le stringhe lavori con i datetime?