GapViewyEn3

Author: fartarantula
Price Data Components
Series array that contains close prices for each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
1 Views
0 Downloads
0 Favorites
GapViewyEn3
//+------------------------------------------------------------------+
//|                                                        Sonar.mq4 |
//|                                                     fartarantula |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "fartarantula"
#property link      ""
#property indicator_chart_window
extern bool      Show_Gap_levels=true;
extern bool      Show_Gap_date=true;
extern bool      Gap_M1=false;
extern color     UplineM1=FireBrick;
extern color     DwnlineM1=DarkOliveGreen;
extern bool      Gap_M5=true;
extern color     UplineM5=Red;
extern color     DwnlineM5=Blue;
extern bool      Gap_M15=false;
extern color     UplineM15=Green;
extern color     DwnlineM15=BlueViolet;
extern bool      Gap_M30=false;
extern color     UplineM30=Yellow;
extern color     DwnlineM30=DarkSlateBlue;
extern bool      Gap_H1=false;
extern color     UplineH1=Sienna;
extern color     DwnlineH1=DarkSlateGray;
extern bool      Gap_H4=false;
extern color     UplineH4=Maroon;
extern color     DwnlineH4=SaddleBrown;
extern bool      Gap_D1=false;
extern color     UplineD1=MediumVioletRed;
extern color     DwnlineD1=OliveDrab;
extern bool      Gap_W1=false;
extern color     UplineW1=SpringGreen;
extern color     DwnlineW1=Teal;

extern int       DayHistory=60;
extern int       Price_Digits=4;

int init()
{
ObjectsDeleteAll(0,OBJ_HLINE);
return(0);
}
int deinit()
  {
ObjectsDeleteAll(0,OBJ_HLINE);
   return(0);
  }
int start()
{
init();
int i,b;
double price1,price2,price3;
datetime DALNOSTGAP=iTime(NULL,PERIOD_D1,DayHistory); 
//////////////////////////M1
if (Gap_M1==true)
{
int shiftDALNOSTGAP=iBarShift(NULL,1,DALNOSTGAP,false);
int DG=shiftDALNOSTGAP;
for (i=DG;i>1;i--)
{
if (Show_Gap_levels==true)
{
price1=NormalizeDouble(iClose(NULL,1,i),Price_Digits);     
price2=NormalizeDouble(iHigh(NULL,1,i-1),Price_Digits);    
price3=NormalizeDouble(iLow(NULL,1,i-1),Price_Digits);                
//*****************************************************
if (price1>price2)                                      
{     
for (b=i-1;b>=1;b--)
{
price2=NormalizeDouble(iHigh(NULL,1,b),Price_Digits);
if (price2>=price1) 
{
break;
} 
if (b==1)
{
string name =DoubleToStr( price1, 4);                     
ObjectCreate(name, OBJ_HLINE,0, 0,price1) ;              
ObjectSet(name,OBJPROP_COLOR,UplineM1);                    
if (Show_Gap_date==true)
{
datetime SecondUP=iTime(NULL,1,i); 
string opisanieUP=TimeToStr(SecondUP,TIME_DATE|TIME_MINUTES);
ObjectSetText(name, opisanieUP+"  M1"); 
}
}
}
}   
if (price1<price3)                                          
{     
for (b=i-1;b>=1;b--)
{
price3=NormalizeDouble(iLow(NULL,1,b),Price_Digits);
if (price3<=price1) 
{
break;
} 
if (b==1)
{
string name2 =DoubleToStr( price1, 4);                    
ObjectCreate(name2, OBJ_HLINE,0, 0,price1) ;            
ObjectSet(name2,OBJPROP_COLOR,DwnlineM1);                
if (Show_Gap_date==true)
{
datetime SecondDWN=iTime(NULL,1, i); 
string opisanieDWN=TimeToStr(SecondDWN,TIME_DATE|TIME_MINUTES);
ObjectSetText(name2, opisanieDWN+"  M1"); 
}
}
}
}
}
}
}
//////////////////////////M1
//////////////////////////M5
if (Gap_M5==true)
{
shiftDALNOSTGAP=iBarShift(NULL,5,DALNOSTGAP,false);
DG=shiftDALNOSTGAP;
for (i=DG;i>1;i--)
{
if (Show_Gap_levels==true)
{
price1=NormalizeDouble(iClose(NULL,5,i),Price_Digits);     
price2=NormalizeDouble(iHigh(NULL,5,i-1),Price_Digits);    
price3=NormalizeDouble(iLow(NULL,5,i-1),Price_Digits);                
//*****************************************************
if (price1>price2)                                      
{     
for (b=i-1;b>=1;b--)
{
price2=NormalizeDouble(iHigh(NULL,5,b),Price_Digits);
if (price2>=price1) 
{
break;
} 
if (b==1)
{
name =DoubleToStr( price1, 4);                     
ObjectCreate(name, OBJ_HLINE,0, 0,price1) ;              
ObjectSet(name,OBJPROP_COLOR,UplineM5);                    
if (Show_Gap_date==true)
{
SecondUP=iTime(NULL,5,i); 
opisanieUP=TimeToStr(SecondUP,TIME_DATE|TIME_MINUTES);
ObjectSetText(name, opisanieUP+"  M5"); 
}
}
}
}   
if (price1<price3)                                          
{     
for (b=i-1;b>=1;b--)
{
price3=NormalizeDouble(iLow(NULL,5,b),Price_Digits);
if (price3<=price1) 
{
break;
} 
if (b==1)
{
name2 =DoubleToStr( price1, 4);                    
ObjectCreate(name2, OBJ_HLINE,0, 0,price1) ;            
ObjectSet(name2,OBJPROP_COLOR,DwnlineM5);                
if (Show_Gap_date==true)
{
SecondDWN=iTime(NULL,5, i); 
opisanieDWN=TimeToStr(SecondDWN,TIME_DATE|TIME_MINUTES);
ObjectSetText(name2, opisanieDWN+"  M5"); 
}
}
}
}
}
}
}
//////////////////////////M5

//////////////////////////M15
if (Gap_M15==true)
{
shiftDALNOSTGAP=iBarShift(NULL,15,DALNOSTGAP,false);
DG=shiftDALNOSTGAP;
for (i=DG;i>1;i--)
{
if (Show_Gap_levels==true)
{
price1=NormalizeDouble(iClose(NULL,15,i),Price_Digits);     
price2=NormalizeDouble(iHigh(NULL,15,i-1),Price_Digits);    
price3=NormalizeDouble(iLow(NULL,15,i-1),Price_Digits);                
//*****************************************************
if (price1>price2)                                      
{     
for (b=i-1;b>=1;b--)
{
price2=NormalizeDouble(iHigh(NULL,15,b),Price_Digits);
if (price2>=price1) 
{
break;
} 
if (b==1)
{
name =DoubleToStr( price1, 4);                     
ObjectCreate(name, OBJ_HLINE,0, 0,price1) ;              
ObjectSet(name,OBJPROP_COLOR,UplineM15);                    
if (Show_Gap_date==true)
{
SecondUP=iTime(NULL,15,i); 
opisanieUP=TimeToStr(SecondUP,TIME_DATE|TIME_MINUTES);
ObjectSetText(name, opisanieUP+"  M15"); 
}
}
}
}   
if (price1<price3)                                          
{     
for (b=i-1;b>=1;b--)
{
price3=NormalizeDouble(iLow(NULL,15,b),Price_Digits);
if (price3<=price1) 
{
break;
} 
if (b==1)
{
name2 =DoubleToStr( price1, 4);                    
ObjectCreate(name2, OBJ_HLINE,0, 0,price1) ;            
ObjectSet(name2,OBJPROP_COLOR,DwnlineM15);                
if (Show_Gap_date==true)
{
SecondDWN=iTime(NULL,15, i); 
opisanieDWN=TimeToStr(SecondDWN,TIME_DATE|TIME_MINUTES);
ObjectSetText(name2, opisanieDWN+"  M15"); 
}
}
}
}
}
}
}
//////////////////////////M15

//////////////////////////M30

if (Gap_M30==true)
{
shiftDALNOSTGAP=iBarShift(NULL,30,DALNOSTGAP,false);
DG=shiftDALNOSTGAP;
for (i=DG;i>1;i--)
{
if (Show_Gap_levels==true)
{
price1=NormalizeDouble(iClose(NULL,30,i),Price_Digits);     
price2=NormalizeDouble(iHigh(NULL,30,i-1),Price_Digits);    
price3=NormalizeDouble(iLow(NULL,30,i-1),Price_Digits);                
//*****************************************************
if (price1>price2)                                      
{     
for (b=i-1;b>=1;b--)
{
price2=NormalizeDouble(iHigh(NULL,30,b),Price_Digits);
if (price2>=price1) 
{
break;
} 
if (b==1)
{
name =DoubleToStr( price1, 4);                     
ObjectCreate(name, OBJ_HLINE,0, 0,price1) ;              
ObjectSet(name,OBJPROP_COLOR,UplineM30);                    
if (Show_Gap_date==true)
{
SecondUP=iTime(NULL,30,i); 
opisanieUP=TimeToStr(SecondUP,TIME_DATE|TIME_MINUTES);
ObjectSetText(name, opisanieUP+"  M30"); 
}
}
}
}   
if (price1<price3)                                          
{     
for (b=i-1;b>=1;b--)
{
price3=NormalizeDouble(iLow(NULL,30,b),Price_Digits);
if (price3<=price1) 
{
break;
} 
if (b==1)
{
name2 =DoubleToStr( price1, 4);                    
ObjectCreate(name2, OBJ_HLINE,0, 0,price1) ;            
ObjectSet(name2,OBJPROP_COLOR,DwnlineM30);                
if (Show_Gap_date==true)
{
SecondDWN=iTime(NULL,30, i); 
opisanieDWN=TimeToStr(SecondDWN,TIME_DATE|TIME_MINUTES);
ObjectSetText(name2, opisanieDWN+"  M30"); 
}
}
}
}
}
}
}
///////m30
//////////////////////////H1

if (Gap_H1==true)
{
shiftDALNOSTGAP=iBarShift(NULL,60,DALNOSTGAP,false);
DG=shiftDALNOSTGAP;
for (i=DG;i>1;i--)
{
if (Show_Gap_levels==true)
{
price1=NormalizeDouble(iClose(NULL,60,i),Price_Digits);     
price2=NormalizeDouble(iHigh(NULL,60,i-1),Price_Digits);    
price3=NormalizeDouble(iLow(NULL,60,i-1),Price_Digits);                
//*****************************************************
if (price1>price2)                                      
{     
for (b=i-1;b>=1;b--)
{
price2=NormalizeDouble(iHigh(NULL,60,b),Price_Digits);
if (price2>=price1) 
{
break;
} 
if (b==1)
{
name =DoubleToStr( price1, 4);                     
ObjectCreate(name, OBJ_HLINE,0, 0,price1) ;              
ObjectSet(name,OBJPROP_COLOR,UplineH1);                    
if (Show_Gap_date==true)
{
SecondUP=iTime(NULL,60,i); 
opisanieUP=TimeToStr(SecondUP,TIME_DATE|TIME_MINUTES);
ObjectSetText(name, opisanieUP+"  H1"); 
}
}
}
}   
if (price1<price3)                                          
{     
for (b=i-1;b>=1;b--)
{
price3=NormalizeDouble(iLow(NULL,60,b),Price_Digits);
if (price3<=price1) 
{
break;
} 
if (b==1)
{
name2 =DoubleToStr( price1, 4);                    
ObjectCreate(name2, OBJ_HLINE,0, 0,price1) ;            
ObjectSet(name2,OBJPROP_COLOR,DwnlineH1);                
if (Show_Gap_date==true)
{
SecondDWN=iTime(NULL,60, i); 
opisanieDWN=TimeToStr(SecondDWN,TIME_DATE|TIME_MINUTES);
ObjectSetText(name2, opisanieDWN+"  H1"); 
}
}
}
}
}
}
}
///////////H4
if (Gap_H4==true)
{
shiftDALNOSTGAP=iBarShift(NULL,240,DALNOSTGAP,false);
DG=shiftDALNOSTGAP;
for (i=DG;i>1;i--)
{
if (Show_Gap_levels==true)
{
price1=NormalizeDouble(iClose(NULL,240,i),Price_Digits);     
price2=NormalizeDouble(iHigh(NULL,240,i-1),Price_Digits);    
price3=NormalizeDouble(iLow(NULL,240,i-1),Price_Digits);                
//*****************************************************
if (price1>price2)                                      
{     
for (b=i-1;b>=1;b--)
{
price2=NormalizeDouble(iHigh(NULL,240,b),Price_Digits);
if (price2>=price1) 
{
break;
} 
if (b==1)
{
name =DoubleToStr(price1, 4);                     
ObjectCreate(name, OBJ_HLINE,0, 0,price1) ;              
ObjectSet(name,OBJPROP_COLOR,UplineH4);                    
if (Show_Gap_date==true)
{
SecondUP=iTime(NULL,240,i); 
opisanieUP=TimeToStr(SecondUP,TIME_DATE|TIME_MINUTES);
ObjectSetText(name, opisanieUP+"  H4"); 
}
}
}
}   
if (price1<price3)                                          
{     
for (b=i-1;b>=1;b--)
{
price3=NormalizeDouble(iLow(NULL,240,b),Price_Digits);
if (price3<=price1) 
{
break;
} 
if (b==1)
{
name2 =DoubleToStr( price1, 4);                    
ObjectCreate(name2, OBJ_HLINE,0, 0,price1) ;            
ObjectSet(name2,OBJPROP_COLOR,DwnlineH4);                
if (Show_Gap_date==true)
{
SecondDWN=iTime(NULL,240, i); 
opisanieDWN=TimeToStr(SecondDWN,TIME_DATE|TIME_MINUTES);
ObjectSetText(name2, opisanieDWN+"  H4"); 
}
}
}
}
}
}
}
///////////D1
if (Gap_D1==true)
{
shiftDALNOSTGAP=iBarShift(NULL,1440,DALNOSTGAP,false);
DG=shiftDALNOSTGAP;
for (i=DG;i>1;i--)
{
if (Show_Gap_levels==true)
{
price1=NormalizeDouble(iClose(NULL,1440,i),Price_Digits);     
price2=NormalizeDouble(iHigh(NULL,1440,i-1),Price_Digits);    
price3=NormalizeDouble(iLow(NULL,1440,i-1),Price_Digits);                
//*****************************************************
if (price1>price2)                                      
{     
for (b=i-1;b>=1;b--)
{
price2=NormalizeDouble(iHigh(NULL,1440,b),Price_Digits);
if (price2>=price1) 
{
break;
} 
if (b==1)
{
name =DoubleToStr(price1, 4);                     
ObjectCreate(name, OBJ_HLINE,0, 0,price1) ;              
ObjectSet(name,OBJPROP_COLOR,UplineD1);                    
if (Show_Gap_date==true)
{
SecondUP=iTime(NULL,1440,i); 
opisanieUP=TimeToStr(SecondUP,TIME_DATE|TIME_MINUTES);
ObjectSetText(name, opisanieUP+"  D1"); 
}
}
}
}   
if (price1<price3)                                          
{     
for (b=i-1;b>=1;b--)
{
price3=NormalizeDouble(iLow(NULL,1440,b),Price_Digits);
if (price3<=price1) 
{
break;
} 
if (b==1)
{
name2 =DoubleToStr( price1, 4);                    
ObjectCreate(name2, OBJ_HLINE,0, 0,price1) ;            
ObjectSet(name2,OBJPROP_COLOR,DwnlineD1);                
if (Show_Gap_date==true)
{
SecondDWN=iTime(NULL,1440, i); 
opisanieDWN=TimeToStr(SecondDWN,TIME_DATE|TIME_MINUTES);
ObjectSetText(name2, opisanieDWN+"  D1"); 
}
}
}
}
}
}
}
///////////W1
if (Gap_W1==true)
{
shiftDALNOSTGAP=iBarShift(NULL,240,DALNOSTGAP,false);
DG=shiftDALNOSTGAP;
for (i=DG;i>1;i--)
{
if (Show_Gap_levels==true)
{
price1=NormalizeDouble(iClose(NULL,10080,i),Price_Digits);     
price2=NormalizeDouble(iHigh(NULL,10080,i-1),Price_Digits);    
price3=NormalizeDouble(iLow(NULL,10080,i-1),Price_Digits);                
//*****************************************************
if (price1>price2)                                      
{     
for (b=i-1;b>=1;b--)
{
price2=NormalizeDouble(iHigh(NULL,10080,b),Price_Digits);
if (price2>=price1) 
{
break;
} 
if (b==1)
{
name =DoubleToStr(price1, 4);                     
ObjectCreate(name, OBJ_HLINE,0, 0,price1) ;              
ObjectSet(name,OBJPROP_COLOR,UplineW1);                    
if (Show_Gap_date==true)
{
SecondUP=iTime(NULL,10080,i); 
opisanieUP=TimeToStr(SecondUP,TIME_DATE|TIME_MINUTES);
ObjectSetText(name, opisanieUP+"  W1"); 
}
}
}
}   
if (price1<price3)                                          
{     
for (b=i-1;b>=1;b--)
{
price3=NormalizeDouble(iLow(NULL,10080,b),Price_Digits);
if (price3<=price1) 
{
break;
} 
if (b==1)
{
name2 =DoubleToStr( price1, 4);                    
ObjectCreate(name2, OBJ_HLINE,0, 0,price1) ;            
ObjectSet(name2,OBJPROP_COLOR,DwnlineW1);                
if (Show_Gap_date==true)
{
SecondDWN=iTime(NULL,10080, i); 
opisanieDWN=TimeToStr(SecondDWN,TIME_DATE|TIME_MINUTES);
ObjectSetText(name2, opisanieDWN+"  W1"); 
}
}
}
}
}
}
}

return(0);
}

Comments