TRUE Forex

Просмотр кода форекс индикатора !$_Dual Matrix v5.0.mq4

// THIS CODE WAS WRITTEN BY XARD777 AND EXTENSIVELY REVISED BY TZUMAN (CapeCoddah)
// FEEL FREE TO RAPE AND PILLAGE ANY OR ALL OF THIS CODE AS YOU SEE FIT
// FOR THOSE OF YOU THAT IMPROVE UPON THIS HERE CODE I ASK YOU ONE THING
// PLEASE POST A COPY UP ON THE FOREX FORUMS FOR YOUR FELLOW TRADERS

#property indicator_chart_window

extern int     X.Position              = 0;
extern int     Y.Position              = 0;
extern int     Tokyo.OpenHour          = 0;  //"08:00";//Tokyo  Begins @ 09:00, set session 1hr before @ 08:00
extern int     London.OpenHour         = 0;  //"07:00";//London Begins @ 08:00, set session 1hr before @ 07:00
extern int     NewYork.OpenHour        = 7;  //"07:00";//NYC    Begins @ 08:00, set session 1hr before @ 07:00
extern int     Daily.OpenHour          = 0;  //"";//"18:00";  All times quoted are NYC time 

extern string  Note10                  = "For micro account, use suffix m or .fx";
extern string  if.micro                = "";
 
extern color   Negative.Pips           = DarkOrange;
extern color   Positive.Pips           = DodgerBlue;
extern color   Neutral.Pips            = DimGray;
extern bool    show.background.panel   = true;
extern bool    ShowLeaderBoards        = true;
extern bool    PrintMatrix             = true;

#define TokyoOpen 0
#define LondonOpen  1
#define NewYorkOpen 2
#define TradingOpen 3

//int      OpenBar=9999,openbar[4];
int      WhatWindow   = 0;
int      WhatCorner   = 0;
color    PanelColor1  = C'144,144,144';
color    PanelColor2  = C'20,20,20';
datetime StartTime;            
string   buffer.name  = "Dual MATRIX:";  

#define Session.Numbers 6
#define Hourly 0
#define Rolling 1
#define Tokyo 2
#define London 3
#define NewYork 4
#define Daily 5
bool    Session.Matrix[]={1,0,0,0,0,0};
int     Session.Order[]={0,1,2,3,4,-5};
string  Session.Headers[]={"    Hourly","   Rolling","    Tokyo","   London"," New York","    Daily"};
int     Session.Start[Session.Numbers],Session.Stop[Session.Numbers];
           
string Symbols[];
int    Symbols.Number,Symbols.Index[][2], chartpair[2];
#define Majors.Number 8
#define NZD 0//EUR 0
#define AUD 1//GBP 1
#define JPY 2//CHF 2
#define EUR 3//USD 3
#define GBP 4//CAD 4
#define CHF 5//NZD 5
#define USD 6//AUD 6
#define CAD 7//JPY 7


double Symbols.Sorted[][2],Sorted[Majors.Number][2],Pips[Majors.Number][Majors.Number][Session.Numbers],Tally[Majors.Number][Session.Numbers];
string Majors[]  = {"NZD","AUD","JPY","EUR","GBP","CHF","USD","CAD"}; 
string space = "";            
color Colors[]={C'50,225,50',C'50,195,60', C'50,165,70',C'50,135,80',C'135,80,50',C'165,70,50',C'195,60,50',C'235,50,50'};

#import "kernel32.dll"
   void GetLocalTime(int& a0[]);
   void GetSystemTime(int& a0[]);
   int  GetTimeZoneInformation(int& a0[]);
   bool SystemTimeToTzSpecificLocalTime(int& a0[], int& a1[], int& a2[]);
#import

color opencolor = C'0,117,213', closecolor = C'150,34,34';
bool Highlight_Market_Open = TRUE;
bool Broker_MMSS_Is_Gold_Standard = TRUE;
bool Suppress_Bar_HH_Below_H1 = TRUE;
string Time.London,Time.Tokyo,Time.NewYork;
bool Weekend_Test_Mode = FALSE;

int gia_216[43];
int gia_220[43];
int gia_224[43];
int gia_228[43];
int gia_232[43];
int gia_236[43];
int gia_240[43];
int gia_244[43];
int gia_248[43];

double g_ibuf_252[];
int gi_256 = 8;
int gi_260 = 17;
int gi_264 = 7;
int gi_268 = 16;
int g_datetime_272;

int init()
   {
   IndicatorShortName("Currency Matrix"); 
   
   if(Tokyo.OpenHour > 0)   Session.Stop[Tokyo]=17;
   if(London.OpenHour > 0)  Session.Stop[London]=17;
   if(NewYork.OpenHour > 0) Session.Stop[NewYork]=17;
   if(Daily.OpenHour > 0)   Session.Stop[Daily]=17;
   if(Daily.OpenHour > 0)   Session.Start[Daily]=16;
       
   Symbols.Number = createPairArray();
   double work[][2]; ArrayResize(Symbols.Sorted,Symbols.Number);
   GetAllTimeZoneInfo(gia_216, gia_220, gia_224, gia_228, gia_232, gia_236, gia_240, gia_244, gia_248);
   Show_Panel();
   return(0);
   }
      
int deinit()
   {
   deleteObjects();
   return(0);
   }

void  Set_SessionBarOffsets()
{
   static datetime LastTime;
   //if(Time[0] == LastTime)       return(0);     // time already set for this hour 
   
   if(Tokyo.OpenHour > 0)   Calculate_Offsets(Tokyo,Time.Tokyo);
   if(London.OpenHour > 0)  Calculate_Offsets(London,Time.London);
   if(NewYork.OpenHour > 0) Calculate_Offsets(NewYork,Time.NewYork);
      
   LastTime=Time[0]; 
}
void  Calculate_Offsets(int session,string localtime)
{
   int LocalHour=StrToInteger(StringSubstr(localtime,0,2));
   int OpenBar=LocalHour-NewYork.OpenHour;
   if(OpenBar>=0)     Session.Start[session]=OpenBar;
   
    
   int CloseBar=LocalHour-17;
   if(CloseBar<=0)   Session.Stop[session]=0;
   else
     {
         //this has to be expanded and corrected
         
      Session.Stop[session]=17;
      }
        
   Print("New York ",LocalHour," ",OpenBar," ",CloseBar," ",Session.Start[session]," ",Session.Stop[session]);
}      
int start()
{
   int    session,index,counted_bars=IndicatorCounted(),xpos; 
   double value,DecNos;
    
   Clock();
   Set_SessionBarOffsets();
     
   for(int i=0;i<Session.Numbers;i++)
   {
   session=Session.Order[i];
   for(index=0;index<Symbols.Number;index++)
      {            
      if(Symbols.Index[index,0] == JPY || Symbols.Index[index,1] == JPY) DecNos=100.;
      else                                                               DecNos=10000.;
      
      switch(session)
         {
         case Hourly:    value = ((iClose(Symbols[index], PERIOD_H1,0) - iOpen(Symbols[index], PERIOD_H1,0))* DecNos);                          break;
         case Rolling:   value = ((iClose(Symbols[index], PERIOD_H1,0) - iOpen(Symbols[index], PERIOD_M1,PERIOD_H1))* DecNos);   break; 
         //case Tokyo:   
         //case London:  
         case NewYork:   value = ((iClose(Symbols[index], PERIOD_H1,Session.Stop[session]) - iOpen(Symbols[index], PERIOD_H1,Session.Start[session]))* DecNos);   
         if(Symbols[index] == "EURUSD")   Print(Symbols[index]," ",index," ",Session.Start[session]," ",DoubleToStr(iOpen(Symbols[index], PERIOD_H1,Session.Start[session]),5)," ", Session.Stop[session]," ",DoubleToStr(iClose(Symbols[index], PERIOD_H1,Session.Stop[session]),5));
         break; 
         case Daily:     break;
         } 
      Pips[Symbols.Index[index,0],Symbols.Index[index,1],session]=-value;  //note that the value is reversed as we are printing by rows NOT columns.
      Pips[Symbols.Index[index,1],Symbols.Index[index,0],session]=value;
      }
   }
   
   for(i=0;i<Session.Numbers;i++)
      {
      session=Session.Order[i];
      if(session < 0)   continue;
      Calculate_Tally(session); 
     
      for(int currency=0;currency<Majors.Number;currency++)
         {
         Sorted[currency,0]=Tally[currency,session];
         Sorted[currency,1]=currency;
         }
  
      ArraySort(Sorted,WHOLE_ARRAY,0,MODE_DESCEND);
      xpos=Print_Rows(session,xpos);
      if(ShowLeaderBoards)    xpos=Print_LeaderBoard(session,xpos);
      }

   return(0);
}
int  Print_Rows(int session, int xPos)
{
   string sBbuffer=buffer.name+session+ "BR",  
          sFbuffer=buffer.name+session+ "FR";
   double value;
   
for(int row=0;row<Majors.Number;row++)
   {
   int index,ypos=38+17*row,xpos=xPos+4;
   index=Sorted[row,1];
      
   Create_Object(sBbuffer+"C"+(row+1),xpos+1,  ypos,"ggg", 11, "Webdings",Colors[row]) ;
   Create_Object(sFbuffer+"C"+(row+1),xpos+5,ypos+1,Majors[index], 11, "Arial Black",White);
   
   if(PrintMatrix && Session.Matrix[session])   {xpos+=45;  xpos=Print_Matrix(session,row,xpos);}
   else
      {
      Create_Object(sBbuffer+ "A0",   xpos-3,   20, "g", 71, "Webdings", PanelColor1);
      Create_Object(sBbuffer+ "B0",   xpos-3,   86, "g", 71, "Webdings", PanelColor1);
      Create_Object(sBbuffer+ "C0",   xpos-1,   22, "g", 68, "Webdings", PanelColor2);
      Create_Object(sBbuffer+ "C00",  xpos-1,   88, "g", 68, "Webdings", PanelColor2);
      Create_Object(sFbuffer+ "E0",   xpos+2,   21, Session.Headers[session], 11, "Arial Black",White);
      xpos+=45;
      }
   
   Create_Object(sBbuffer+"D"+(row+1),xpos,  ypos,"ggg", 11, "Webdings",Colors[row]) ;
   Create_Object(sFbuffer+"D"+(row+1),xpos+2,ypos+2,Set_Text(DoubleToStr(Tally[index,session],0)), 10, "Arial Black", White);
   }
   return(xpos+50);         
}   
int   Print_Matrix(int session,int row,int xpos)
{
   Print_Totals(session,row,xpos);
   int index,ypos=38+17*row;
   index=Sorted[row,1];
   string sBbuffer=buffer.name+session+"BR"+(row+1)+"C",  sFbuffer=buffer.name+session+"FR"+(row+1)+"C";
   double value;
   
   for(int col=0;col<Majors.Number;col++)
      {
      value=Pips[index,col,session];
      if(value==0)
         {
         ObjectDelete(sBbuffer+(col+1));
         ObjectDelete(sFbuffer+(col+1));
         }  
      else
         {
         if (value <= -12)       color Color = Negative.Pips; 
         else if (value >= 12)         Color = Positive.Pips;  
         else                          Color = Neutral.Pips;
   
         Create_Object(sBbuffer+(col+1),xpos,ypos,"ggg", 11, "Webdings", Color);
         Create_Object(sFbuffer+(col+1),xpos+1,ypos+2, Set_Text(DoubleToStr(value,0)), 10, "Arial Black", White);
         }
      xpos+=44;   
      }
    return(xpos);
}     
void Print_Totals(int session, int col,int xpos)
   {   
   xpos=xpos+col*44;
   for(int index=0;index<Majors.Number;index++)    if(col==Sorted[index,1])  break;
   col+=1;
   Create_Object(buffer.name+ session+"BR9C"+col,   xpos,  174,"ggg", 11, "Webdings", Colors[index]);
   Create_Object(buffer.name+ session+"FR9C"+col,   xpos+1,176, Set_Text(DoubleToStr(Tally[col-1,session],0)), 10, "Arial Black",White);   
   Create_Object(buffer.name+ session+"BR0C"+col,   xpos,   21, "ggg", 11, "Webdings", Colors[index]);
   Create_Object(buffer.name+ session+"FR0C"+col,   xpos+5, 22, Majors[col-1], 11, "Arial Black",White);
   }
string Set_Text(string text)
   {
   switch(StringLen(text))
      {
      case 1:  text="      "+text;    break; 
      case 2:  text="     " +text;    break;
      case 3:  text="   "   +text;    break;
      case 4:  text="  "    +text;    break;
      }
   return(text);
   }      
int Print_LeaderBoard(int session,int xpos)
{
   for(int index=0;index<Symbols.Number;index++)
      { 
      Symbols.Sorted[index,0]=Pips[Symbols.Index[index,1],Symbols.Index[index,0],session];
      Symbols.Sorted[index,1]=index;
      }
      
   ArraySort(Symbols.Sorted,WHOLE_ARRAY,0,MODE_DESCEND);
   int ypos=0,nbr=0,row;
   Create_Object(buffer.name+session+" PLB1", xpos-3,  19, "g", 59, "Webdings", PanelColor1);
   Create_Object(buffer.name+session+" PLB2", xpos-3,  81, "g", 59, "Webdings", PanelColor1);
   Create_Object(buffer.name+session+" PLB2b",xpos-3, 101, "g", 59, "Webdings", PanelColor1);
   Create_Object(buffer.name+session+" PLB3", xpos-1,  22, "g", 56, "Webdings", PanelColor2);
   Create_Object(buffer.name+session+" PLB3b",xpos-1,  84, "g", 56, "Webdings", PanelColor2);
   Create_Object(buffer.name+session+" PLB3c",xpos-1, 104, "g", 56, "Webdings", PanelColor2);
   Create_Object(buffer.name+session+" PLB4", xpos-5, ypos+21,Session.Headers[session], 11, "Arial Black", White);
   ypos=38;
   
   for(int roww=0;roww<8;roww++)
      {
      row=roww;
      if(row>3) row=Symbols.Number-8+roww;
      Create_Object(buffer.name+session+" PLB5"+roww,xpos+1,  ypos,"ggggg", 11, "Webdings",Colors[roww]);
      index=Symbols.Sorted[row,1];
      
      ObjectDelete(buffer.name+session+"Panel20"+ roww);
      
      if(Symbols.Sorted[row,0] >= 12. || Symbols.Sorted[row,0] <= -12.)
      Create_Object(buffer.name+session+"Panel20"+roww,xpos+6,ypos+2,Symbols[index], 10, "Arial Black", White);
      nbr+=4;
      ypos+=17;
      }
   return(xpos+88);
}
void   Calculate_Tally(int session)
{
   Tally[EUR,session] = -( Pips[EUR,GBP,session]+Pips[EUR,CHF,session]+Pips[EUR,USD,session]+Pips[EUR,CAD,session]+Pips[EUR,NZD,session]+Pips[EUR,AUD,session]+Pips[EUR,JPY,session]);
   Tally[GBP,session] =    Pips[EUR,GBP,session]-Pips[GBP,CHF,session]-Pips[GBP,USD,session]-Pips[GBP,CAD,session]-Pips[GBP,NZD,session]-Pips[GBP,AUD,session]-Pips[GBP,JPY,session];
   Tally[CHF,session] =    Pips[EUR,CHF,session]+Pips[GBP,CHF,session]+Pips[USD,CHF,session]+Pips[CAD,CHF,session]+Pips[NZD,CHF,session]+Pips[AUD,CHF,session]-Pips[CHF,JPY,session];
   Tally[USD,session] =    Pips[EUR,USD,session]+Pips[GBP,USD,session]-Pips[USD,CHF,session]-Pips[USD,CAD,session]+Pips[NZD,USD,session]+Pips[AUD,USD,session]-Pips[USD,JPY,session];
   Tally[CAD,session] =    Pips[EUR,CAD,session]+Pips[GBP,CAD,session]-Pips[CAD,CHF,session]+Pips[USD,CAD,session]+Pips[NZD,CAD,session]+Pips[AUD,CAD,session]-Pips[CAD,JPY,session];
   Tally[NZD,session] =    Pips[EUR,NZD,session]+Pips[GBP,NZD,session]+Pips[NZD,CHF,session]-Pips[NZD,USD,session]+Pips[NZD,CAD,session]+Pips[AUD,NZD,session]-Pips[NZD,JPY,session];
   Tally[AUD,session] =    Pips[EUR,AUD,session]+Pips[GBP,AUD,session]-Pips[AUD,CHF,session]-Pips[AUD,USD,session]-Pips[AUD,CAD,session]-Pips[AUD,NZD,session]-Pips[AUD,JPY,session];
   Tally[JPY,session] =    Pips[EUR,JPY,session]+Pips[GBP,JPY,session]+Pips[CHF,JPY,session]+Pips[USD,JPY,session]+Pips[CAD,JPY,session]+Pips[AUD,JPY,session]+Pips[NZD,JPY,session];
 }              
int createPairArray() {
   string symbol;
   int index = 0;
   for (int base = 0; base < Majors.Number - 1; base++) 
      {
      for (int counter = base + 1; counter < Majors.Number; counter++) {
         symbol = Majors[base] + Majors[counter] + if.micro;
         if (MarketInfo(symbol, MODE_BID) > 0.0) 
            {
            //Print("BaseCounter ",symbol," ",base," ",counter);
            ArrayResize(Symbols, index + 1);
            Symbols[index] = symbol;
            ArrayResize(Symbols.Index, index + 1);
            Symbols.Index[index,0]=base;
            Symbols.Index[index,1]=counter;
            index++;
            }
           
                  
         symbol = Majors[counter] + Majors[base] + if.micro;
         if (MarketInfo(symbol, MODE_BID) > 0.0) 
            {
            //Print("CounterBase ",symbol," ",base," ",counter);
            ArrayResize(Symbols, index + 1);
            Symbols[index] = symbol;
            ArrayResize(Symbols.Index, index + 1);
            Symbols.Index[index,0]=counter;
            Symbols.Index[index,1]=base;
            index++;
            }
         }
   }
   GetLastError();         //to clear legitimate 4106 errors
   return(ArraySize(Symbols));
   }   

// ====.====================================================================================== //
int Create_Object( string K, int x, int y, string Text, int FontSize, string Font, color Color ) 
   {
   ObjectCreate( K, OBJ_LABEL, WhatWindow, 0, 0 );
   ObjectSet( K, OBJPROP_CORNER, WhatCorner);
   ObjectSet( K, OBJPROP_XDISTANCE,x+X.Position);
   ObjectSet( K, OBJPROP_YDISTANCE,y+Y.Position);
   ObjectSet( K, OBJPROP_BACK, false );
   ObjectSetText(K, Text, FontSize, Font, Color);
   }   
        
 void deleteObjects(){
   for(int i=0;   i<10;i++)  ObjectDelete(buffer.name+" Panel0" + i);
   for(    i=0;   i<34;i++)  ObjectDelete(buffer.name+" Panel" + i);
   for(    i=0;   i<8;i++)   ObjectDelete(buffer.name+"HighLowB" + i);
    for(    i=0;   i<8;i++)   ObjectDelete(buffer.name+"HighLowN" + i);
   for(    i=0;   i<8;i++)   ObjectDelete(buffer.name+" Panel19" + i);
   
   
   string sBbuffer,sFbuffer;
   
   for(int session=0;session<Session.Numbers;session++)
      {
      ObjectDelete(buffer.name+session+ "BRA0");
      ObjectDelete(buffer.name+session+ "BRB0");
      ObjectDelete(buffer.name+session+ "BRC0");
      ObjectDelete(buffer.name+session+ "BRC00");
      ObjectDelete(buffer.name+session+"FRE0");
      ObjectDelete(buffer.name+session+" PLB1");
      ObjectDelete(buffer.name+session+" PLB2");
      ObjectDelete(buffer.name+session+" PLB3");
      ObjectDelete(buffer.name+session+" PLB4");
      ObjectDelete(buffer.name+session+" PLB2b");
      ObjectDelete(buffer.name+session+" PLB3b");
      ObjectDelete(buffer.name+session+" PLB3c");
      
      for(int row=0;row<10;row++) for(int col=0;col<10;col++)
      {
      ObjectDelete(buffer.name+ session+"BR"+row+"C"+col);
      ObjectDelete(buffer.name+ session+"FR"+row+"C"+col);
      }
      for(    i=0;   i<8;i++)   ObjectDelete(buffer.name+session+"Panel20" + i);
      for(    i=0;   i<10;i++)
         {
         ObjectDelete(buffer.name+session+ "BRC"+i);
         ObjectDelete(buffer.name+session+ "FRC"+i);
         ObjectDelete(buffer.name+session+ "BRD"+i);
         ObjectDelete(buffer.name+session+ "FRD"+i);
         ObjectDelete(buffer.name+session+" PLB5"+i);
         }  
      } 
   GetLastError();
   }
   
void Show_Panel()
   {   
  
   if(!show.background.panel)  return;    
      Create_Object(buffer.name+" Panel01",45,  1, "gg", 90, "Webdings", PanelColor1);
      Create_Object(buffer.name+" Panel02",163, 1, "gg", 90, "Webdings", PanelColor1);
      Create_Object(buffer.name+" Panel03",1,  37, "gg", 90, "Webdings", PanelColor1);
      Create_Object(buffer.name+" Panel04",1,  60, "gg", 90, "Webdings", PanelColor1);
      Create_Object(buffer.name+" Panel05",207,37, "gg", 90, "Webdings", PanelColor1);
      Create_Object(buffer.name+" Panel06",207,60, "gg", 90, "Webdings", PanelColor1);
      Create_Object(buffer.name+" Panel07",45, 77, "gg", 90, "Webdings", PanelColor1);
      Create_Object(buffer.name+" Panel08",163,77, "gg", 90, "Webdings", PanelColor1);
      Create_Object(buffer.name+" Panel09",47,  3, "gg", 90, "Webdings", PanelColor2);
      Create_Object(buffer.name+" Panel10",161, 3, "gg", 90, "Webdings", PanelColor2); 
      Create_Object(buffer.name+" Panel11",47, 75, "gg", 90, "Webdings", PanelColor2);
      Create_Object(buffer.name+" Panel12",161,75, "gg", 90, "Webdings", PanelColor2);
      Create_Object(buffer.name+" Panel13",3,  39, "gg", 90, "Webdings", PanelColor2);
      Create_Object(buffer.name+" Panel14",3,  58, "gg", 90, "Webdings", PanelColor2);
      Create_Object(buffer.name+" Panel15",205,39, "gg", 90, "Webdings", PanelColor2);
      Create_Object(buffer.name+" Panel16",205,58, "gg", 90, "Webdings", PanelColor2);
     // Create_Object(buffer.name+" Panel17",447,39,  "g", 56, "Webdings", PanelColor2); 
     // Create_Object(buffer.name+" Panel18",447,104, "g", 56, "Webdings", PanelColor2);    
   }
   
