BZ_everyhour





//+------------------------------------------------------------------+
//|                                                          MTC.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

// Thanks Avery Da RumpledOne for sharing his brilliant ideas



#property indicator_chart_window
//---- input parameters
extern string    session_name = "Hour open";
extern color     session_color = White;
//extern int       open_time=8;
extern int       straddle_width=3;
extern int       channel=1;


double open_price;
double rates_h1[2][6];
string OP, BZ, BZW, SZ, SZW;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators


  OP = "Open " + session_name;
  BZ = "Buy zone " + session_name;
  BZW = "Buy zone width " + session_name;
  SZ = "Sell zone " + session_name;
  SZW = "Sell zone width " + session_name;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete(OP);
   ObjectDelete(BZ);
   ObjectDelete(BZW);
   
   ObjectDelete(SZ);
   ObjectDelete(SZW);
   
   ObjectDelete(session_name);
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----



/*  ArrayCopyRates(rates_h1, Symbol(), PERIOD_H1);
   for (int i=0;i<=25;i++)
   {
       if (TimeMinute(rates_h1[i][0])==0 && (TimeHour(rates_h1[i][0])-open_time)==0)
       {
           
      open_price = rates_h1[i][1];
    //  today_open = rates_h1[i][1];      
      break;
       }
   }
   
 */
 
 
    open_price = iOpen(NULL,PERIOD_H1,0);  

    if (ObjectFind(OP) != 0)
    
      {
      
      
          ObjectCreate(session_name,OBJ_TEXT,0,CurTime(),open_price+4*Point);
          ObjectSetText(session_name, session_name+"                                                                                                                                                        ",
                                                                                  8, "Arial",session_color);
      //    ObjectSet(session_name, OBJPROP_YDISTANCE, 100);
          
          
          ObjectCreate(OP, OBJ_HLINE, 0, CurTime(), open_price);
          ObjectSet(OP, OBJPROP_STYLE, STYLE_DOT);
          ObjectSet(OP, OBJPROP_COLOR, session_color);
          
          ObjectCreate(BZ, OBJ_HLINE, 0, CurTime(), open_price+straddle_width*Point);
          ObjectSet(BZ, OBJPROP_STYLE, STYLE_DASH);
          ObjectSet(BZ, OBJPROP_COLOR, Blue);
          
          ObjectCreate(BZW, OBJ_HLINE, 0, CurTime(), open_price+(straddle_width+channel)*Point);
          ObjectSet(BZW, OBJPROP_STYLE, STYLE_DASH);
          ObjectSet(BZW, OBJPROP_COLOR, Blue);
          
          
          ObjectCreate(SZ, OBJ_HLINE, 0, CurTime(), open_price-straddle_width*Point);
          ObjectSet(SZ, OBJPROP_STYLE, STYLE_DASH);
          ObjectSet(SZ, OBJPROP_COLOR, Red);
          
          ObjectCreate(SZW, OBJ_HLINE, 0, CurTime(), open_price-(straddle_width+channel)*Point);
          ObjectSet(SZW, OBJPROP_STYLE, STYLE_DASH);
          ObjectSet(SZW, OBJPROP_COLOR, Red);
          
          
      
       
      }
      
      else
      {
         ObjectMove(session_name,0,CurTime(),open_price+4*Point);
         ObjectMove(OP, 0, CurTime(), open_price);
         ObjectMove(BZ, 0, CurTime(),open_price+straddle_width*Point);
         ObjectMove(BZW, 0, CurTime(),open_price+(straddle_width+channel)*Point); 
         ObjectMove(SZ, 0, CurTime(),open_price-straddle_width*Point);
         ObjectMove(SZW, 0, CurTime(),open_price-(straddle_width+channel)*Point);
      
      }

   
//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample



image not available


Analysis



Market Information Used:

Series array that contains open prices of each bar


Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: