//+------------------------------------------------------------------+
//|                                                KG SEAWAVE MA.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "http://www.forexindo.com/forum/showthread.php?t=95&page=9"

#property indicator_chart_window
#property indicator_buffers 8

extern int Corner=1;
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 color MA_1H_Color   =Red;
extern color MA_30M_Color  =DarkViolet;
extern color MA_15M_Color  =White;
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 MAMonth[];
double MAWeek[];
double MA24H[];
double MA8H[];
double MA4H[];
double MA1H[];
double MA30M[];
double MA15M[];
double CloseKGMACD;
double BBMiddleKGMACD;

int    PerMonth;
int    PerWeek;
int    Per24H;
int    Per8H;
int    Per4H;
int    Per1H;
int    Per30M;
int    Per15M;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

//---- indicators
   SetIndexStyle(0,DRAW_LINE,0,1,MA_Month_Color);
   SetIndexBuffer(0,MAMonth);
   SetIndexLabel(0,"MA Month");
   SetIndexStyle(1,DRAW_LINE,0,1,MA_Week_Color);
   SetIndexBuffer(1,MAWeek);
   SetIndexLabel(1,"MA Week");
   SetIndexStyle(2,DRAW_LINE,0,1,MA_Day_Color);
   SetIndexBuffer(2,MA24H);
   SetIndexLabel(2,"MA Day");
   SetIndexStyle(3,DRAW_LINE,0,1,MA_8H_Color);
   SetIndexBuffer(3,MA8H);
   SetIndexLabel(3,"MA 8H");   
   SetIndexStyle(4,DRAW_LINE,0,1,MA_4H_Color);
   SetIndexBuffer(4,MA4H);
   SetIndexLabel(4,"MA 4H");
   SetIndexStyle(5,DRAW_LINE,0,1,MA_1H_Color);
   SetIndexBuffer(5,MA1H);
   SetIndexLabel(5,"MA 1H");
   SetIndexStyle(6,DRAW_LINE,0,1,MA_30M_Color);
   SetIndexBuffer(6,MA30M);
   SetIndexLabel(6,"MA 30M");
   SetIndexStyle(7,DRAW_LINE,0,1,MA_15M_Color);
   SetIndexBuffer(7,MA15M);
   SetIndexLabel(7,"MA 15M");

   string label1 = "KG MA Month";
   ObjectDelete(label1);
   ObjectCreate( label1, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label1,"Monthly",8, "Arial Bold", MA_Month_Color);
   ObjectSet( label1, OBJPROP_CORNER, Corner );
   ObjectSet( label1, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label1, OBJPROP_YDISTANCE, 10 );
   
   string label2 = "KG MA Week";
   ObjectDelete(label2);
   ObjectCreate( label2, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label2,"Weekly",8, "Arial Bold", MA_Week_Color);
   ObjectSet( label2, OBJPROP_CORNER, Corner );
   ObjectSet( label2, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label2, OBJPROP_YDISTANCE, 20 );
   
   string label3 = "KG MA Day";
   ObjectDelete(label3);
   ObjectCreate( label3, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label3,"Daily",8, "Arial Bold", MA_Day_Color);
   ObjectSet( label3, OBJPROP_CORNER, Corner );
   ObjectSet( label3, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label3, OBJPROP_YDISTANCE, 30 );
   
   string label4 = "KG MA 8H";
   ObjectDelete(label4);
   ObjectCreate( label4, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label4,"8H",8, "Arial Bold", MA_8H_Color);
   ObjectSet( label4, OBJPROP_CORNER, Corner );
   ObjectSet( label4, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label4, OBJPROP_YDISTANCE, 40 );
   
   string label5 = "KG MA 4H";
   ObjectDelete(label5);
   ObjectCreate( label5, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label5,"4H",8, "Arial Bold", MA_4H_Color);
   ObjectSet( label5, OBJPROP_CORNER, Corner );
   ObjectSet( label5, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label5, OBJPROP_YDISTANCE, 50 );
   
   string label6 = "KG MA 1H";
   ObjectDelete(label6);
   ObjectCreate( label6, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label6,"1H",8, "Arial Bold", MA_1H_Color);
   ObjectSet( label6, OBJPROP_CORNER, Corner );
   ObjectSet( label6, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label6, OBJPROP_YDISTANCE, 60 );
   
   string label7 = "KG MA 30M";
   ObjectDelete(label7);
   ObjectCreate( label7, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label7,"30M",8, "Arial Bold", MA_30M_Color);
   ObjectSet( label7, OBJPROP_CORNER, Corner );
   ObjectSet( label7, OBJPROP_XDISTANCE, 3 );
   ObjectSet( label7, OBJPROP_YDISTANCE, 70 );
   
   string label8 = "KG MA 15M";
   ObjectDelete(label8);
   ObjectCreate( label8, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(label8,"15M",8, "Arial Bold", MA_15M_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_4H_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_4H_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();
   PerMonth=28800/ActivePer;
   PerWeek=7200/ActivePer;
   Per24H=1440/ActivePer;
   Per8H=480/ActivePer;
   Per4H=240/ActivePer;
   Per1H=60/ActivePer;
   Per30M=30/ActivePer;
   Per15M=15/ActivePer;
 

   int limit=Bars-counted_bars;
   if(counted_bars>0) limit++;
   for(int i=0; i<limit; 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);
      MA1H[i]=iMA(NULL,0,Per1H,0,MA_Mode,Applied_Price,i);
      MA30M[i]=iMA(NULL,0,Per30M,0,MA_Mode,Applied_Price,i);
      MA15M[i]=iMA(NULL,0,Per15M,0,MA_Mode,Applied_Price,i);
   }
   
   string Sign;   
   color Col;
   //----------------------------------
   // Perhitungan untuk TREND
   //----------------------------------
   if(Period()<PERIOD_MN1){
   double MAOpen=iMA(NULL,PERIOD_W1,4,0,MA_Mode,Applied_Price,1);
   double 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 sign1 = "KG MA Monthly 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_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 sign2 = "KG MA Weekly 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_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 sign3 = "KG MA Daily 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_D1){
   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 sign5 = "KG MA 8H 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, 40 );
   }
   
   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 sign5a = "KG MA 4H Wave";
   ObjectDelete(sign5a);
   ObjectCreate(sign5a, OBJ_LABEL, 0, 0, 0 );
   ObjectSetText(sign5a, Sign ,10, "Wingdings", Col);
   ObjectSet(sign5a, OBJPROP_CORNER, Corner );
   ObjectSet(sign5a, OBJPROP_XDISTANCE, 53 );
   ObjectSet(sign5a, OBJPROP_YDISTANCE, 50 );
   }
   
   if(Period()<PERIOD_H1){
   MAOpen=iMA(NULL,PERIOD_M30,2,0,MA_Mode,Applied_Price,1);
   MAClose=iMA(NULL,PERIOD_M30,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 sign6 = "KG MA 1H 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_M30){
   MAOpen=iMA(NULL,PERIOD_M15,2,0,MA_Mode,Applied_Price,1);
   MAClose=iMA(NULL,PERIOD_M15,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 30M 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_M15){
   MAOpen=iMA(NULL,PERIOD_M5,3,0,MA_Mode,Applied_Price,1);
   MAClose=iMA(NULL,PERIOD_M5,3,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 15M 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,15,1920,1,0,Applied_Price,MODE_UPPER,0);
   double 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 sign9 = "KG MA Monthly 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_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 sign10 = "KG MA Weekly 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_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 sign11 = "KG MA Daily 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_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 sign12 = "KG MA 8H 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_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 sign13 = "KG MA 4H 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_H1){
   BBUpper=iBands(NULL,5,12,1,0,Applied_Price,MODE_UPPER,0);
   BBLower=iBands(NULL,5,12,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 sign14 = "KG MA 1H 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_M30){
   BBUpper=iBands(NULL,1,30,1,0,Applied_Price,MODE_UPPER,0);
   BBLower=iBands(NULL,1,30,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 30M 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 );   return(0);
  }
   
   if(Period()<PERIOD_M15){
   BBUpper=iBands(NULL,1,15,1,0,Applied_Price,MODE_UPPER,0);
   BBLower=iBands(NULL,1,15,1,0,Applied_Price,MODE_LOWER,0);
   if (iMA(NULL,1,1,0,MODE_SMA,Applied_Price,0)>=BBLower && iMA(NULL,1,1,0,MODE_SMA,Applied_Price,0)<=BBUpper) { Sign="ó"; Col=DarkOrange; } //Sideway
   else 
      if (iMA(NULL,1,1,0,MODE_SMA,Applied_Price,0)>BBUpper && iMA(NULL,1,1,0,MODE_SMA,Applied_Price,0)>BBLower ) { Sign="ñ"; Col=Lime; } //Trend Up
      else { Sign="ò"; Col=Red; } //Trend Down
   string sign16 = "KG MA 15M 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);
  }
  */
//-------------------------------------------------------------------+
 }
//+------------------------------------------------------------------+