/////////////////////clock subroutines
int Clock()
   {
   int lia_0[4];
   int lia_4[4];
   int lia_8[4];
   int lia_12[4];
   int lia_16[4];
   int li_40;
   int li_48;
  
   int NYTime,LondonTime,TokyoTime;
  
   string l_text_88;
   
   int li_176;
   string l_time2str_180;
   if (!IsDllsAllowed()) {
      if (TimeCurrent() - g_datetime_272 >= 7) {
         g_datetime_272 = TimeCurrent();
         Alert(WindowExpertName(), ": ERROR. DLLs are disabled. To enable, select \'Allow DLL Imports\' in the Common Tab of indicator");
      }
   } else {
      if (!Weekend_Test_Mode && TimeCurrent() - g_datetime_272 == 0) return;
      g_datetime_272 = TimeCurrent();
      GetLocalTime(lia_0);
      li_40 = TimeArrayToTime(lia_0);
      int CurrentTime = TimeCurrent();
      li_48 = 0;
      if (Broker_MMSS_Is_Gold_Standard && !Weekend_Test_Mode) {
         li_48 = 60 * TimeMinute(CurrentTime) + TimeSeconds(CurrentTime) - 60 * TimeMinute(li_40) - TimeSeconds(li_40);
         if (li_48 > 1800) li_48 -= 3600;
         else
            if (li_48 < -1800) li_48 += 3600;
      }
      GetSystemTime(lia_4);
      
      SystemTimeToTzSpecificLocalTime(gia_220, lia_4, lia_8);
      NYTime = TimeArrayToTime(lia_8) + li_48;
      SystemTimeToTzSpecificLocalTime(gia_224, lia_4, lia_12);
      LondonTime = TimeArrayToTime(lia_12) + li_48;
      SystemTimeToTzSpecificLocalTime(gia_228, lia_4, lia_16);
      TokyoTime = TimeArrayToTime(lia_16) + li_48;       
      
      Time.London = TimeToString(LondonTime,true);
      Time.Tokyo = TimeToString(TokyoTime,true);
      Time.NewYork = TimeToString(NYTime,true);
            
      li_176 = 60 * Period() + Time[0] - TimeCurrent();
      if (li_176 >= 0) {
      l_time2str_180 = TimeToStr(60 * Period() + Time[0] - TimeCurrent(), TIME_MINUTES);
         if (Suppress_Bar_HH_Below_H1 && Period() <= PERIOD_H1 && StringLen(l_time2str_180) > 6) l_time2str_180 = StringSubstr(l_time2str_180, 3);
      } 
          
      color ctimes[3];
      for(int i=0;i<3;i++) ctimes[i]=closecolor;
      
       if (TimeDayOfWeek(TokyoTime) != 0 && TimeDayOfWeek(TokyoTime) != 8 && Highlight_Market_Open && TimeHour(TokyoTime) >= gi_256 && TimeHour(TokyoTime) < gi_260) 
       ctimes[2]=opencolor;
      
         if (TimeDayOfWeek(LondonTime) != 0 && TimeDayOfWeek(LondonTime) != 8 && Highlight_Market_Open && TimeHour(LondonTime) >= gi_256 && TimeHour(LondonTime) < gi_260) 
         ctimes[0]=opencolor;
      
         if (TimeDayOfWeek(NYTime) != 0 && TimeDayOfWeek(NYTime) != 8 && Highlight_Market_Open && TimeHour(NYTime) >= gi_256 && TimeHour(NYTime) < gi_260) 
         ctimes[1]=opencolor;
      
   }
    int offset=0;  
   Create_Object(buffer.name+" Panel30",offset+187,6," LONDON                  NY ", 11, "Arial Bold", White);
   Create_Object(buffer.name+" Panel31",offset+56, 6," TOKYO ",11, "Arial Bold", White);
   Create_Object(buffer.name+" Panel21",offset+49, 4,"ggggg",  12, "Webdings", ctimes[2]);
   Create_Object(buffer.name+" Panel22",offset+115,4,"gggg",   12, "Webdings", ctimes[2]);
   Create_Object(buffer.name+" Panel23",offset+181,4,"ggggg",  12, "Webdings", ctimes[0]);
   Create_Object(buffer.name+" Panel24",offset+247,4,"gggg",   12, "Webdings", ctimes[0]);
   Create_Object(buffer.name+" Panel25",offset+313,4,"ggg",    12, "Webdings", ctimes[1]);
   Create_Object(buffer.name+" Panel26",offset+335,4,"gggg",   12, "Webdings", ctimes[1]);
   Create_Object(buffer.name+" Panel27",offset+260,5,Time.London, 10, "Arial Black", White);
   Create_Object(buffer.name+" Panel28",offset+351,5,Time.NewYork,    10, "Arial Black", White);
   Create_Object(buffer.name+" Panel29",offset+126,5,Time.Tokyo,   10, "Arial Black", White);
   
   return (0);
   }

string TimeToString(int theTime,bool MilitaryTime) {
   string Return;
   int hour = TimeHour(theTime);
   
   if (!MilitaryTime && (hour > 12 || hour == 0)) Return = TimeToStr(theTime - 43200, TIME_MINUTES);
   else                        Return = TimeToStr(theTime, TIME_MINUTES);
   
   if(!MilitaryTime)
      {
      if (hour >= 12)             Return = StringConcatenate(Return, " PM");
      else                        Return = StringConcatenate(Return, " AM");
      }
      
   return (Return);
   }

string FormatDateTime(int theTime, int ai_4, int ai_8, int ai_12, int ai_16, int ai_20) {
   string ls_24 = ai_4 + 100;
   ls_24 = StringSubstr(ls_24, 1);
   string ls_32 = ai_8 + 100;
   ls_32 = StringSubstr(ls_32, 1);
   string ls_40 = ai_12 + 100;
   ls_40 = StringSubstr(ls_40, 1);
   string ls_48 = ai_16 + 100;
   ls_48 = StringSubstr(ls_48, 1);
   string ls_56 = ai_20 + 100;
   ls_56 = StringSubstr(ls_56, 1);
   return (StringConcatenate(theTime, ".", ls_24, ".", ls_32, " ", ls_40, ":", ls_48, ":", ls_56));
   }

int TimeArrayToTime(int aia_0[4]) {
   int l_str2time_44;
   int li_4 = aia_0[0] & 65535;
   int li_8 = aia_0[0] >> 16;
   int li_16 = aia_0[1] >> 16;
   int li_20 = aia_0[2] & 65535;
   int li_24 = aia_0[2] >> 16;
   int li_28 = aia_0[3] & 65535;
   int li_32 = aia_0[3] >> 16;
   string ls_36 = FormatDateTime(li_4, li_8, li_16, li_20, li_24, li_28);
   l_str2time_44 = StrToTime(ls_36);
   return (l_str2time_44);
   }

void GetAllTimeZoneInfo(int aia_0[43], int &aia_4[43], int &aia_8[43], int &aia_12[43], int &aia_16[43], int &aia_20[43], int &aia_24[43], int &aia_28[43], int &aia_32[43]) {
   int li_36 = GetTimeZoneInformation(aia_0);
   aia_4[0] = 300;
   aia_4[17] = 720896;
   aia_4[18] = 65536;
   aia_4[19] = 2;
   aia_4[20] = 0;
   aia_4[21] = 0;
   aia_4[38] = 196608;
   aia_4[39] = 131072;
   aia_4[40] = 2;
   aia_4[41] = 0;
   aia_4[42] = -60;
   aia_8[0] = 0;
   aia_8[17] = 655360;
   aia_8[18] = 327680;
   aia_8[19] = 2;
   aia_8[20] = 0;
   aia_8[21] = 0;
   aia_8[38] = 196608;
   aia_8[39] = 327680;
   aia_8[40] = 1;
   aia_8[41] = 0;
   aia_8[42] = -60;
   aia_12[0] = -540;
   aia_12[17] = 0;
   aia_12[18] = 0;
   aia_12[19] = 0;
   aia_12[20] = 0;
   aia_12[21] = 0;
   aia_12[38] = 0;
   aia_12[39] = 0;
   aia_12[40] = 0;
   aia_12[41] = 0;
   aia_12[42] = 0;
   aia_16[0] = -600;
   aia_16[17] = 262144;
   aia_16[18] = 65536;
   aia_16[19] = 3;
   aia_16[20] = 0;
   aia_16[21] = 0;
   aia_16[38] = 655360;
   aia_16[39] = 65536;
   aia_16[40] = 2;
   aia_16[41] = 0;
   aia_16[42] = -60;
   aia_20[0] = -720;
   aia_20[17] = 262144;
   aia_20[18] = 65536;
   aia_20[19] = 3;
   aia_20[20] = 0;
   aia_20[21] = 0;
   aia_20[38] = 589824;
   aia_20[39] = 327680;
   aia_20[40] = 2;
   aia_20[41] = 0;
   aia_20[42] = -60;
   ArrayCopy(aia_24, aia_8);
   aia_24[0] = -180;
   ArrayCopy(aia_28, aia_8);
   aia_28[0] = -60;
   ArrayCopy(aia_32, aia_4);
   aia_32[0] = 480;
   }        
// ==================================
// LET THERE BE ORDER... XARD777 2011
// AND THERE WILL BE ORDER.....TZUMAN

Комментарии к исходному коду форекс индикатора !$_Dual Matrix v5.0.mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.

  • X
  • 0% загружено
« индикатор !$_Dual Matrix v4.7.mq4
индикатор !1~.mq4 »