ZUP_WRR_INFO_v02





//+------------------------------------------------------------------+
//|                                        Copyright © 2007-2008 WRR |
//+------------------------------------------------------------------+
#property copyright "Copyright WRR"
#property link      "http://www.forex-tsd.com/"
#import "kernel32.dll"
void GetLocalTime(int& TimeArray[]);
#import
#property indicator_chart_window
string sFileName = "WRR_ZUP_INFO_v02.mq4";

//Issued 2008.06.16
/*
This indicator also needs the ZUP indicator on the chart set up to show Gartley patterns for it to work.

The main purposes for, and features of, the WRR_ZUP_INFO indicator are as follows. It will display a text 
block saying what type of pattern ZUP has made (Gartley, Butterfly, Bat or Crab), if the pattern has "failed," 
if there is no pattern, what timeframe or period the chart is on and the chart instrument or pair. The text 
block also indicates the risk for the trade and the range in which the pattern is valid or somewhat valid.  
The text block can be moved anywhere on any window including indicator sub-windows.

It will alert when there is a pattern change. It will draw a 100% fib expansion on Gartleys to show if there
is an AB=CD confirmation.  It will allow one to change the background property and colours of the D Point 
Rectangle drawn by ZUP.  It will also allow one to automatically and instantly make a screen shot every time 
a new pattern forms, fails or there is no pattern, then save it to a file.

**** VERY IMPORTANT **** TO GET the WRR_ZUP_INFO INDICATOR TO WORK AND TO GET ZUP TO WORK, one must check 
the box "Allow DLL imports" in the Common Tab of the indicators' properties ON BOTH INDICATORS.  If 
"Allow DLL imports" is not selected in ZUP, nothing will show up. If "Allow DLL imports" is not checked 
in WRR_ZUP_INFO, an error message alert will show up and it will not run.

**** VERY IMPORTANT **** Always install ZUP first then WRR_ZUP_INFO after ZUP.  This is because 
WRR_ZUP_INFO needs to read the most current data from ZUP.  If one installs WRR_ZUP_INFO first, then its 
performance will be delayed. 
*/

//**********************************************************************************************************
//MAIN SETTINGS
extern string _____________01____________ = "Main Settings";
extern bool   AllAlertsOFF = false;
extern string Corner = "bl";//default is "bl","tl"=top left,"tr"=top right,"bl"=bottom left,"br"=bottom right
extern int    OffsetTopBottom = 0;//default is zero.  Set to 10 if using screenshot on bottom left corner
extern int    OffsetLeftRight = 0;
extern int    WindowNumber = 0;//main window is zero, indicator windows are 1 through how many are on chart.
extern bool   ScreenShotWhenPatternChange = false;//default=false, true if testing.
//Try screen shots if one wants to but turn it off soon, or hard drive will fill up.
//Screen shot files if created are located in
//C:\Program Files\<MT4 Broker Name of Program>\experts\files\WRR_ZUP_INFO Screen Shots
//The subdirectory "\WRR_ZUP_INFO Screen Shots" is created automatically if it is not already created

extern string _____________02____________ = "Other Alert Settings";
extern bool   PatternAlertON = true;
extern bool   FailedPatternAlertON = true;
extern bool   NoPatternAlertON = true;//default=false alerts when no pattern at start up or pattern removed from chart.

extern string _____________03____________ = "'D' Point Rectangle Settings";
extern bool   RectangleInBackground = true;//ZUP pattern range indicator set to true less likely to hide candle wicks
extern color  RectangleColour = DarkGray;//ZUP pattern range indicator colour

extern string _____________04____________ = "Fib Expansion on Gartley Settings";
extern bool   ShowABeqCD_FibExpGartley = true;
extern bool   RemoveFibExpGartley_if_FAIL = false;//remove when no pattern or other pattern = false, remove on pattern failure = true
extern color  ABeqCD_FibExpGartleyColour = Red;  

//OTHER SCREEN SHOT SETTINGS
extern string _____________05____________ = "Other Screen Shot Settings";
//
extern int    ScreenShotWidth = 1088;//width of screen shot in pixels
extern int    ScreenShotHeight = 612;//height of screen shot in pixels

//OTHER STANDARD DRAWING ROUTINE SETTINGS
extern string _____________06____________ = "Label Visibility Settings";
extern bool   AllLabelsOFF = false;//turn off all labels
extern bool   PatternAndFileNameLabel_1_ON = true;//default=true
extern bool   DisplayFileNameInLabel_1 = true;//default=true
extern bool   RiskAndRangeLabel_2_ON = true;//default=true
extern bool   ShowScreenShotsOnLabel_3_ON = true;//usually leave as true so one knows it is on unless it is in the way.
//extern bool   DrawLine_4 = true;
extern string _____________07____________ = "Other Label Settings";
extern int    FontSize = 10;//default is 10
extern string FontType ="Arial Black";//default is "Arial Black"
extern color  FontColour= DarkOrange;//label font colour
extern bool   LabelsInBackground = false;//default is false
extern int    SpaceBetweenLines = 4;//Space between lines
extern string _____________08____________ = "Comment Setting";
extern bool   ShowFileNameInComment = false;//Turn on or off Standard MT4 title Comment in top left corner of chart.

//**********************************************************************************************************

//STANDARD DRAWING ROUTINE VARIABLES
int iCorner;//for converting Corner string to integer for window corner location
int iRowCount;//number of rows of labels to draw
int iTBMin = 1;//Min distance from top or bottom edge or it may not draw
int iLRMin = 2;//Min distance from left or right edge or it may not draw
int iSpacer;//multiplier of space between rows of labels
int iMaxRowsOfLabels = 3;//maximum number of rows of labels
string sName[4];//name of label array (set to iMaxRowsOfLabels + 1)
string sText[4];//label text array (set to iMaxRowsOfLabels + 1)
int iLine[4];//label line number reference array (set to iMaxRowsOfLabels + 1)
bool bDrawLine[4];//draw label row yes or no array (set to iMaxRowsOfLabels + 1)

//MAIN VARIABLES
string sBullOrBear = "";     
string sPatternType = "";
static string sGartleyFibExpName = "[WRR_ZUP_INFO_GartFE_";     

//FLAG VARIABLES
bool bIsStartUpOfProgramFlag = true;//Default=true, to prevent alert each startup and chart timeframe change.
static string sLastPatternHolder = "";//leave as "".

//DIAGNOSTIC VARIABLES
string sLocalTimeWithMillisec = "";
string sScreenShotPatternFileName = "";

//**********************************************************************************************************
//START INITIALIZATION
//**********************************************************************************************************
int init()
    {
    //confirm that "Allow DLL imports" tick box is checked
    if ( !IsDllsAllowed() )//ERROR MESSAGE that the "Allow DLL imports" tick box is not checked.
       {
       Alert( "Select Allow DLL imports in Common tab of indicator properties in WRR_ZUP_INFO.");
       return;//CLOSE PROGRAM
       }
                   
    //STANDARD DRAWING ROUTINE - convert Corner string to Corner integer          
    if (Corner == "tl"){iCorner = 0;}
    if (Corner == "tr"){iCorner = 1;}
    if (Corner == "bl"){iCorner = 2;}
    if (Corner == "br"){iCorner = 3;} 
      
    //STANDARD DRAWING ROUTINE - Define initial label contents    

    sName    [1] = "PatternAndFileNameLabel";
    sText    [1] = "";
    iLine    [1] = 1;
    bDrawLine[1] = PatternAndFileNameLabel_1_ON;            

    sName    [2] = "RiskAndRangeLabel";      
    sText    [2] = "";
    iLine    [2] = 2;
    bDrawLine[2] = RiskAndRangeLabel_2_ON;
                
    sName    [3] = "AutoScreenShotONlabel";
    sText    [3] = "Automatic Screen Shots is ON";
    iLine    [3] = 3;
    
    if (!ScreenShotWhenPatternChange){ShowScreenShotsOnLabel_3_ON = false;}
    
    bDrawLine[3] = ShowScreenShotsOnLabel_3_ON;
    
/*           
    sName    [4] = "Test Line 4 Name";
    sText    [4] = "Test Line 4";
    iLine    [4] = 4;
    bDrawLine[4] = DrawLine_4;
*/                   
    //STANDARD DRAWING ROUTINE - determine number of rows of labels to draw
    if (bDrawLine[1] == true){iRowCount += 1;} 
    if (bDrawLine[2] == true){iRowCount += 1;} 
    if (bDrawLine[3] == true){iRowCount += 1;}            
      
    //if (DrawLine_4 == true){iRowCount += 1;}

    //show file name in top left corner (Comment)
    if(ShowFileNameInComment)
      {
      string comment= sFileName + "\n";
      Comment(comment); 
      }        
    return(0);
    }//END INTIALIZATION
