s_HTMLTable





#property copyright "Integer"
#property link      "for-good-letters@yandex.ru"

int start(){
   
   // Ïîäãîòîâêà ìàññèâà çàãîëîâêîâ
   string Header[5]={" "/*ëåâàÿ êîëîíêà èñïîëüçóåòñÿ äëÿ íóìåðàöèè ñòðîê*/,"Êîëîíêà 1","Êîëîíêà 2","Êîëîíêà 3","Êîëîíêà 4"};

   // Ïîäãîòîâêà ìàññèâà ñ ñîäåðæèìûì òàáëèöû   
   string Content[10][5];
      for(int i=0;i<10;i++){
            for(int j=1;j<5;j++){
               Content[i][j]="Êîëîíêà - "+j+", ñòðîêà - "+i;
            }   
         Content[i][0]=i+1; // íîìåðà ñòîðîê
      }
   
   // Ôîðìèðîâàíèå òàáëèöû
   string str= fHTML_Table(Header,Content);
   
   // Ñîõðàíåíèå ôàéëà
   int h=FileOpen("HTML_Example.htm",FILE_CSV|FILE_WRITE);
   FileWrite(h,str);
   FileClose(h);
   
   
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
string fHTML_Table(        string   aHeader[],                             // Ìàññèâ ñ çàãîëîâêàìè êîëîíîê. Ðàçìåð ìàññèâà îïðåäåëÿåò êîëè÷åñòâî êîëîíîê òàáëèöû
                           string   aContent[][],                          // Ìàññèâ ñ ñîäåðæèìûì òàáëèöû. Ïåðâîå èçìåðåíèå - ñòðîêà, âòîðîå - êîëîíêà
                           bool     aLeftBold         =  true,             // Âûâîäèòü ëåâóþ êîëîíêó æèðíûì øðèôòîì
                           bool     aHeaderFlag       =  true,             // Âûâîäèòü çàãîëîâîê. Äàæå åñëè âûâîä çàãîëîâêà íå èñïîëüçóåòñÿ, âñåðàâíî íåîáõîäèìî îïðåäåëÿòü ðàçìåð ìàññèâà aHeader
                           bool     aColorAltFlag     =  true,             // ×åðåäîâàòü öâåòà ñòðîê òàáëèöû               
                           string   aFontFace         =  "Tahoma",         // Øðèôò
                           int      aFontSize         =  1,                // Ðàçìåð øðèôòà
                           int      aBorderSize       =  0,                // Øèðèíà ðàìêè
                           int      aCellPadding      =  2,                // Îòñóòï òåêñòà îò êðàÿ ÿ÷åéêè
                           int      aCellSpacing      =  1,                // Ïðîñòðàíñòâî ìåæäó ÿ÷åéêàìè
                           string   aFontColor        =  "#000000",        // Öâåò òåêñòà
                           string   aBorderColor      =  "#FFFFFF",        // Öâåò ðàìêè   
                           string   aHeaderColor      =  "#C0C0C0",        // Öâåò ôîíà çàãîëîâêà
                           string   aRowColor_1       =  "#FFFFFF",        // Öâåò 1 ñòðîê òàáëèöû
                           string   aRowColor_2       =  "#E0E0E0"         // Öâåò 2 ñòðîê òàáëèöû
                           ){
   string tRetStr="<table border=1 bordercolor="+aHeaderColor+" cellpadding=0 cellspacing=0><tr><td>\n";                           
   tRetStr=tRetStr+"<table border="+aBorderSize+" bordercolor="+aBorderColor+" cellpadding="+aCellPadding+" cellspacing="+aCellSpacing+">\n";
      if(aHeaderFlag){
         tRetStr=tRetStr+"<tr bgcolor="+aHeaderColor+">";
            for(int tj=0;tj<ArraySize(aHeader);tj++){
               tRetStr=tRetStr+"<td><b><p align=center><font face="+aFontFace+" size="+aFontSize+" color="+aFontColor+">"+aHeader[tj]+"</font></p></b></td>\n";
            }
         tRetStr=tRetStr+"</tr>\n";
      }
   string tColor=aRowColor_1;   
      for(int ti=0;ti<ArraySize(aContent)/ArraySize(aHeader);ti++){
         tRetStr=tRetStr+"<tr bgcolor="+tColor+">\n";
            for(tj=0;tj<ArraySize(aHeader);tj++){
               string tStr=aContent[ti][tj];
                  if(tj==0){
                     if(aLeftBold){
                        tStr="<b>"+tStr+"</b>\n";
                     }
                  }
                  tRetStr=tRetStr+"<td><p align=right><font face="+aFontFace+" size="+aFontSize+" color="+aFontColor+">"+tStr+"</font></p></td>\n";
            }
         tRetStr=tRetStr+"</tr>\n";
            if(aColorAltFlag){
               if(tColor==aRowColor_1){
                  tColor=aRowColor_2;               
               }
               else{
                  tColor=aRowColor_1;
               }
            }
      }
   tRetStr=tRetStr+"</table></td></tr></table>\n";   
   return(tRetStr);
}





Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features:

Uses files from the file system
It writes information to file