Navigation:Home > Content >

korSigMonitor_H1.mq4

Time: 2012-09-07 | Download file:korSigMonitor_H1.mq4

/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : [email protected]
*/
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 100.0

string gsa_unused_76[50000][2];
string gsa_unused_80[50000][2];
string gsa_unused_84[50000][2];
string gsa_unused_88[50000][2];
double gda_unused_92[];
double gda_unused_96[];
double gda_unused_100[];
int gi_unused_120 = 0;
double gd_unused_124 = 0.0;
double gd_unused_132 = 0.0;
double gd_unused_140 = 0.0;
double gd_unused_148 = 0.0;
int gi_unused_156 = 50;
string gsa_160[30] = {"ABCD", "I ABCD", "I+T ABCD", "Gartley", "Butterfly", "Crab", "Bat", "Batman", "SHS", "I+SHS", "3Drives", "5-0", "Running Corr", "60_50Corr", "Camel Run", "Camel Break", "Camel Flat", "Camel Unreg", "Sepcial"};
int gia_unused_164[30];
extern string separator1 = "************************ Monitored instruments ***";
extern string MonitoredInstrumentsStr = "EURUSD;GBPUSD;USDJPY;EURGBP;EURCHF;USDCHF;GBPJPY;";
string pairs[10];
int gi_188 = 0;
extern string separator2 = "************************ Monitored TFs ***";
extern string MonitoredTFStr = "M15;H1;H4;D1;";
string gsa_208[10];
int gi_212, tf, expBars;
extern string separator3 = "************************ Colors ***";
extern color extBackgroundColor = Black;
extern color extTextColor = White;
int gia_232[8][4][30];
extern string separator4 = "************************ Scan Parameter ***",
            nameIndicator = "korHarmonics";
extern int iextMaxBars = 1000;
extern int iextHL_MinSwing = 0;
extern int iextMaxZZPointsUsed = 7;
extern bool multyScan = true,
            isNewBarON = true;
int  windowNamber = 1;
extern string sextSigMonitorDir = "korSigMon",
              font = "Tahoma";

int CloseFile(int a_file_0) {
   if (a_file_0 != -1) FileClose(a_file_0);
   return (0);
}

void ShowIndicatorInfo(string as_0, string as_8, string as_16, color a_color_24) {
   string l_name_28 = as_0 + as_8;
   ObjectDelete(l_name_28); return;
   ObjectCreate(l_name_28, OBJ_LABEL, 0, 0, 0);
   ObjectSet(l_name_28, OBJPROP_XDISTANCE, 1);
   ObjectSet(l_name_28, OBJPROP_YDISTANCE, 12);
   ObjectSet(l_name_28, OBJPROP_CORNER, 2);
   ObjectSetText(l_name_28, as_0 + " v." + as_8 + as_16 + " " + "[email protected]", 9, font, a_color_24);
}

int init() {
   ShowIndicatorInfo("korSigMonitor", "001", "Test1", extTextColor);
   gi_188 = ParseInputString(MonitoredInstrumentsStr, pairs);
   tf = ParseInputString(MonitoredTFStr, gsa_208);
   if (gi_188 > 8) {
      Alert("WARNING:", "korSigMonitor", ":", "Maximum instruments to monitor = ", 8, " , the rest will be skept.");
      gi_188 = 8;
   }
   gi_212 = ParseInputString(MonitoredTFStr, gsa_208);
   if (gi_212 > 4) {
      Alert("WARNING:", "korSigMonitor", ":", "Maximum TFs to monitor = ", 4, " , the rest will be skept.");
      gi_212 = 4;
   }
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   if (isNewBarON) if (!isNewBar()) return;
   int l_file_12;
   string ls_16;
   int l_str2time_24;
   string ls_28;
   ObjectsDeleteAll(1, OBJ_LABEL);
   ObjectsDeleteAll(0, OBJ_LABEL);
   for (int l_index_0 = 0; l_index_0 < gi_188; l_index_0++) {
      for (int l_index_4 = 0; l_index_4 < gi_212; l_index_4++) {
         if (multyScan) iCustom(pairs[l_index_0], per_(gsa_208[l_index_4]), nameIndicator, 0, iextMaxBars, iextHL_MinSwing, iextMaxZZPointsUsed);
         ls_28 = 0;
         l_file_12 = FileOpen(sextSigMonitorDir + "\korHarmonicsSig" + "_" + pairs[l_index_0] + "_" + gsa_208[l_index_4] + ".csv", FILE_CSV|FILE_READ, ';');
         if (l_file_12 == -1) for (int l_count_8 = 0; l_count_8 < 30; l_count_8++) gia_232[l_index_0][l_index_4][l_count_8] = 77;
         else {
            ls_16 = FileReadString(l_file_12);
            ls_28 = FileReadString(l_file_12);
            l_str2time_24 = StrToTime(ls_28);
            for (l_count_8 = 0; l_count_8 < 30; l_count_8++) {
               ls_28 = FileReadString(l_file_12);
               ls_28 = FileReadString(l_file_12);
               gia_232[l_index_0][l_index_4][l_count_8] = StrToInteger(ls_28);
            }
         }
         CloseFile(l_file_12);
      }
   }
   DrawSigMonitor();
   return (0);
}

void DrawSigMonitor() {
   string l_name_12, line;
   for (int i=0; i<135; i++) line=line+"-";
   for (int l_index_8 = 0; l_index_8 < ArraySize(gsa_160); l_index_8++) {
      l_name_12 = "SigMon" + "_pattern_" + gsa_160[l_index_8];
      CreateObject(l_name_12, gsa_160[l_index_8], 10, 35 * l_index_8 + 140, 100, extTextColor, 90);
   }
   for (int l_index_0 = 0; l_index_0 < gi_188; l_index_0++) {
      l_name_12 = "SigMon" + "_pair_" + pairs[l_index_0];
      CreateObject(l_name_12 + "sep1", line, 25, 10, 60* l_index_0 + 90, extTextColor, 0);
      CreateObject(l_name_12 + "sep2", line, 25, 400, 60* l_index_0 + 90, extTextColor, 0);
      CreateObject(l_name_12, pairs[l_index_0], 10, 10, 60* l_index_0 + 115, extTextColor, 0);
      for (int l_index_4 = 0; l_index_4 < gi_212; l_index_4++) {
         l_name_12 = "SigMon" + "_pair" + pairs[l_index_0] + "_" + gsa_208[l_index_4];
         CreateObject(l_name_12, gsa_208[l_index_4], 9, 70, 60* l_index_0 + 115 + 12 * l_index_4, extTextColor, 0);
         if (gia_232[l_index_0][l_index_4][0] == 77) {
            ObjectSetText(l_name_12, gsa_208[l_index_4], 9, font, Gray);
            l_name_12 = "SigMon" + "_pair" + pairs[l_index_0] + "_" + gsa_208[l_index_4] + "_NO_DATA";
            CreateObject(l_name_12, "", 9, 100, 60* l_index_0 + 115 + 12 * l_index_4, extTextColor, 0);
            SetTextWD(l_name_12, 251, 11, Red);
         } else ObjectSetText(l_name_12, gsa_208[l_index_4], 9, font, extTextColor);
         for (l_index_8 = 0; l_index_8 < 30; l_index_8++) {
            if (gia_232[l_index_0][l_index_4][l_index_8] == 99 || gia_232[l_index_0][l_index_4][l_index_8] == 0 || gia_232[l_index_0][l_index_4][l_index_8] == 77) {
               l_name_12 = "SigMon" + "sig" + "_pair" + pairs[l_index_0] + "_" + gsa_208[l_index_4] + gsa_160[l_index_8];
               ObjectDelete(l_name_12);
            } else {
               l_name_12 = "SigMon" + "sig" + "_pair" + pairs[l_index_0] + "_" + gsa_208[l_index_4] + gsa_160[l_index_8];
               CreateObject(l_name_12, "", 9, 35 * l_index_8 + 140, 60* l_index_0 + 115 + 12 * l_index_4, extTextColor, 0);
               if (gia_232[l_index_0][l_index_4][l_index_8] == 1) SetTextWD(l_name_12, 91, 11, Green);
               else {if (gia_232[l_index_0][l_index_4][l_index_8] == -1) SetTextWD(l_name_12, 91, 11, Red);
                  else {if (gia_232[l_index_0][l_index_4][l_index_8] == 2) SetTextWD(l_name_12, 91, 11, Yellow);
                     else if (gia_232[l_index_0][l_index_4][l_index_8] == -2) SetTextWD(l_name_12, 91, 11, DarkOrange);
                  }
               }
            }
         }
      }
   }
}

void SetTextWD (string _str, int cod, int font, color _clr)
   {
      ObjectSetText(_str, CharToStr(cod), font, "Wingdings", _clr);
   }

int ParseInputString(string as_0, string &asa_8[10]) {
   int li_16;
   int l_index_20 = 0;
   int li_12 = 0;
   for (int li_24 = 0; li_24 < StringLen(as_0); li_24++) {
      if (StringGetChar(as_0, li_24) == ';') {
         li_16 = li_24;
         asa_8[l_index_20] = StringSubstr(as_0, li_12, li_16 - li_12);
         l_index_20++;
         if (l_index_20 == 10) return (l_index_20);
         li_12 = li_24 + 1;
      }
   }
   return (l_index_20);
}

int per_ (string data)
   {
      if (data== "M1") return (1);
         else if (data== "M5") return (5);
            else if (data== "M15") return (15);
               else if (data== "M30") return (30);
                  else if (data== "H1") return (60);
                     else if (data== "H4") return (240);
                        else if (data== "D1") return (1440);
                           else if (data== "W1") return (10080);
                              else if (data== "MN") return (43200);
   }
//+------------------------------------------------------------------+
//Функция возвращает true, если появится новый бар, иначе false 
//+------------------------------------------------------------------+
 bool isNewBar()
 {//return (true);
   bool res=false;
      if(expBars!=Bars)
         {
            expBars=Bars;
            res=true;
         }
  return(res);
 }
//+------------------------------------------------------------------+
// Функция создания надписей на графике
//+------------------------------------------------------------------+
void CreateObject(string text, string info, int shrift, int xd, int yd, color clr_, int angle) 
     {
   if (ObjectFind(text) == -1 ) ObjectCreate(text, OBJ_LABEL, windowNamber, 0, 0);  
       ObjectSetText(text,info ,shrift,font, clr_);
       ObjectSet(text, OBJPROP_CORNER, 0);
       ObjectSet(text, OBJPROP_XDISTANCE, xd);
       ObjectSet(text, OBJPROP_YDISTANCE, yd);
       ObjectSet(text, OBJPROP_ANGLE,angle);       
     }

Recommend