//**********************************************************************************************************    
//START DE-INITIALIZATION
//**********************************************************************************************************
int deinit()
    {
    //delete all WRR_ZUP_INFO objects when removing indicator or changing charts
    int iTotalObj1= ObjectsTotal();   
    for (int i= iTotalObj1; i>=0; i--)
      {
      string sNameObj1 = ObjectName(i);   
      if (StringSubstr(sNameObj1,0,14)=="[WRR_ZUP_INFO_") 
          ObjectDelete(sNameObj1);
      }           
    return(0);
    }//END DE-INITIALIZATION
//**********************************************************************************************************    
//START RUN MAIN PROGRAM
//**********************************************************************************************************
int start()
    {    
    //Search objects to determine if ZUP has drawn pattern triangle and if so, identify which pattern
    sBullOrBear="";
    sPatternType="";
    int iTotalObj2= ObjectsTotal();   
    for (int a= iTotalObj2; a>=0; a--)
        {
        string sNameObj2 = ObjectName(a);
        if  (StringSubstr(sNameObj2,0,13)=="_0Triangle1_0")           
            {           
            //determine if "_0Triangle1_0" is drawn on chart (-1 if not found) and which pattern it is       
            if( StringFind(sNameObj2,"Bearish",0)!= -1 )
              {sBullOrBear="Bearish";}
            if( StringFind(sNameObj2,"Bullish",0)!= -1 )
              {sBullOrBear="Bullish";}
            if( StringFind(sNameObj2,"Gartley",0)!= -1 )
              {sPatternType="Gartley"; break;}
            if( StringFind(sNameObj2,"Butterfly",0)!= -1 )
              {sPatternType="Butterfly"; break;}
            if( StringFind(sNameObj2,"Bat",0)!= -1 )
              {sPatternType="Bat"; break;}
            if( StringFind(sNameObj2,"Crab",0)!= -1 )
              {sPatternType="Crab"; break;}                                                                  
            }                            
        }

    //If pattern is not a Gartley and if there are any Gartley Fib Expansions on chart, delete any Gartley Fib Expansions 
    //drawn by this indicator
    if (sPatternType != "Gartley") {fDeleteAllGartleyFibExp();}
    
    //START DRAW GARTLEY FIB EXPANSION if pattern is Gartley and show AB=CD Fib Expansion for Gartley is ON           
    //Determine coordinates for New Fib Expansion AB = CD if draw Gartley Fib Expansion is ON and there is a Gartley
    if (ShowABeqCD_FibExpGartley  == true && sPatternType == "Gartley")       
       {     
       //Get data points for drawing Fib Expansion for Gartleys
       int iTotalObj3= ObjectsTotal();   
       for (int j= iTotalObj3; j>=0; j--)
           {
           string sNameObj3 = ObjectName(j);
           if (StringSubstr(sNameObj3,0,13)=="_0Triangle1_0") 
              {       
              datetime dtTri1Time3A = ObjectGet(sNameObj3, OBJPROP_TIME3);//time at A
              int iTri1Bar3A = iBarShift(Symbol(),Period(),dtTri1Time3A);//bar number at time A for object name
              double dTri1Price3A = ObjectGet(sNameObj3, OBJPROP_PRICE3);//price at A
              datetime dtTri1Time2B = ObjectGet(sNameObj3, OBJPROP_TIME2);//time at B   
              int iTri1Bar2B = iBarShift(Symbol(),Period(),dtTri1Time2B);//bar number at time B for object name
              double dTri1Price2B = ObjectGet(sNameObj3, OBJPROP_PRICE2);//price at B      
              }      
           if (StringSubstr(sNameObj3,0,13)=="_0Triangle2_0") 
              { 
              datetime dtTri2Time3C = ObjectGet(sNameObj3, OBJPROP_TIME3);//time at C                     
              int iTri2Bar3C = iBarShift(Symbol(),Period(),dtTri2Time3C);//bar number at time C for object name;
              double dTri2Price3C = ObjectGet(sNameObj3, OBJPROP_PRICE3);//price at C                                      
              }      
           }   
       //Create name for possible new Gartley Fib Expansion
       string sNewGartleyFibExpName = StringConcatenate("[WRR_ZUP_INFO_GartFE_","T",iTri1Bar3A,"P",dTri1Price3A
                                                                               ,"T",iTri1Bar2B,"P",dTri1Price2B
                                                                               ,"T",iTri2Bar3C,"P",dTri2Price3C);
       //if a previous Gartley Fib Expansion is on the chart with different coordinates than the new required one
       //delete it and draw a new one, otherwise keep the existing one on the chart.               
       if (sNewGartleyFibExpName != sGartleyFibExpName)
          {fDeleteAllGartleyFibExp();
          sGartleyFibExpName = sNewGartleyFibExpName;                                                                                                                                                                                           
          ObjectCreate(sGartleyFibExpName,OBJ_EXPANSION,0,dtTri1Time3A,dTri1Price3A
                                                         ,dtTri1Time2B,dTri1Price2B
                                                         ,dtTri2Time3C,dTri2Price3C);
                
          ObjectSet(sGartleyFibExpName,OBJPROP_COLOR,Magenta);//CLR_NONE is an optional colour
          ObjectSet(sGartleyFibExpName,OBJPROP_WIDTH,3);//could set to 1
          ObjectSet(sGartleyFibExpName,OBJPROP_STYLE,0);
          ObjectSet(sGartleyFibExpName,OBJPROP_LEVELCOLOR,ABeqCD_FibExpGartleyColour);
          ObjectSet(sGartleyFibExpName,OBJPROP_LEVELSTYLE,2);
          ObjectSet(sGartleyFibExpName,OBJPROP_LEVELWIDTH,1);
          ObjectSet(sGartleyFibExpName,OBJPROP_BACK,true);
          ObjectSet(sGartleyFibExpName,OBJPROP_FIBOLEVELS,1);
          ObjectSet(sGartleyFibExpName,OBJPROP_FIRSTLEVEL,1.00);        
          ObjectSetFiboDescription(sGartleyFibExpName,0,"Better Gartley if AB=CD @ %$");
          } 
        }//END DRAW GARTLEY FIB EXPANSION if pattern is Gartley and show AB=CD Fib Expansion for Gartley is ON   
   
    //START IF THERE IS A PATTERN CALCULATE FAILURE PRICES   
    //The time bar that the start of the rectangle is drawn on (left edge), is same time bar as when pattern formed.     
    //find starting bar of formed pattern if pattern exists
    //determine if "_0PointD_0" is drawn on chart (-1 if not found)   
    if (ObjectFind("_0PointD_0")!= -1)//the name of the rectangle when ZUP set to draw only 1 pattern  
       {
       ObjectSet("_0PointD_0",OBJPROP_BACK,RectangleInBackground);//optionally change property to in background
       ObjectSet("_0PointD_0",OBJPROP_COLOR,RectangleColour);//optionally change colour of rectangle
       datetime RectangleTime2 = ObjectGet("_0PointD_0", OBJPROP_TIME2);//time at left edge of Rectangle       
       double RectanglePriceMin = ObjectGet("_0PointD_0", OBJPROP_PRICE1);//get high price of rectangle
       double RectanglePriceMax = ObjectGet("_0PointD_0", OBJPROP_PRICE2);//get low price of rectangle
       int RectangleStartBar = iBarShift(Symbol(),Period(),RectangleTime2);//get bar number for time
       
       //Determine High and Low Since Pattern Formed for use in determining pattern failure
       double high=0;
       double low =99999;
       int i=0;
       for (i=0;i<=RectangleStartBar;i++)
           {
           //get "high" price since rectangle formed
           if (high < High[i])
              high=High[i];
           //get "low" price since rectangle formed
           if (low > Low[i])
              low=Low[i];      
           }
       }//END IF THERE IS A PATTERN CALCULATE FAILURE PRICES
           
       //Create part of label names and part of file names            
       string sBullOrBearAndPatternType = (sBullOrBear + " " + sPatternType);//(e.g. Bullish Gartley)         
       sText[1]  = (  sBullOrBearAndPatternType + " on " + Symbol() + " " + sGetPeriod(Period()) );
                    
       sText[2]  = (  ", Range: " + DoubleToStr(RectanglePriceMin,Digits) + " to " + DoubleToStr(RectanglePriceMax,Digits) 
                      + " = " + DoubleToStr(RectanglePriceMax-RectanglePriceMin,Digits)  );             
    
    //START DRAW LABELS, DELETE FAILED GARTLEY FIB EXPANSIONS, SEND ALERTS, CREATE SCREEN SHOTS                                           
    //Bearish Pattern
    if(sBullOrBear == "Bearish" && high <= RectanglePriceMax)
      {            
      sText[2] = "Entry Risk: " + DoubleToStr(Close[0]-RectanglePriceMax,Digits) + " " + sText[2];    
      fStartDraw();
      if(PatternAlertON == true && AllAlertsOFF == false) {fAlerts(sBullOrBearAndPatternType);}                                        
      fRunAutoScreenShot(sBullOrBearAndPatternType);
      sLastPatternHolder = sText[1];            
      }                                                            
    //Bullish Pattern    
    if(sBullOrBear == "Bullish" && low >= RectanglePriceMin)
      {
      sText[2] = "Entry Risk: " + DoubleToStr(RectanglePriceMin-Close[0],Digits) + " " + sText[2];           
      fStartDraw();
      if(PatternAlertON == true && AllAlertsOFF == false) {fAlerts(sBullOrBearAndPatternType);}
      fRunAutoScreenShot(sBullOrBearAndPatternType);                               
      sLastPatternHolder = sText[1];                                    
      }
    //Bearish Pattern Failure    
    if(sBullOrBear == "Bearish" && high > RectanglePriceMax)
      {
      sText[1] = ("FAILED " + sText[1]);
      if(RemoveFibExpGartley_if_FAIL){fDeleteAllGartleyFibExp();}           
      sText[2] = "Entry Risk: " + DoubleToStr(Close[0]-RectanglePriceMax,Digits) + " " + sText[2];
      fStartDraw();
      if(FailedPatternAlertON == true && AllAlertsOFF == false){fAlerts(StringConcatenate("FAILED ",sBullOrBearAndPatternType));}             
      fRunAutoScreenShot("FAILED " + sBullOrBearAndPatternType);
      sLastPatternHolder = sText[1];                               
      }       
    //Bullish Pattern Failure
    if(sBullOrBear == "Bullish" && low < RectanglePriceMin)           
      {
      sText[1] = ("FAILED " + sText[1]);
      if(RemoveFibExpGartley_if_FAIL){fDeleteAllGartleyFibExp();}       
      sText[2] = "Entry Risk: " + DoubleToStr(Close[0]-RectanglePriceMin,Digits) + " " + sText[2];          
      fStartDraw();
      if(FailedPatternAlertON == true && AllAlertsOFF == false){fAlerts(StringConcatenate("FAILED ",sBullOrBearAndPatternType));}               
      fRunAutoScreenShot("FAILED " + sBullOrBearAndPatternType);
      sLastPatternHolder = sText[1];         
      }                               
    //No Pattern      
    if(sBullOrBearAndPatternType == " ")
      {
      sText[1] = ( "No Pattern Now" + " on " + Symbol() + " " + sGetPeriod(Period()) );
      sText[2] = "Entry Risk: N/A"; 
      fStartDraw();
      if(NoPatternAlertON == true && AllAlertsOFF == false){fAlerts("No Pattern Now");}
      fRunAutoScreenShot("No Pattern Now");
      sLastPatternHolder = sText[1];          
      }//END DRAW LABELS, DELETE FAILED GARTLEY FIB EXPANSIONS, SEND ALERTS, CREATE SCREEN SHOTS
    
     bIsStartUpOfProgramFlag = false; 
     sLastPatternHolder = sText[1];
         
   return(0);
   }//END RUN MAIN PROGRAM
//**********************************************************************************************************    
//START FUNCTIONS SECTION
//**********************************************************************************************************
string sGetPeriod(int iPeriod)//FUNCTION to show which chart period on alerts
       {
       string sPeriod;       
       switch (iPeriod)
              {      
              case 1:     {sPeriod="1M";  break;}
              case 5:     {sPeriod="5M";  break;}
              case 15:    {sPeriod="15M"; break;}
              case 30:    {sPeriod="30M"; break;}
              case 60:    {sPeriod="H1";  break;}
              case 240:   {sPeriod="H4";  break;}
              case 1440:  {sPeriod="D1";  break;}
              case 10080: {sPeriod="W1";  break;}
              case 43200: {sPeriod="MN";  break;}
              }
       return(sPeriod);
       } 
//**********************************************************************************************************
void fRunAutoScreenShot//FUNCTION to make screen shot at event
     (string sScreenShotPatternFileName)
     {     
     if(ScreenShotWhenPatternChange == true && sLastPatternHolder != sText[1])
       {
       string sLocalTimeWithMillisec = fFormatLocalTimeWithMillisec();      
       string sScreenShotTime = StringConcatenate( 
                                                  "Chart"//chart time       
                                                  + StringSubstr(TimeToStr(TimeCurrent(),TIME_DATE),0,4)
                                                  + StringSubstr(TimeToStr(TimeCurrent(),TIME_DATE),5,2)
                                                  + StringSubstr(TimeToStr(TimeCurrent(),TIME_DATE),8,2)
                                                  + " " 
                                                  + StringSubstr(TimeToStr(TimeCurrent(),TIME_DATE|TIME_MINUTES),11,2)
                                                  + StringSubstr(TimeToStr(TimeCurrent(),TIME_DATE|TIME_MINUTES),14,2)
                                                  + " " 
                                                  + StringSubstr(TimeToStr(TimeCurrent(),TIME_DATE|TIME_MINUTES|TIME_SECONDS),11,2)
                                                  + " "
                                                  , sLocalTimeWithMillisec//local time
                                                  );//+ delimiter faster but , delimiter needed next to variables?                                                                                                   
       
       //regular screen shot filename after intialization (for pattern changes after start up or after chart change)       
       if   (!bIsStartUpOfProgramFlag)     
            WindowScreenShot("WRR_ZUP_INFO Screen Shots\\" + Symbol() + " " + sGetPeriod(Period())+ " " + sScreenShotTime + " " 
                            + sScreenShotPatternFileName + ".gif"
                            ,ScreenShotWidth,ScreenShotHeight,-1,-1,-1);
                            
       //screen shot filename at intialization (for pattern at start up or at chart change)
       //adds the word " Intially" to end of file name                     
       else 
            WindowScreenShot("WRR_ZUP_INFO Screen Shots\\" + Symbol() + " " + sGetPeriod(Period())+ " " + sScreenShotTime + " " 
                            + sScreenShotPatternFileName + " Initially.gif"
                            ,ScreenShotWidth,ScreenShotHeight,-1,-1,-1);
                                                      
       //test numbers for screen resolution:  800 x 600,  960 x  600, 1024 x 768, 1088 x 612, 1152 x  864, 1280 x  720, 1280 x 800,
       //                                    1280 x 960, 1280 x 1024, 1360 x 768, 1600 x 900, 1600 x 1024, 1600 x 1200
       }          
     }
//**********************************************************************************************************
void fDeleteAllGartleyFibExp()//FUNCTION to delete all Gartley Fibonacci Expansion objects if any exist
     {
     int iTotalObj1= ObjectsTotal();   
     for (int i= iTotalObj1; i>=0; i--)
         {
         string sNameObj1= ObjectName(i);   
         if (StringSubstr(sNameObj1,0,20)=="[WRR_ZUP_INFO_GartFE") 
             ObjectDelete(sNameObj1);
         }
     }                
//**********************************************************************************************************
//STANDARD DRAWING ROUTINE - start draw
void fStartDraw()//FUNCTION to set parameters to draw text label
    {
    if(AllLabelsOFF == false)   
      {       
      //Optionally add Version Number to Text[1] (line 1)
      if(DisplayFileNameInLabel_1)
        {sText[1] = sText[1] + ",  " + sFileName;}        
      //STANDARD DRAWING ROUTINE - start drawing
      //Draw at Top    
      if(Corner == "tr" || Corner == "tl")//change order of line spacing depending if top or bottom
        {           
        iSpacer = 0;//Factor to multiply line spacing by for each new line
                    //(0 for highest line, INCREASE increment by one)                  
        for(int k=1;k<=iMaxRowsOfLabels;k++)
           {
           if(bDrawLine[k]){fDraw(sName[k],sText[k],iLine[k],iSpacer); iSpacer+=1;}
           }
        }//End Draw at Top      
      //Draw at Bottom  
      if(Corner == "bl" || Corner == "br")//change order of line spacing depending if top or bottom
        {      
        iSpacer = iRowCount-1;//Factor to multiply line spacing by for each new line
                              //(iRowCount for highest line, DECREASE increment by one)
        for(int h=1;h<=iMaxRowsOfLabels;h++)
           {
           if(bDrawLine[h]){fDraw(sName[h],sText[h],iLine[h],iSpacer); iSpacer-=1;}
           }
        }//End Draw at Bottom    
      }//END STANDARD DRAWING ROUTINE    
    }
//**********************************************************************************************************                
//STANDARD DRAWING ROUTINE - draw
void fDraw(string Name,string Text,string Line,int iSpacer)//FUNCTION to draw text label
     {
     string LineName = "[WRR_ZUP_INFO_Line_" + Line + "_Win_" + WindowNumber + "] " + Name;  
     ObjectCreate(LineName,OBJ_LABEL,WindowNumber,0,0);
     ObjectSet(LineName,OBJPROP_CORNER,iCorner);
     ObjectSet(LineName,OBJPROP_XDISTANCE,iLRMin+OffsetLeftRight);
     ObjectSet(LineName,OBJPROP_YDISTANCE,iTBMin+OffsetTopBottom+(FontSize+SpaceBetweenLines)* iSpacer);
     ObjectSet(LineName,OBJPROP_BACK,LabelsInBackground);
     ObjectSetText(LineName,Text,FontSize, FontType,FontColour);   
     }
//********************************************************************************************************** 
string fFormatLocalTimeWithMillisec()//FUNCTION to create custom non-MT4 local string time with milliseconds       
   //used for part of file name of screenshot *.gif file 
   {   
   int TimeArray[4];//Windows specification
   GetLocalTime(TimeArray);//Windows command
   //parse date and time from array    
   int nYear=TimeArray[0]&0x0000FFFF;
   int nMonth=TimeArray[0]>>16;
   int nDay=TimeArray[1]>>16;
   int nHour=TimeArray[2]&0x0000FFFF;
   int nMin=TimeArray[2]>>16;
   int nSec=TimeArray[3]&0x0000FFFF;
   int nMilliSec=TimeArray[3]>>16;         
   string sYear=nYear;
   string sMonth=100+nMonth;
   sMonth=StringSubstr(sMonth,1);
   string sDay=100+nDay;
   sDay=StringSubstr(sDay,1);   
   string sHour=100+nHour;
   sHour=StringSubstr(sHour,1);
   string sMin=100+nMin;
   sMin=StringSubstr(sMin,1);
   string sSec=100+nSec;
   sSec=StringSubstr(sSec,1);
   string sMilliSec=1000+nMilliSec;
   sMilliSec=StringSubstr(sMilliSec,1); 
   //returns special non-MT4 string date format with milliseconds and compatible in Windows file names
   return(   StringConcatenate( "Local" + sYear , sMonth , sDay + " " + sHour , sMin + " " + sSec + " " + sMilliSec  )   );
   }   
//**********************************************************************************************************      
void fAlerts(string BullOrBearAndPatternType)//FUNCTION to send an alert
     {     
     if(sLastPatternHolder != sText[1] && bIsStartUpOfProgramFlag == false)
       {
       Alert(TimeToStr(CurTime(),TIME_SECONDS)," ",Symbol()," ",sGetPeriod(Period())," ",BullOrBearAndPatternType);
       }
     }         
//**********************************************************************************************************
//END FUNCTIONS SECTION
//**********************************************************************************************************
//END CODE
//**********************************************************************************************************





Sample





Analysis



Market Information Used:

Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Series array that contains close prices for each bar


Indicator Curves created:


Indicators Used:



Custom Indicators Used:
kernel32

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen