//+------------------------------------------------------------------+
//|                                                KG SEAWAVE MA.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "kgforexworld.com"

#property indicator_chart_window
#property indicator_buffers 8

extern int Corner=1;
extern color MA_4Year_Color=Maroon;
extern color MA_Year_Color=BlueViolet;
extern color MA_4Month_Color=SandyBrown;
extern color MA_Month_Color=Aqua;
extern color MA_Week_Color=Magenta;
extern color MA_Day_Color=Lime;
extern color MA_8H_Color=Yellow;
extern color MA_4H_Color=MediumBlue;
extern string Note_1       ="MA_Mode=0=SMA;1=EMA;2=SMMA;3=LWMA";
extern int   MA_Mode       =0;
extern string Note_2       ="Applied_Price=0=Close;1=Open;2=High";
extern string Note_3       ="3=Low;4=(H+L)/2;5=(H+L+C)/3;6=(H+L+C+C)/4";
extern int   Applied_Price =6;

//---- buffers
double MA4Year[];
double MAYear[];
double MA4Month[];
double MAMonth[];
double MAWeek[];
double MA24H[];
double MA8H[];
double MA4H[];
double CloseKGMACD;
double BBMiddleKGMACD;


int    Per4Year;
int    PerYear;
int    Per4Month;
int    PerMonth;
int    PerWeek;
int    Per24H;
int    Per8H;
int    Per4H;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

//---- indicators
   SetIndexStyle(0,DRAW_LINE,0,2,MA_4Year_Color);
   SetIndexBuffer(0,MA4Year);
   SetIndexLabel(0,"MA 4Year");
   SetIndexStyle(1,DRAW_LINE,0,2,MA_Year_Color);
   SetIndexBuffer(1,MAYear);
   SetIndexLabel(1,"MA Year");
   SetIndexStyle(2,DRAW_LINE,0,2,MA_4Month_Color);
   SetIndexBuffer(2,MA4Month);
   SetIndexLabel(2,"MA 4MN");
   SetIndexStyle(3,DRAW_LINE,0,2,MA_Month_Color);
   SetIndexBuffer(3,MAMonth);
   SetIndexLabel(3,"MA Month");
   SetIndexStyle(4,DRAW_LINE,0,2,MA_Week_Color);
   SetIndexBuffer(4,MAWeek);
   SetIndexLabel(4,"MA Week");
   SetIndexStyle(5,DRAW_LINE,0,2,MA_Day_Color);
   SetIndexBuffer(5,MA24H);
   SetIndexLabel(5,"MA Day");
   SetIndexStyle(6,DRAW_LINE,0,2,MA_8H_Color);
   SetIndexBuffer(6,MA8H);
   SetIndexLabel(6,"MA 8H");
   SetIndexStyle(7,DRAW_LINE,0,2,MA_4H_Color);
   SetIndexBuffer(7,MA4H);
   SetIndexLabel(7,"MA 4H");  

   string label1 = "KG MA 4Year";
   ObjectDelete(label1);
   ObjectCreate( label1, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label1,"4Yearly",8, "Arial Bold", MA_4Year_Color);
   ObjectSet( label1, OBJPROP_CORNER, Corner );
   ObjectSet( label1, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label1, OBJPROP_YDISTANCE, 10 );

   string label2 = "KG MA Year";
   ObjectDelete(label2);
   ObjectCreate( label2, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label2,"Yearly",8, "Arial Bold", MA_Year_Color);
   ObjectSet( label2, OBJPROP_CORNER, Corner );
   ObjectSet( label2, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label2, OBJPROP_YDISTANCE, 20 );
   
   string label3 = "KG MA 4Month";
   ObjectDelete(label3);
   ObjectCreate( label3, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label3,"4Monthly",8, "Arial Bold", MA_4Month_Color);
   ObjectSet( label3, OBJPROP_CORNER, Corner );
   ObjectSet( label3, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label3, OBJPROP_YDISTANCE, 30 );
   
   string label4 = "KG MA Month";
   ObjectDelete(label4);
   ObjectCreate( label4, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label4,"Monthly",8, "Arial Bold", MA_Month_Color);
   ObjectSet( label4, OBJPROP_CORNER, Corner );
   ObjectSet( label4, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label4, OBJPROP_YDISTANCE, 40 );
   
   string label5 = "KG MA Week";
   ObjectDelete(label5);
   ObjectCreate( label5, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label5,"Weekly",8, "Arial Bold", MA_Week_Color);
   ObjectSet( label5, OBJPROP_CORNER, Corner );
   ObjectSet( label5, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label5, OBJPROP_YDISTANCE, 50 );
   
   string label6 = "KG MA Daily";
   ObjectDelete(label6);
   ObjectCreate( label6, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label6,"Daily",8, "Arial Bold", MA_Day_Color);
   ObjectSet( label6, OBJPROP_CORNER, Corner );
   ObjectSet( label6, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label6, OBJPROP_YDISTANCE, 60 );
   
   string label7 = "KG MA 8H";
   ObjectDelete(label7);
   ObjectCreate( label7, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label7,"8H",8, "Arial Bold", MA_8H_Color);
   ObjectSet( label7, OBJPROP_CORNER, Corner );
   ObjectSet( label7, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label7, OBJPROP_YDISTANCE, 70 );
   
   string label8 = "KG MA 4H";
   ObjectDelete(label8);
   ObjectCreate( label8, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label8,"4H",8, "Arial Bold", MA_4H_Color);
   ObjectSet( label8, OBJPROP_CORNER, Corner );
   ObjectSet( label8, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label8, OBJPROP_YDISTANCE, 80 );
      
   string label9 = "KG MA Trend";
   ObjectDelete(label9);
   ObjectCreate( label9, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label9,"Trend",8, "Arial Bold", MA_Day_Color);
   ObjectSet( label9, OBJPROP_CORNER, Corner );
   ObjectSet( label9, OBJPROP_XDISTANCE, 36 );
   ObjectSet( label9, OBJPROP_YDISTANCE, 100 );
   
   string label10 = "KG MA Bollinger Bands";
   ObjectDelete(label10);
   ObjectCreate( label10, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label10,"BB",8, "Arial Bold", MA_Day_Color);
   ObjectSet( label10, OBJPROP_CORNER, Corner );
   ObjectSet( label10, OBJPROP_XDISTANCE, 73 );
   ObjectSet( label10, OBJPROP_YDISTANCE, 100 );
      
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   for(int i = ObjectsTotal() - 1; i >= 0; i--)
     {
       string label = ObjectName(i);
       if(StringFind(label, "KG MA", 0) < 0)       
           continue;
       ObjectDelete(label);
     }   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   int ActivePer=Period();
   Per4Year=1382400/ActivePer;
   PerYear=345600/ActivePer;
   Per4Month=115200/ActivePer;
   PerMonth=28800/ActivePer;
   PerWeek=7200/ActivePer;
   Per24H=1440/ActivePer;
   Per8H=480/ActivePer;
   Per4H=240/ActivePer;
   
   int limit=Bars-counted_bars;
   if(counted_bars>0) limit++;
   for(int i=0; i<limit; i++)
   { 
      MA4Year[i]=iMA(NULL,0,Per4Year,0,MA_Mode,Applied_Price,i);
      MAYear[i]=iMA(NULL,0,PerYear,0,MA_Mode,Applied_Price,i);
      MA4Month[i]=iMA(NULL,0,Per4Month,0,MA_Mode,Applied_Price,i);
      MAMonth[i]=iMA(NULL,0,PerMonth,0,MA_Mode,Applied_Price,i);
      MAWeek[i]=iMA(NULL,0,PerWeek,0,MA_Mode,Applied_Price,i);
      MA24H[i]=iMA(NULL,0,Per24H,0,MA_Mode,Applied_Price,i);
      MA8H[i]=iMA(NULL,0,Per8H,0,MA_Mode,Applied_Price,i);
      MA4H[i]=iMA(NULL,0,Per4H,0,MA_Mode,Applied_Price,i);      
   }
   
   string Sign;   
   color Col;

   //------------------------------------------------------
   // Perhitungan untuk TREND
   //------------------------------------------------------
   if(Period()<PERIOD_MN1){
   if(Bars<PerYear)PerYear=PerMonth; //Jika jumlah bar kurang dari syarat, maka jumlah bar=monthly
   double MAOpen=iMA(NULL,PERIOD_MN1,48,0,MA_Mode,Applied_Price,1);
   double MAClose=iMA(NULL,PERIOD_MN1,48,0,MA_Mode,Applied_Price,0);
   if (MAClose==MAOpen) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (MAClose > MAOpen) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign1 = "KG MA 4Yearly Wave";
   ObjectDelete(sign1);
   ObjectCreate(sign1, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign1, Sign ,10, "Wingdings", Col);
   ObjectSet(sign1, OBJPROP_CORNER, Corner );
   ObjectSet(sign1, OBJPROP_XDISTANCE, 53 );
   ObjectSet(sign1, OBJPROP_YDISTANCE, 10 );
   }   
   if(Period()<PERIOD_MN1){
   if(Bars<PerYear)PerYear=PerMonth; //Jika jumlah bar kurang dari syarat, maka jumlah bar=monthly
   MAOpen=iMA(NULL,PERIOD_MN1,12,0,MA_Mode,Applied_Price,1);
   MAClose=iMA(NULL,PERIOD_MN1,12,0,MA_Mode,Applied_Price,0);
   if (MAClose==MAOpen) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (MAClose > MAOpen) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign2 = "KG MA Yearly Wave";
   ObjectDelete(sign2);
   ObjectCreate(sign2, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign2, Sign ,10, "Wingdings", Col);
   ObjectSet(sign2, OBJPROP_CORNER, Corner );
   ObjectSet(sign2, OBJPROP_XDISTANCE, 53 );
   ObjectSet(sign2, OBJPROP_YDISTANCE, 20 );
   }   
   if(Period()<PERIOD_MN1){
   if(Bars<Per4Month)Per4Month=PerMonth; //Jika jumlah bar kurang dari syarat, maka jumlah bar=monthly
   MAOpen=iMA(NULL,PERIOD_MN1,4,0,MA_Mode,Applied_Price,1);
   MAClose=iMA(NULL,PERIOD_MN1,4,0,MA_Mode,Applied_Price,0);
   if (MAClose==MAOpen) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (MAClose > MAOpen) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign3 = "KG MA 4Monthly Wave";
   ObjectDelete(sign3);
   ObjectCreate(sign3, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign3, Sign ,10, "Wingdings", Col);
   ObjectSet(sign3, OBJPROP_CORNER, Corner );
   ObjectSet(sign3, OBJPROP_XDISTANCE, 53 );
   ObjectSet(sign3, OBJPROP_YDISTANCE, 30 );
   }   
   if(Period()<PERIOD_MN1){
   MAOpen=iMA(NULL,PERIOD_W1,4,0,MA_Mode,Applied_Price,1);
   MAClose=iMA(NULL,PERIOD_W1,4,0,MA_Mode,Applied_Price,0);
   if (MAClose==MAOpen) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (MAClose > MAOpen) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign4 = "KG MA Monthly Wave";
   ObjectDelete(sign4);
   ObjectCreate(sign4, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign4, Sign ,10, "Wingdings", Col);
   ObjectSet(sign4, OBJPROP_CORNER, Corner );
   ObjectSet(sign4, OBJPROP_XDISTANCE, 53 );
   ObjectSet(sign4, OBJPROP_YDISTANCE, 40 );
   }   
   if(Period()<PERIOD_W1){
   MAOpen=iMA(NULL,PERIOD_D1,5,0,MA_Mode,Applied_Price,1);
   MAClose=iMA(NULL,PERIOD_D1,5,0,MA_Mode,Applied_Price,0);
   if (MAClose==MAOpen) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (MAClose > MAOpen) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign5 = "KG MA Weekly Wave";
   ObjectDelete(sign5);
   ObjectCreate(sign5, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign5, Sign ,10, "Wingdings", Col);
   ObjectSet(sign5, OBJPROP_CORNER, Corner );
   ObjectSet(sign5, OBJPROP_XDISTANCE, 53 );
   ObjectSet(sign5, OBJPROP_YDISTANCE, 50 );
   }   
   if(Period()<PERIOD_D1){
   MAOpen=iMA(NULL,PERIOD_H4,6,0,MA_Mode,Applied_Price,1);
   MAClose=iMA(NULL,PERIOD_H4,6,0,MA_Mode,Applied_Price,0);
   if (MAClose==MAOpen) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (MAClose > MAOpen) { Sign="ñ"; Col=Lime; } //Trend Up
   else { Sign="ò"; Col=Red; } //Trend Down   
   string sign6 = "KG MA Daily Wave";
   ObjectDelete(sign6);
   ObjectCreate(sign6, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign6, Sign ,10, "Wingdings", Col);
   ObjectSet(sign6, OBJPROP_CORNER, Corner );
   ObjectSet(sign6, OBJPROP_XDISTANCE, 53 );
   ObjectSet(sign6, OBJPROP_YDISTANCE, 60 );
   }  
   if(Period()<PERIOD_D1){
   if(Bars<Per8H)Per8H=Per4H;
   MAOpen=iMA(NULL,PERIOD_H4,2,0,MA_Mode,Applied_Price,1);
   MAClose=iMA(NULL,PERIOD_H4,2,0,MA_Mode,Applied_Price,0);
   if (MAClose==MAOpen) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (MAClose > MAOpen) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign7 = "KG MA 8H Wave";
   ObjectDelete(sign7);
   ObjectCreate(sign7, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign7, Sign ,10, "Wingdings", Col);
   ObjectSet(sign7, OBJPROP_CORNER, Corner );
   ObjectSet(sign7, OBJPROP_XDISTANCE, 53 );
   ObjectSet(sign7, OBJPROP_YDISTANCE, 70 );
   }  
   if(Period()<PERIOD_H4){
   MAOpen=iMA(NULL,PERIOD_H1,4,0,MA_Mode,Applied_Price,1);
   MAClose=iMA(NULL,PERIOD_H1,4,0,MA_Mode,Applied_Price,0);
   if (MAClose==MAOpen) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (MAClose > MAOpen) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down   
   string sign8 = "KG MA 4H Wave";
   ObjectDelete(sign8);
   ObjectCreate(sign8, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign8, Sign ,10, "Wingdings", Col);
   ObjectSet(sign8, OBJPROP_CORNER, Corner );
   ObjectSet(sign8, OBJPROP_XDISTANCE, 53 );
   ObjectSet(sign8, OBJPROP_YDISTANCE, 80 );
   }
        
   //-------------------------------------------
   // Perhitungan kondisi Flat base on BB SD1
   //-------------------------------------------
   
   if(Period()<=PERIOD_MN1){
   double BBUpper=iBands(NULL,1440,960,1,0,Applied_Price,MODE_UPPER,0);
   double BBLower=iBands(NULL,1440,960,1,0,Applied_Price,MODE_LOWER,0);
   if (iMA(NULL,1440,1,0,MODE_SMA,Applied_Price,0)>=BBLower && iMA(NULL,1440,1,0,MODE_SMA,Applied_Price,0)<=BBUpper) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (iMA(NULL,1440,1,0,MODE_SMA,Applied_Price,0)>BBUpper && iMA(NULL,1440,1,0,MODE_SMA,Applied_Price,0)>BBLower) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign9 = "KG MA 4Yearly BB";
   ObjectDelete(sign9);
   ObjectCreate(sign9, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign9, Sign ,10, "Wingdings", Col);
   ObjectSet(sign9, OBJPROP_CORNER, Corner );
   ObjectSet(sign9, OBJPROP_XDISTANCE, 73 );
   ObjectSet(sign9, OBJPROP_YDISTANCE, 10 );
   }
   
   if(Period()<=PERIOD_MN1){
   BBUpper=iBands(NULL,240,1440,1,0,Applied_Price,MODE_UPPER,0);
   BBLower=iBands(NULL,240,1440,1,0,Applied_Price,MODE_LOWER,0);
   if (iMA(NULL,240,1,0,MODE_SMA,Applied_Price,0)>=BBLower && iMA(NULL,240,1,0,MODE_SMA,Applied_Price,0)<=BBUpper) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (iMA(NULL,240,1,0,MODE_SMA,Applied_Price,0)>BBUpper && iMA(NULL,240,1,0,MODE_SMA,Applied_Price,0)>BBLower) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign10 = "KG MA Yearly BB";
   ObjectDelete(sign10);
   ObjectCreate(sign10, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign10, Sign ,10, "Wingdings", Col);
   ObjectSet(sign10, OBJPROP_CORNER, Corner );
   ObjectSet(sign10, OBJPROP_XDISTANCE, 73 );
   ObjectSet(sign10, OBJPROP_YDISTANCE, 20 );
   }
   
   if(Period()<=PERIOD_MN1){
   BBUpper=iBands(NULL,60,1920,1,0,Applied_Price,MODE_UPPER,0);
   BBLower=iBands(NULL,60,1920,1,0,Applied_Price,MODE_LOWER,0);
   if (iMA(NULL,60,1,0,MODE_SMA,Applied_Price,0)>=BBLower && iMA(NULL,60,1,0,MODE_SMA,Applied_Price,0)<=BBUpper) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (iMA(NULL,60,1,0,MODE_SMA,Applied_Price,0)>BBUpper && iMA(NULL,60,1,0,MODE_SMA,Applied_Price,0)>BBLower) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign11 = "KG MA 4Monthly BB";
   ObjectDelete(sign11);
   ObjectCreate(sign11, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign11, Sign ,10, "Wingdings", Col);
   ObjectSet(sign11, OBJPROP_CORNER, Corner );
   ObjectSet(sign11, OBJPROP_XDISTANCE, 73 );
   ObjectSet(sign11, OBJPROP_YDISTANCE, 30 );
   }
   
   if(Period()<=PERIOD_W1){
   BBUpper=iBands(NULL,15,1920,1,0,Applied_Price,MODE_UPPER,0);
   BBLower=iBands(NULL,15,1920,1,0,Applied_Price,MODE_LOWER,0);
   if (iMA(NULL,15,1,0,MODE_SMA,Applied_Price,0)>=BBLower && iMA(NULL,15,1,0,MODE_SMA,Applied_Price,0)<=BBUpper) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (iMA(NULL,15,1,0,MODE_SMA,Applied_Price,0)>BBUpper && iMA(NULL,15,1,0,MODE_SMA,Applied_Price,0)>BBLower) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign12 = "KG MA Monthly BB";
   ObjectDelete(sign12);
   ObjectCreate(sign12, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign12, Sign ,10, "Wingdings", Col);
   ObjectSet(sign12, OBJPROP_CORNER, Corner );
   ObjectSet(sign12, OBJPROP_XDISTANCE, 73 );
   ObjectSet(sign12, OBJPROP_YDISTANCE, 40 );
   }

   if(Period()<PERIOD_W1){
   BBUpper=iBands(NULL,15,480,1,0,Applied_Price,MODE_UPPER,0);
   BBLower=iBands(NULL,15,480,1,0,Applied_Price,MODE_LOWER,0);
   if (iMA(NULL,15,1,0,MODE_SMA,Applied_Price,0)>=BBLower && iMA(NULL,15,1,0,MODE_SMA,Applied_Price,0)<=BBUpper) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (iMA(NULL,15,1,0,MODE_SMA,Applied_Price,0)>BBUpper && iMA(NULL,15,1,0,MODE_SMA,Applied_Price,0)>BBLower ) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign13 = "KG MA Weekly BB";
   ObjectDelete(sign13);
   ObjectCreate(sign13, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign13, Sign ,10, "Wingdings", Col);
   ObjectSet(sign13, OBJPROP_CORNER, Corner );
   ObjectSet(sign13, OBJPROP_XDISTANCE, 73 );
   ObjectSet(sign13, OBJPROP_YDISTANCE, 50 );
   }
   
   if(Period()<PERIOD_D1){
   BBUpper=iBands(NULL,15,96,1,0,Applied_Price,MODE_UPPER,0);
   BBLower=iBands(NULL,15,96,1,0,Applied_Price,MODE_LOWER,0);
   if (iMA(NULL,15,1,0,MODE_SMA,Applied_Price,0)>=BBLower && iMA(NULL,15,1,0,MODE_SMA,Applied_Price,0)<=BBUpper) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (iMA(NULL,15,1,0,MODE_SMA,Applied_Price,0)>BBUpper && iMA(NULL,15,1,0,MODE_SMA,Applied_Price,0)>BBLower ) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign14 = "KG MA Daily BB";
   ObjectDelete(sign14);
   ObjectCreate(sign14, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign14, Sign ,10, "Wingdings", Col);
   ObjectSet(sign14, OBJPROP_CORNER, Corner );
   ObjectSet(sign14, OBJPROP_XDISTANCE, 73 );
   ObjectSet(sign14, OBJPROP_YDISTANCE, 60 );
   }
   
   if(Period()<PERIOD_D1){
   BBUpper=iBands(NULL,5,96,1,0,Applied_Price,MODE_UPPER,0);
   BBLower=iBands(NULL,5,96,1,0,Applied_Price,MODE_LOWER,0);
   if (iMA(NULL,5,1,0,MODE_SMA,Applied_Price,0)>=BBLower && iMA(NULL,5,1,0,MODE_SMA,Applied_Price,0)<=BBUpper) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (iMA(NULL,5,1,0,MODE_SMA,Applied_Price,0)>BBUpper && iMA(NULL,5,1,0,MODE_SMA,Applied_Price,0)>BBLower ) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign15 = "KG MA 8H BB";
   ObjectDelete(sign15);
   ObjectCreate(sign15, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign15, Sign ,10, "Wingdings", Col);
   ObjectSet(sign15, OBJPROP_CORNER, Corner );
   ObjectSet(sign15, OBJPROP_XDISTANCE, 73 );
   ObjectSet(sign15, OBJPROP_YDISTANCE, 70 );
   }
   
   if(Period()<PERIOD_H4){
   BBUpper=iBands(NULL,5,48,1,0,Applied_Price,MODE_UPPER,0);
   BBLower=iBands(NULL,5,48,1,0,Applied_Price,MODE_LOWER,0);
   if (iMA(NULL,5,1,0,MODE_SMA,Applied_Price,0)>=BBLower && iMA(NULL,5,1,0,MODE_SMA,Applied_Price,0)<=BBUpper) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (iMA(NULL,5,1,0,MODE_SMA,Applied_Price,0)>BBUpper && iMA(NULL,5,1,0,MODE_SMA,Applied_Price,0)>BBLower ) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign16 = "KG MA 4H BB";
   ObjectDelete(sign16);
   ObjectCreate(sign16, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign16, Sign ,10, "Wingdings", Col);
   ObjectSet(sign16, OBJPROP_CORNER, Corner );
   ObjectSet(sign16, OBJPROP_XDISTANCE, 73 );
   ObjectSet(sign16, OBJPROP_YDISTANCE, 80 );
   }
      
   return(0);
  }
//+------------------------------------------------------------------+


