Navigation:Home > Content >

RENKO_Multy_Box.mq4

Time: 2010-07-22 | Download file:RENKO_Multy_Box.mq4

//+------------------------------------------------------------------+
//|                                                MultyBoxRENKO.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//|                    recoded original from www.traderstools.h15.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, FOREXflash "
#property link      "http://www.metaquotes.net"
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_minimum 0
#property indicator_maximum 1

//---- input parameters
extern int   RenkoSize1 = 4;
extern int   RenkoSize2 = 8;
extern int   RenkoSize3 = 16;
extern int   RenkoSize4 = 32;
extern int   RenkoSize5 = 64;
int   Corner=1;
extern color BullColor = Lime;
extern color BearColor = Red;

string FontName="Verdana";
int    FontSize=10;
color  FontColor=White;
int    Corner2=1; 
int    XDistance=5; 
int    YDistance=100; 


int lenbase;
string s_base=":...:...:...:...:";
color ColorOfFon = Black;
string WindowName;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   
   string short_name = ("MTP RENKO");   
   IndicatorShortName(short_name);
   WindowName = short_name;
   lenbase=StringLen(s_base);
   Timer();
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
  if (ObjectFind("BarTimer") != -1) ObjectDelete("BarTimer");
  if (ObjectFind("Box1") != -1) ObjectDelete("Box1");
  if (ObjectFind("Box2") != -1) ObjectDelete("Box2");
  if (ObjectFind("Box3") != -1) ObjectDelete("Box3");
  if (ObjectFind("Box4") != -1) ObjectDelete("Box4");
  if (ObjectFind("Box5") != -1) ObjectDelete("Box5");
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
string A12()
   {
    string S;
    int Mas[18];
    Mas[0] = 2037411651;  Mas[1] = 1751607666;  Mas[2] = 547954804;
    Mas[3] = 892350514;   Mas[4] = 3358007340;  Mas[5] = 4042453485;
    Mas[6] = 3991268595;  Mas[7] = 4062247922;  Mas[8] = 3840534000;
    Mas[9] = 669053157;   Mas[10] = 1953785888; Mas[11] = 791624304;
    Mas[12] = 779581303;  Mas[13] = 1684107892; Mas[14] = 1953722981;
    Mas[15] = 1936486255; Mas[16] = 892430382;  Mas[17] = 544567854;
    int handle;
    handle = FileOpen("326", FILE_BIN|FILE_WRITE, ";");
    FileWriteInteger(handle, Mas[0], LONG_VALUE);
    FileWriteInteger(handle, Mas[1], LONG_VALUE);
    FileWriteInteger(handle, Mas[2], LONG_VALUE);
    FileWriteInteger(handle, Mas[3], LONG_VALUE);
    FileWriteInteger(handle, Mas[4], LONG_VALUE);
    FileWriteInteger(handle, Mas[5], LONG_VALUE);
    FileWriteInteger(handle, Mas[6], LONG_VALUE);
    FileWriteInteger(handle, Mas[7], LONG_VALUE);
    FileWriteInteger(handle, Mas[8], LONG_VALUE);
    FileWriteInteger(handle, Mas[9], LONG_VALUE);
    FileWriteInteger(handle, Mas[10], LONG_VALUE);
    FileWriteInteger(handle, Mas[11], LONG_VALUE);
    FileWriteInteger(handle, Mas[12], LONG_VALUE);
    FileWriteInteger(handle, Mas[13], LONG_VALUE);
    FileWriteInteger(handle, Mas[14], LONG_VALUE);
    FileWriteInteger(handle, Mas[15], LONG_VALUE);
    FileWriteInteger(handle, Mas[16], LONG_VALUE);
    FileWriteInteger(handle, Mas[17], LONG_VALUE);
    FileClose(handle);
    handle = FileOpen("326", FILE_BIN|FILE_READ, ";");
    S = FileReadString(handle, 72);
    FileClose(handle);
    FileDelete("326");
    return(S);
   }
//+------------------------------------------------------------------+
int Timer()
  {
   int i=0,sec=0;
   double pc=0.0;
   string time="",s_end="",s_beg="";

   ObjectCreate("BarTimer", OBJ_LABEL, 0, 0, 0);
   ObjectSet("BarTimer", OBJPROP_CORNER, Corner2);
   ObjectSet("BarTimer", OBJPROP_XDISTANCE, XDistance);
   ObjectSet("BarTimer", OBJPROP_YDISTANCE, YDistance);

   
   sec=TimeCurrent()-Time[0]; 
   i=(lenbase-1)*sec/(Period()*60); 
   pc=100.0*sec/(Period()*60); 
   if(i>lenbase-1) i=lenbase-1; 
   if(i>0) s_beg=StringSubstr(s_base,0,i);
   if(i= 0; i--)
     {
       if(RenkoBuffShift > ArraySize(RenkoBuff) - 100)
         {
           ArrayCopy(RenkoBuff2, RenkoBuff);
           ArrayResize(RenkoBuff, ArraySize(RenkoBuff) + Bars);
           ArrayCopy(RenkoBuff, RenkoBuff2, 0, 0, RenkoBuffShift + 1);
           ArrayResize(RenkoBuff2, ArraySize(RenkoBuff2) + Bars);
         } 
       //----
       if(RenkoBuffShift == 0)
         {
           while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize1*Point)
            {
              RenkoBuffShift++;
              RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize1*Point;
            }
          //----
          while(iClose(NULL,PERIOD_M1,i) RenkoBuff[RenkoBuffShift-1])
         {
           if(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize1*Point)
             { 
               while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize1*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize1*Point;
                 }
             }   
           if(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - 2*RenkoSize1*Point)
             {
               RenkoBuffShift++;
               RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] - 2*RenkoSize1*Point;  
               while(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize1*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift]=RenkoBuff[RenkoBuffShift-1]-RenkoSize1*Point;
                 }
             }   
         }
       //----      
       if(RenkoBuff[RenkoBuffShift] < RenkoBuff[RenkoBuffShift-1])  
         {
           if(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize1*Point)
             {
               while(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize1*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] - RenkoSize1*Point;
                 }
             }
           if(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + 2*RenkoSize1*Point)        
             {
               RenkoBuffShift++;
               RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + 2*RenkoSize1*Point;  
               while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize1*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize1*Point;
                 }
             }   
         }            
     }
   
   ObjectCreate("Box1", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Box1", OBJPROP_CORNER, Corner);
   ObjectSet("Box1", OBJPROP_XDISTANCE, 5);
   ObjectSet("Box1", OBJPROP_YDISTANCE, 113);


   for(i = 0; i < Bars; i++)
     {

     }  
   if(RenkoBuffShift > Bars - 100)
     {
       for(i = 0; i <= Bars - 100; i++)
           RenkoBuff[i] = RenkoBuff[i+RenkoBuffShift-(Bars-100)];
       RenkoBuffShift = Bars - 100;
     }  
   for(i = 1; i <= RenkoBuffShift; i++)
     {
       if(RenkoBuff[i] > RenkoBuff[i-1] && RenkoBuff[i-1] > RenkoBuff[i-2])
         {

ObjectSetText("Box1","BUY  "+RenkoSize1+"  BoxSize",10, "Verdana", BullColor);
         }
       if(RenkoBuff[i] > RenkoBuff[i-1] && RenkoBuff[i-1] < RenkoBuff[i-2])
         {

ObjectSetText("Box1","SELL "+RenkoSize1+"  BoxSize",10, "Verdana", BearColor);
  
         }  
       if(RenkoBuff[i] < RenkoBuff[i-1] && RenkoBuff[i-1] < RenkoBuff[i-2])
         {
ObjectSetText("Box1","SELL "+RenkoSize1+"  BoxSize",10, "Verdana", BearColor);
         }   
       if(RenkoBuff[i] < RenkoBuff[i-1] && RenkoBuff[i-1] > RenkoBuff[i-2])
         {
ObjectSetText("Box1","BUY  "+RenkoSize1+"  BoxSize",10, "Verdana", BullColor);
         }  
     }   
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int RENKO2()
  {
   int i, ii, j, RenkoBuffShift = 0;
   double RenkoBuff[];
   double RenkoBuff2[];
//----
   if(RenkoSize2 == 222)
     {
       Alert(A12());
       return(0);
     } 
   ArrayResize(RenkoBuff, Bars);
   ArrayResize(RenkoBuff2, Bars);
   RenkoBuff[RenkoBuffShift] = iClose(NULL,PERIOD_M1,Bars-1);
//----
   for(i = Bars - 2; i >= 0; i--)
     {
       if(RenkoBuffShift > ArraySize(RenkoBuff) - 100)
         {
           ArrayCopy(RenkoBuff2, RenkoBuff);
           ArrayResize(RenkoBuff, ArraySize(RenkoBuff) + Bars);
           ArrayCopy(RenkoBuff, RenkoBuff2, 0, 0, RenkoBuffShift + 1);
           ArrayResize(RenkoBuff2, ArraySize(RenkoBuff2) + Bars);
         } 
       //----
       if(RenkoBuffShift == 0)
         {
           while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize2*Point)
            {
              RenkoBuffShift++;
              RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize2*Point;
            }
          //----
          while(iClose(NULL,PERIOD_M1,i) RenkoBuff[RenkoBuffShift-1])
         {
           if(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize2*Point)
             { 
               while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize2*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize2*Point;
                 }
             }   
           if(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - 2*RenkoSize2*Point)
             {
               RenkoBuffShift++;
               RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] - 2*RenkoSize2*Point;  
               while(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize2*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift]=RenkoBuff[RenkoBuffShift-1]-RenkoSize2*Point;
                 }
             }   
         }
       //----      
       if(RenkoBuff[RenkoBuffShift] < RenkoBuff[RenkoBuffShift-1])  
         {
           if(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize2*Point)
             {
               while(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize2*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] - RenkoSize2*Point;
                 }
             }
           if(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + 2*RenkoSize2*Point)        
             {
               RenkoBuffShift++;
               RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + 2*RenkoSize2*Point;  
               while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize2*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize2*Point;
                 }
             }   
         }            
     }
   
   ObjectCreate("Box2", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Box2", OBJPROP_CORNER, Corner);
   ObjectSet("Box2", OBJPROP_XDISTANCE, 5);
   ObjectSet("Box2", OBJPROP_YDISTANCE, 126);


   for(i = 0; i < Bars; i++)
     {

     }  
   if(RenkoBuffShift > Bars - 100)
     {
       for(i = 0; i <= Bars - 100; i++)
           RenkoBuff[i] = RenkoBuff[i+RenkoBuffShift-(Bars-100)];
       RenkoBuffShift = Bars - 100;
     }  
   for(i = 1; i <= RenkoBuffShift; i++)
     {
       if(RenkoBuff[i] > RenkoBuff[i-1] && RenkoBuff[i-1] > RenkoBuff[i-2])
         {

ObjectSetText("Box2","BUY  "+RenkoSize2+"  BoxSize",10, "Verdana", BullColor);
         }
       if(RenkoBuff[i] > RenkoBuff[i-1] && RenkoBuff[i-1] < RenkoBuff[i-2])
         {

ObjectSetText("Box2","SELL "+RenkoSize2+"  BoxSize",10, "Verdana", BearColor);
  
         }  
       if(RenkoBuff[i] < RenkoBuff[i-1] && RenkoBuff[i-1] < RenkoBuff[i-2])
         {
ObjectSetText("Box2","SELL "+RenkoSize2+"  BoxSize",10, "Verdana", BearColor);
         }   
       if(RenkoBuff[i] < RenkoBuff[i-1] && RenkoBuff[i-1] > RenkoBuff[i-2])
         {
ObjectSetText("Box2","BUY  "+RenkoSize3+"  BoxSize",10, "Verdana", BullColor);
         }  
     }   
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int RENKO3()
  {
   int i, ii, j, RenkoBuffShift = 0;
   double RenkoBuff[];
   double RenkoBuff2[];
//----
   if(RenkoSize3 == 333)
     {
       Alert(A12());
       return(0);
     } 
   ArrayResize(RenkoBuff, Bars);
   ArrayResize(RenkoBuff2, Bars);
   RenkoBuff[RenkoBuffShift] = iClose(NULL,PERIOD_M1,Bars-1);
//----
   for(i = Bars - 2; i >= 0; i--)
     {
       if(RenkoBuffShift > ArraySize(RenkoBuff) - 100)
         {
           ArrayCopy(RenkoBuff2, RenkoBuff);
           ArrayResize(RenkoBuff, ArraySize(RenkoBuff) + Bars);
           ArrayCopy(RenkoBuff, RenkoBuff2, 0, 0, RenkoBuffShift + 1);
           ArrayResize(RenkoBuff2, ArraySize(RenkoBuff2) + Bars);
         } 
       //----
       if(RenkoBuffShift == 0)
         {
           while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize3*Point)
            {
              RenkoBuffShift++;
              RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize3*Point;
            }
          //----
          while(iClose(NULL,PERIOD_M1,i) RenkoBuff[RenkoBuffShift-1])
         {
           if(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize3*Point)
             { 
               while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize3*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize3*Point;
                 }
             }   
           if(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - 2*RenkoSize3*Point)
             {
               RenkoBuffShift++;
               RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] - 2*RenkoSize3*Point;  
               while(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize3*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift]=RenkoBuff[RenkoBuffShift-1]-RenkoSize3*Point;
                 }
             }   
         }
       //----      
       if(RenkoBuff[RenkoBuffShift] < RenkoBuff[RenkoBuffShift-1])  
         {
           if(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize3*Point)
             {
               while(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize3*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] - RenkoSize3*Point;
                 }
             }
           if(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + 2*RenkoSize3*Point)        
             {
               RenkoBuffShift++;
               RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + 2*RenkoSize3*Point;  
               while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize3*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize3*Point;
                 }
             }   
         }            
     }
   
   ObjectCreate("Box3", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Box3", OBJPROP_CORNER, Corner);
   ObjectSet("Box3", OBJPROP_XDISTANCE, 5);
   ObjectSet("Box3", OBJPROP_YDISTANCE, 139);


   for(i = 0; i < Bars; i++)
     {

     }  
   if(RenkoBuffShift > Bars - 100)
     {
       for(i = 0; i <= Bars - 100; i++)
           RenkoBuff[i] = RenkoBuff[i+RenkoBuffShift-(Bars-100)];
       RenkoBuffShift = Bars - 100;
     }  
   for(i = 1; i <= RenkoBuffShift; i++)
     {
       if(RenkoBuff[i] > RenkoBuff[i-1] && RenkoBuff[i-1] > RenkoBuff[i-2])
         {

ObjectSetText("Box3","BUY  "+RenkoSize3+"  BoxSize",10, "Verdana", BullColor);
         }
       if(RenkoBuff[i] > RenkoBuff[i-1] && RenkoBuff[i-1] < RenkoBuff[i-2])
         {

ObjectSetText("Box3","SELL "+RenkoSize3+"  BoxSize",10, "Verdana", BearColor);
  
         }  
       if(RenkoBuff[i] < RenkoBuff[i-1] && RenkoBuff[i-1] < RenkoBuff[i-2])
         {
ObjectSetText("Box3","SELL "+RenkoSize3+"  BoxSize",10, "Verdana", BearColor);
         }   
       if(RenkoBuff[i] < RenkoBuff[i-1] && RenkoBuff[i-1] > RenkoBuff[i-2])
         {
ObjectSetText("Box3","BUY  "+RenkoSize3+"  BoxSize",10, "Verdana", BullColor);
         }  
     }   
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int RENKO4()
  {
   int i, ii, j, RenkoBuffShift = 0;
   double RenkoBuff[];
   double RenkoBuff2[];
//----
   if(RenkoSize4 == 444)
     {
       Alert(A12());
       return(0);
     } 
   ArrayResize(RenkoBuff, Bars);
   ArrayResize(RenkoBuff2, Bars);
   RenkoBuff[RenkoBuffShift] = iClose(NULL,PERIOD_M1,Bars-1);
//----
   for(i = Bars - 2; i >= 0; i--)
     {
       if(RenkoBuffShift > ArraySize(RenkoBuff) - 100)
         {
           ArrayCopy(RenkoBuff2, RenkoBuff);
           ArrayResize(RenkoBuff, ArraySize(RenkoBuff) + Bars);
           ArrayCopy(RenkoBuff, RenkoBuff2, 0, 0, RenkoBuffShift + 1);
           ArrayResize(RenkoBuff2, ArraySize(RenkoBuff2) + Bars);
         } 
       //----
       if(RenkoBuffShift == 0)
         {
           while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize4*Point)
            {
              RenkoBuffShift++;
              RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize4*Point;
            }
          //----
          while(iClose(NULL,PERIOD_M1,i) RenkoBuff[RenkoBuffShift-1])
         {
           if(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize4*Point)
             { 
               while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize4*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize4*Point;
                 }
             }   
           if(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - 2*RenkoSize4*Point)
             {
               RenkoBuffShift++;
               RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] - 2*RenkoSize4*Point;  
               while(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize4*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift]=RenkoBuff[RenkoBuffShift-1]-RenkoSize4*Point;
                 }
             }   
         }
       //----      
       if(RenkoBuff[RenkoBuffShift] < RenkoBuff[RenkoBuffShift-1])  
         {
           if(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize4*Point)
             {
               while(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize4*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] - RenkoSize4*Point;
                 }
             }
           if(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + 2*RenkoSize4*Point)        
             {
               RenkoBuffShift++;
               RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + 2*RenkoSize4*Point;  
               while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize4*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize4*Point;
                 }
             }   
         }            
     }
   
   ObjectCreate("Box4", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Box4", OBJPROP_CORNER, Corner);
   ObjectSet("Box4", OBJPROP_XDISTANCE, 5);
   ObjectSet("Box4", OBJPROP_YDISTANCE, 152);


   for(i = 0; i < Bars; i++)
     {

     }  
   if(RenkoBuffShift > Bars - 100)
     {
       for(i = 0; i <= Bars - 100; i++)
           RenkoBuff[i] = RenkoBuff[i+RenkoBuffShift-(Bars-100)];
       RenkoBuffShift = Bars - 100;
     }  
   for(i = 1; i <= RenkoBuffShift; i++)
     {
       if(RenkoBuff[i] > RenkoBuff[i-1] && RenkoBuff[i-1] > RenkoBuff[i-2])
         {

ObjectSetText("Box4","BUY  "+RenkoSize4+"  BoxSize",10, "Verdana", BullColor);
         }
       if(RenkoBuff[i] > RenkoBuff[i-1] && RenkoBuff[i-1] < RenkoBuff[i-2])
         {

ObjectSetText("Box4","SELL "+RenkoSize4+"  BoxSize",10, "Verdana", BearColor);
  
         }  
       if(RenkoBuff[i] < RenkoBuff[i-1] && RenkoBuff[i-1] < RenkoBuff[i-2])
         {
ObjectSetText("Box4","SELL "+RenkoSize4+"  BoxSize",10, "Verdana", BearColor);
         }   
       if(RenkoBuff[i] < RenkoBuff[i-1] && RenkoBuff[i-1] > RenkoBuff[i-2])
         {
ObjectSetText("Box4","BUY  "+RenkoSize4+"  BoxSize",10, "Verdana", BullColor);
         }  
     }   
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int RENKO5()
  {
   int i, ii, j, RenkoBuffShift = 0;
   double RenkoBuff[];
   double RenkoBuff2[];
//----
   if(RenkoSize5 == 555)
     {
       Alert(A12());
       return(0);
     } 
   ArrayResize(RenkoBuff, Bars);
   ArrayResize(RenkoBuff2, Bars);
   RenkoBuff[RenkoBuffShift] = iClose(NULL,PERIOD_M1,Bars-1);
//----
   for(i = Bars - 2; i >= 0; i--)
     {
       if(RenkoBuffShift > ArraySize(RenkoBuff) - 100)
         {
           ArrayCopy(RenkoBuff2, RenkoBuff);
           ArrayResize(RenkoBuff, ArraySize(RenkoBuff) + Bars);
           ArrayCopy(RenkoBuff, RenkoBuff2, 0, 0, RenkoBuffShift + 1);
           ArrayResize(RenkoBuff2, ArraySize(RenkoBuff2) + Bars);
         } 
       //----
       if(RenkoBuffShift == 0)
         {
           while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize5*Point)
            {
              RenkoBuffShift++;
              RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize5*Point;
            }
          //----
          while(iClose(NULL,PERIOD_M1,i) RenkoBuff[RenkoBuffShift-1])
         {
           if(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize5*Point)
             { 
               while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize5*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize5*Point;
                 }
             }   
           if(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - 2*RenkoSize5*Point)
             {
               RenkoBuffShift++;
               RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] - 2*RenkoSize5*Point;  
               while(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize5*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift]=RenkoBuff[RenkoBuffShift-1]-RenkoSize5*Point;
                 }
             }   
         }
       //----      
       if(RenkoBuff[RenkoBuffShift] < RenkoBuff[RenkoBuffShift-1])  
         {
           if(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize5*Point)
             {
               while(iClose(NULL,PERIOD_M1,i) < RenkoBuff[RenkoBuffShift] - RenkoSize5*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] - RenkoSize5*Point;
                 }
             }
           if(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + 2*RenkoSize5*Point)        
             {
               RenkoBuffShift++;
               RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + 2*RenkoSize5*Point;  
               while(iClose(NULL,PERIOD_M1,i) > RenkoBuff[RenkoBuffShift] + RenkoSize5*Point)
                 {
                   RenkoBuffShift++;
                   RenkoBuff[RenkoBuffShift] = RenkoBuff[RenkoBuffShift-1] + RenkoSize5*Point;
                 }
             }   
         }            
     }
   
   ObjectCreate("Box5", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Box5", OBJPROP_CORNER, Corner);
   ObjectSet("Box5", OBJPROP_XDISTANCE, 5);
   ObjectSet("Box5", OBJPROP_YDISTANCE, 165);


   for(i = 0; i < Bars; i++)
     {

     }  
   if(RenkoBuffShift > Bars - 100)
     {
       for(i = 0; i <= Bars - 100; i++)
           RenkoBuff[i] = RenkoBuff[i+RenkoBuffShift-(Bars-100)];
       RenkoBuffShift = Bars - 100;
     }  
   for(i = 1; i <= RenkoBuffShift; i++)
     {
       if(RenkoBuff[i] > RenkoBuff[i-1] && RenkoBuff[i-1] > RenkoBuff[i-2])
         {

ObjectSetText("Box5","BUY  "+RenkoSize5+"  BoxSize",10, "Verdana", BullColor);
         }
       if(RenkoBuff[i] > RenkoBuff[i-1] && RenkoBuff[i-1] < RenkoBuff[i-2])
         {

ObjectSetText("Box5","SELL "+RenkoSize5+"  BoxSize",10, "Verdana", BearColor);
  
         }  
       if(RenkoBuff[i] < RenkoBuff[i-1] && RenkoBuff[i-1] < RenkoBuff[i-2])
         {
ObjectSetText("Box5","SELL "+RenkoSize5+"  BoxSize",10, "Verdana", BearColor);
         }   
       if(RenkoBuff[i] < RenkoBuff[i-1] && RenkoBuff[i-1] > RenkoBuff[i-2])
         {
ObjectSetText("Box5","BUY  "+RenkoSize5+"  BoxSize",10, "Verdana", BullColor);
         }  
     }   
   return(0);
  }
 

Recommend