_BZ_everyhour_G





//+------------------------------------------------------------------+
//|                  _BZ_everyhour_G                                 |
//|                                                                  | 
//|   Copyright © 2007, Avery T. Horton, Jr. aka TheRumpledOne       |
//|                                                                  |
//|   PO BOX 43575, TUCSON, AZ 85733                                 |
//|                                                                  |
//|   GIFT AND DONATIONS ACCEPTED                                    | 
//|                                                                  |  
//|    http://docs.mql4.com/constants/wingdings                      |                                         |
//+------------------------------------------------------------------+

#property copyright "Copyright © 2007, Avery T. Horton, Jr. aka TheRumpledOne"
#property link      "therumpledone@gmail.com"

#property indicator_chart_window 
#property indicator_buffers 5
#property indicator_color1 Blue 
#property indicator_color2 Blue
#property indicator_color3 White 
#property indicator_color4 Red
#property indicator_color5 Red

//---- For the small screens
//extern string    Display_infos         = "=== If true, displayed on the chart ===";
//extern bool      display_on_chart      =  true ;  // If true, the open trade analysis, daily pivots and daily range will be displayed on the chart window

// indicators parameters

extern bool iPlotChart = true ;
extern bool iPlotGauge = true ;


extern int       straddle_width=3;
extern int       channel=1;

extern int myPeriod  = 60 ;
extern int myOffset  = 1 ; 
extern int myChartY = 1 ;

extern int myStyle1  = 2 ;
extern int myStyle2  = 2 ;
extern int myStyle3  = 2 ;
extern int myStyle4  = 2 ;
extern int myStyle5  = 2 ;
extern int myStyle6  = 2 ;
extern int myStyle7  = 2 ;

extern int myWingDing1  = 228 ;
extern int myWingDing2  = 224 ;
extern int myWingDing3  = 224 ;
extern int myWingDing4  = 224 ;
extern int myWingDing5  = 230 ;
extern int myWingDing6  = 115 ;
extern int myWingDing7  = 115 ;

extern color myColor1 =Blue ;
extern color myColor2 =Blue ;
extern color myColor3 =White;
extern color myColor4 =Red;
extern color myColor5 =Red;
extern color myColor6 =Orange;
extern color myColor7 =OrangeRed;

//---- buffers

double P1Buffer[];
double P2Buffer[];
double P3Buffer[];
double P4Buffer[];
double P5Buffer[];
double P6Buffer[];
double P7Buffer[];


//int myPeriod = PERIOD_D1;

int TimeZone=0;
bool pivots = true;
bool alert = true;



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- name for indicator window

   string short_name=" ";
   IndicatorShortName(short_name);
   SetIndexBuffer(0, P1Buffer);
   SetIndexBuffer(1, P2Buffer);
   SetIndexBuffer(2, P3Buffer);
   SetIndexBuffer(3, P4Buffer);
   SetIndexBuffer(4, P5Buffer);
   SetIndexBuffer(5, P6Buffer);
   SetIndexBuffer(6, P7Buffer);
//----

SetIndexArrow(0, myWingDing1); 
SetIndexArrow(1, myWingDing2); 
SetIndexArrow(2, myWingDing3); 
SetIndexArrow(3, myWingDing4); 
SetIndexArrow(4, myWingDing5); 
SetIndexArrow(5, myWingDing6); 
SetIndexArrow(6, myWingDing7); 
 


   SetIndexStyle(0, DRAW_ARROW, myStyle1, 1);
   SetIndexStyle(1, DRAW_ARROW, myStyle2, 1);   
   SetIndexStyle(2, DRAW_ARROW, myStyle3, 1);
   SetIndexStyle(3, DRAW_ARROW, myStyle4, 1);
   SetIndexStyle(4, DRAW_ARROW, myStyle5, 1);
   SetIndexStyle(5, DRAW_ARROW, myStyle6, 1);
   SetIndexStyle(6, DRAW_ARROW, myStyle7, 1);   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   
   ObjectDelete("BZ");
   ObjectDelete("line5BZ");
   ObjectDelete("X01_LabelBZ");
   ObjectDelete("X01_ValueBZ");
   ObjectDelete("X02_LabelBZ");
   ObjectDelete("X02_ValueBZ");
   ObjectDelete("X03_LabelBZ");
   ObjectDelete("X03_ValueBZ");
   ObjectDelete("X04_LabelBZ");
   ObjectDelete("X04_ValueBZ");
   ObjectDelete("X05_LabelBZ");
   ObjectDelete("X05_ValueBZ");
   ObjectDelete("X06_LabelBZ");
   ObjectDelete("X06_ValueBZ");
   ObjectDelete("X07_LabelBZ");
   ObjectDelete("X07_ValueBZ");

   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {

  int j,total=OrdersTotal();
   for(j=0;j<total;j++)
   {
    OrderSelect(j, SELECT_BY_POS, MODE_TRADES);
   }
   
   color color_common_line = White;
   color color_common_text = White;
   color color_ind = PowderBlue;
   color color_indic;
   color color_pivots_1=Orchid;

   double x = iOpen(NULL,PERIOD_H1,0);

			
	double X01 = x +(straddle_width+channel)*Point ;	
   double X02 = x+straddle_width*Point ;
   double X03 = iOpen(NULL,PERIOD_H1,0);
   double X04 = x-straddle_width*Point ;	
   double X05 = x-(straddle_width+channel)*Point ; 	
   
//   double X06 = yesterday_low - (xRange * 0.382 ) ; // fib 382	
//	double X07 = yesterday_low - (xRange * 0.618 ) ; // fib 618

if ( iPlotChart ) { 
int i = 0 ;	
	P1Buffer[i] = X01 ;
	P2Buffer[i] = X02 ;
   P3Buffer[i] = X03 ;
	P4Buffer[i] = X04 ;
	P5Buffer[i] = X05 ;
	
//   P6Buffer[i] = X06 ;
//   P7Buffer[i] = X07 ;
   
} // iPlotChart

 

if ( iPlotGauge ) {  
    
string StrX01 = "LgTop" ; 
string StrX02 = "LgBot" ; 
string StrX03 = "Open" ; 
string StrX04 = "ShTop" ; 
string StrX05 = "ShBot" ; 
string StrX06 = "-XO6" ; 
string StrX07 = "-XO7" ; 
             
   color color_X01=Blue;
   color color_X02=Blue;
   color color_X03=White;
   color color_X04=Red;
   color color_X05=Red;
   color color_X06=Red;
   color color_X07=Red;  

/*   	
	if( day_close < X01) { color_X01=Lime; } 
	if( day_close < X02) { color_X02=Lime; } 	
	if( day_close < X03) { color_X04=Lime; } 
	if( day_close < X04) { color_X04=Lime; } 
	if( day_close < X05) { color_X05=Lime; } 
	if( day_close < X06) { color_X07=Lime; }		
	if( day_close < X07) { color_X07=Lime; }		
*/		
	int Precision, dig;	

   if( StringFind( Symbol(), "JPY", 0) != -1 ) { Precision = 100; dig = 2;}
   else                                        { Precision = 10000; dig = 4; }

int sPeriod= Period();

if (myPeriod != NULL){ sPeriod= myPeriod ;}
       	
//---- Set labels

   int WindowToUse;
   int Corner_line, Xdist_line;
   int Corner_text, Corner_ValueBZ, Xdist_text, Xdist_ValueBZ;
   int Ydist_line5;
   int Corner_pivots, Xdist_pivots, Ydist_pivots;
   int Ydist_X01, Ydist_X02, Ydist_X03, Ydist_X04, Ydist_X05, Ydist_X06, Ydist_X07;
   int YdistInc ;
   
    WindowToUse =  0;
    Corner_line = 1;
    Corner_text = 1; 
    Corner_ValueBZ = 1;
    Xdist_line = 21; 
    Xdist_text = 93; 
    Xdist_ValueBZ = 23;
    Corner_pivots = 1; 
    Xdist_pivots = 21; 
    
    Ydist_pivots = myChartY;  
    Ydist_line5 = 
    Ydist_pivots + 11; 
    YdistInc = 15 ;
    Ydist_X01 = Ydist_pivots + 25; 
    Ydist_X02 = Ydist_X01 + YdistInc; 
    Ydist_X03 = Ydist_X01 + YdistInc*2; 
    Ydist_X04 = Ydist_X01 + YdistInc*3; 
    Ydist_X05 = Ydist_X01 + YdistInc*4; 
    Ydist_X06 = Ydist_X01 + YdistInc*5; 
    Ydist_X07 = Ydist_X01 + YdistInc*6;

   ObjectCreate("BZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("BZ",sPeriod + "BuyZone",9, "Verdana", color_pivots_1);
   ObjectSet("BZ", OBJPROP_CORNER, Corner_pivots);
   ObjectSet("BZ", OBJPROP_XDISTANCE, Xdist_pivots);
   ObjectSet("BZ", OBJPROP_YDISTANCE, Ydist_pivots);
   
   ObjectCreate("line5BZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("line5BZ","---------------------",7, "Verdana", color_pivots_1);
   ObjectSet("line5BZ", OBJPROP_CORNER, Corner_line);
   ObjectSet("line5BZ", OBJPROP_XDISTANCE, Xdist_line);
   ObjectSet("line5BZ", OBJPROP_YDISTANCE, Ydist_line5);
   
   ObjectCreate("X01_LabelBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X01_LabelBZ",StrX01,9, "Verdana", myColor1);
   ObjectSet("X01_LabelBZ", OBJPROP_CORNER, Corner_text);
   ObjectSet("X01_LabelBZ", OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet("X01_LabelBZ", OBJPROP_YDISTANCE, Ydist_X01);
   
   ObjectCreate("X01_ValueBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X01_ValueBZ"," "+DoubleToStr(X01,dig),9, "Verdana", color_X01);
   ObjectSet("X01_ValueBZ", OBJPROP_CORNER, Corner_ValueBZ);
   ObjectSet("X01_ValueBZ", OBJPROP_XDISTANCE, Xdist_ValueBZ);
   ObjectSet("X01_ValueBZ", OBJPROP_YDISTANCE, Ydist_X01);
   
   ObjectCreate("X02_LabelBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X02_LabelBZ",StrX02,9, "Verdana", myColor2);
   ObjectSet("X02_LabelBZ", OBJPROP_CORNER, Corner_text);
   ObjectSet("X02_LabelBZ", OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet("X02_LabelBZ", OBJPROP_YDISTANCE, Ydist_X02);
   
   ObjectCreate("X02_ValueBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X02_ValueBZ"," "+DoubleToStr(X02,dig),9, "Verdana", color_X02);
   ObjectSet("X02_ValueBZ", OBJPROP_CORNER, Corner_ValueBZ);
   ObjectSet("X02_ValueBZ", OBJPROP_XDISTANCE, Xdist_ValueBZ);
   ObjectSet("X02_ValueBZ", OBJPROP_YDISTANCE, Ydist_X02);
 
   ObjectCreate("X03_LabelBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X03_LabelBZ",StrX03,9, "Verdana", myColor3 );
   ObjectSet("X03_LabelBZ", OBJPROP_CORNER, Corner_text);
   ObjectSet("X03_LabelBZ", OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet("X03_LabelBZ", OBJPROP_YDISTANCE, Ydist_X03);
   
   ObjectCreate("X03_ValueBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X03_ValueBZ"," "+DoubleToStr(X03,dig),9, "Verdana", color_X03);
   ObjectSet("X03_ValueBZ", OBJPROP_CORNER, Corner_ValueBZ);
   ObjectSet("X03_ValueBZ", OBJPROP_XDISTANCE, Xdist_ValueBZ);
   ObjectSet("X03_ValueBZ", OBJPROP_YDISTANCE, Ydist_X03);

   ObjectCreate("X04_LabelBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X04_LabelBZ",StrX04,9, "Verdana", myColor4 );
   ObjectSet("X04_LabelBZ", OBJPROP_CORNER, Corner_text);
   ObjectSet("X04_LabelBZ", OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet("X04_LabelBZ", OBJPROP_YDISTANCE, Ydist_X04);
   
   ObjectCreate("X04_ValueBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X04_ValueBZ"," "+DoubleToStr(X04,dig),9, "Verdana", color_X04);
   ObjectSet("X04_ValueBZ", OBJPROP_CORNER, Corner_ValueBZ);
   ObjectSet("X04_ValueBZ", OBJPROP_XDISTANCE, Xdist_ValueBZ);
   ObjectSet("X04_ValueBZ", OBJPROP_YDISTANCE, Ydist_X04);

   ObjectCreate("X05_LabelBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X05_LabelBZ",StrX05,9, "Verdana", myColor5 );
   ObjectSet("X05_LabelBZ", OBJPROP_CORNER, Corner_text);
   ObjectSet("X05_LabelBZ", OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet("X05_LabelBZ", OBJPROP_YDISTANCE, Ydist_X05);
 
   ObjectCreate("X05_ValueBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X05_ValueBZ"," "+DoubleToStr(X05,dig),9, "Verdana", color_X05);
   ObjectSet("X05_ValueBZ", OBJPROP_CORNER, Corner_ValueBZ);
   ObjectSet("X05_ValueBZ", OBJPROP_XDISTANCE, Xdist_ValueBZ);
   ObjectSet("X05_ValueBZ", OBJPROP_YDISTANCE, Ydist_X05);
/*     
   ObjectCreate("X06_LabelBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X06_LabelBZ",StrX06,9, "Verdana", myColor6 );
   ObjectSet("X06_LabelBZ", OBJPROP_CORNER, Corner_text);
   ObjectSet("X06_LabelBZ", OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet("X06_LabelBZ", OBJPROP_YDISTANCE, Ydist_X06);
   
   ObjectCreate("X06_ValueBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X06_ValueBZ"," "+DoubleToStr(X06,dig),9, "Verdana", color_X06);
   ObjectSet("X06_ValueBZ", OBJPROP_CORNER, Corner_ValueBZ);
   ObjectSet("X06_ValueBZ", OBJPROP_XDISTANCE, Xdist_ValueBZ);
   ObjectSet("X06_ValueBZ", OBJPROP_YDISTANCE, Ydist_X06);
   
   ObjectCreate("X07_LabelBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X07_LabelBZ",StrX07,9, "Verdana", myColor7 );
   ObjectSet("X07_LabelBZ", OBJPROP_CORNER, Corner_text);
   ObjectSet("X07_LabelBZ", OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet("X07_LabelBZ", OBJPROP_YDISTANCE, Ydist_X07);
   
   ObjectCreate("X07_ValueBZ", OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText("X07_ValueBZ"," "+DoubleToStr(X07,dig),9, "Verdana", color_X07);
   ObjectSet("X07_ValueBZ", OBJPROP_CORNER, Corner_ValueBZ);
   ObjectSet("X07_ValueBZ", OBJPROP_XDISTANCE, Xdist_ValueBZ);
   ObjectSet("X07_ValueBZ", OBJPROP_YDISTANCE, Ydist_X07);
*/
} // iPlotGauge
    
   return(0);
  }



Sample





Analysis



Market Information Used:

Series array that contains open prices of each bar


Indicator Curves created:


Implements a curve of type DRAW_ARROW

Indicators Used:



Custom Indicators Used:

Order Management characteristics:
Checks for the total of open orders

Other Features: