//+------------------------------------------------------------------+
//|                                                      +JoGET+.mq4 |
//|                                        Copyright © 2008, masemus |
//|                                                 Gresik@Indonesia |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, masemus"
#property link      "Gresik@Indonesia"

#property indicator_chart_window
extern color Pair_color = Silver;
extern color CandleTime_color = Aqua;
extern color Label_color = SlateGray;
extern color clockColor = RosyBrown;

//****************************************
extern int MA1Period = 4;
extern int MA1_Shift = 0;
extern int MA1_Method = 0;
extern int MA1_Price_Type = 0;
extern int MA2Period = 4;
extern int MA2_Shift = 0;
extern int MA2_Method = 0;
extern int MA2_Price_Type = 1;

extern int MA3Period = 20;
extern int MA3_Shift = 0;
extern int MA3_Method = 0;
extern int MA3_Price_Type = 0;
extern int MA4Period = 20;
extern int MA4_Shift = 0;
extern int MA4_Method = 0;
extern int MA4_Price_Type = 1;

extern int MA5Period = 1;
extern int MA5_Shift = 0;
extern int MA5_Method = 0;
extern int MA5_Price_Type = 0;

extern int RSI_Period = 5;
extern int RSI_PRICE_TYPE = 0;

//****************************************
int window = 0;
int corner = 1;
color Line_color = Gold;

#property indicator_buffers 1
#property indicator_color1 Red
double ExtMapBuffer1[];

#import "kernel32.dll"
void GetLocalTime(int& TimeArray[]);
void GetSystemTime(int& TimeArray[]);
int  GetTimeZoneInformation(int& TZInfoArray[]);
#import

double point;

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {    
  if ( !IsDllsAllowed() ) {
      Alert( "Clock : DLLs are disabled.  To enable tick the checkbox in the Common Tab of indicator" );
      return(0);
  }
   int    counted_bars=IndicatorCounted();
//----
      
   int    TimeArray[4];
   int    TZInfoArray[43];
   int    nYear,nMonth,nDay,nHour,nMin,nSec,nMilliSec;
    
   GetLocalTime(TimeArray);
//---- parse date and time from array
   nYear=TimeArray[0]&0x0000FFFF;
   nMonth=TimeArray[0]>>16;
   nDay=TimeArray[1]>>16;
   nHour=TimeArray[2]&0x0000FFFF;
   nMin=TimeArray[2]>>16;
   nSec=TimeArray[3]&0x0000FFFF;
   nMilliSec=TimeArray[3]>>16;
   string LocalTimeS = FormatDateTime(nYear,nMonth,nDay,nHour,nMin,nSec);
   datetime localTime = StrToTime( LocalTimeS );


   int gmt_shift=0;
   int dst=GetTimeZoneInformation(TZInfoArray);
   if(dst!=0) gmt_shift=TZInfoArray[0];
   if(dst==2) gmt_shift+=TZInfoArray[42];

   datetime brokerTime = TimeCurrent();
   datetime WIB = localTime + gmt_shift * 60;
   
   //Print( brokerTime, " ", WIB, " " );
   string WIBs = TimeToString( WIB,TIME_MINUTES  );
   string brokers = TimeToString(TimeCurrent(),TIME_MINUTES );
   string bars = TimeToStr( TimeCurrent() - Time[0], TIME_MINUTES );
   
   ObjectSetText( "wibl", "Gresik:", 7, "Arial", Label_color );
   ObjectSetText( "wibt", WIBs, 9, "Arial", clockColor );
   ObjectSetText( "brol", "Broker:", 7, "Arial", Label_color );
   ObjectSetText( "brot", brokers, 9, "Arial", clockColor );
   ObjectSetText( "barl", "Bar:", 7, "Arial", Label_color );
   ObjectSetText( "bart", bars, 9, "Arial", clockColor );
      
   //******************************************************************************************************************
   //SiGNAL BuySell for Pairs and Price

   double MA3_M1 = iMA(Symbol(),1,MA3Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA4_M1 = iMA(Symbol(),1,MA4Period,MA4_Shift,MA4_Method,MA4_Price_Type,0);
   double MA3_M5 = iMA(Symbol(),5,MA3Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA4_M5 = iMA(Symbol(),5,MA4Period,MA4_Shift,MA4_Method,MA4_Price_Type,0);
   double MA3_M15 = iMA(Symbol(),15,MA3Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA4_M15 = iMA(Symbol(),15,MA4Period,MA4_Shift,MA4_Method,MA4_Price_Type,0);
   double MA3_M30 = iMA(Symbol(),30,MA3Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA4_M30 = iMA(Symbol(),30,MA4Period,MA4_Shift,MA4_Method,MA4_Price_Type,0);
   double MA3_H1 = iMA(Symbol(),60,MA3Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA4_H1 = iMA(Symbol(),60,MA4Period,MA4_Shift,MA4_Method,MA4_Price_Type,0);
   double MA3_H4 = iMA(Symbol(),240,MA3Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA4_H4 = iMA(Symbol(),240,MA4Period,MA4_Shift,MA4_Method,MA4_Price_Type,0);
   double MA3_D1 = iMA(Symbol(),1440,MA3Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA4_D1 = iMA(Symbol(),1440,MA4Period,MA4_Shift,MA4_Method,MA4_Price_Type,0);

   double MA1_M1 = iMA(Symbol(),1,MA1Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA2_M1 = iMA(Symbol(),1,MA2Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   double MA1_M5 = iMA(Symbol(),5,MA1Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA2_M5 = iMA(Symbol(),5,MA2Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   double MA1_M15 = iMA(Symbol(),15,MA1Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA2_M15 = iMA(Symbol(),15,MA2Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   double MA1_M30 = iMA(Symbol(),30,MA1Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA2_M30 = iMA(Symbol(),30,MA2Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   double MA1_H1 = iMA(Symbol(),60,MA1Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA2_H1 = iMA(Symbol(),60,MA2Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   double MA1_H4 = iMA(Symbol(),240,MA1Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA2_H4 = iMA(Symbol(),240,MA2Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   double MA1_D1 = iMA(Symbol(),1440,MA1Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA2_D1 = iMA(Symbol(),1440,MA2Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   
   string S_m1 = "", S_m5 = "", S_m15 = "", S_m30 = "", S_h1 = "", S_h4 = "", S_d1 = "", S_w1 = "", S_mn1 = "";
   color  clr_m1, clr_m5, clr_m15, clr_m30, clr_h1, clr_h4;
   
   if (MA1_M1 < MA4_M1) { S_m1 = "-"; clr_m1 = FireBrick; }
   if (MA1_M1 > MA4_M1) { S_m1 = "-"; clr_m1 = SeaGreen; }
   if (MA1_M1 < MA2_M1) { S_m1 = "-"; clr_m1 = Red; }
   if (MA1_M1 > MA2_M1) { S_m1 = "-"; clr_m1 = Lime; }
   
   if (MA1_M5 < MA4_M5) { S_m5 = "-"; clr_m5 = FireBrick; }
   if (MA1_M5 > MA4_M5) { S_m5 = "-"; clr_m5 = SeaGreen; }
   if (MA1_M5 < MA2_M5) { S_m5 = "-"; clr_m5 = Red; }
   if (MA1_M5 > MA2_M5) { S_m5 = "-"; clr_m5 = Lime; }
   
   if (MA1_M15 <MA4_M15) { S_m15 = "-"; clr_m15 = FireBrick; }
   if (MA1_M15 >MA4_M15) { S_m15 = "-"; clr_m15 = SeaGreen; }
   if (MA1_M15 < MA2_M15) { S_m15 = "-"; clr_m15 = Red; }
   if (MA1_M15 > MA2_M15) { S_m15 = "-"; clr_m15 = Lime; }
      
   if (MA1_M30 < MA4_M30) { S_m30 = "-"; clr_m30 = FireBrick; }
   if (MA1_M30 > MA4_M30) { S_m30 = "-"; clr_m30 = SeaGreen; }
   if (MA1_M30 < MA2_M30) { S_m30 = "-"; clr_m30 = Red; }
   if (MA1_M30 > MA2_M30) { S_m30 = "-"; clr_m30 = Lime; }
   
   if (MA1_H1 < MA4_H1) { S_h1 = "-"; clr_h1 = FireBrick; }
   if (MA1_H1 > MA4_H1) { S_h1 = "-"; clr_h1 = SeaGreen; }
   if (MA1_H1 < MA2_H1) { S_h1 = "-"; clr_h1 = Red; }
   if (MA1_H1 > MA2_H1) { S_h1 = "-"; clr_h1 = Lime; }
   
   if (MA1_H4 < MA4_H4) { S_h4 = "-"; clr_h4 = FireBrick; }
   if (MA1_H4 > MA4_H4) { S_h4 = "-"; clr_h4 = SeaGreen; }  
   if (MA1_H4 < MA2_H4) { S_h4 = "-"; clr_h4 = Red; }
   if (MA1_H4 > MA2_H4) { S_h4 = "-"; clr_h4 = Lime; }  

   double MA5_M1 = iMA(Symbol(),1,MA5Period,MA5_Shift,MA5_Method,MA5_Price_Type,0);
   double MA5_M5 = iMA(Symbol(),5,MA5Period,MA5_Shift,MA5_Method,MA5_Price_Type,0);
   double MA5_M15 = iMA(Symbol(),15,MA5Period,MA5_Shift,MA5_Method,MA5_Price_Type,0);
   double MA5_M30 = iMA(Symbol(),30,MA5Period,MA5_Shift,MA5_Method,MA5_Price_Type,0);
   double MA5_H1 = iMA(Symbol(),60,MA5Period,MA5_Shift,MA5_Method,MA5_Price_Type,0);
   double MA5_H4 = iMA(Symbol(),240,MA5Period,MA5_Shift,MA5_Method,MA5_Price_Type,0);
   double MA5_D1 = iMA(Symbol(),1440,MA5Period,MA5_Shift,MA5_Method,MA5_Price_Type,0);
   
   string bs_m1 = "", bs_m5 = "", bs_m15 = "", bs_m30 = "", bs_h1 = "", bs_h4 = "", bs_d1 = "", bs_w1 = "", bs_mn1 = "";
   color  warna_m1, warna_m5, warna_m15, warna_m30, warna_h1, warna_h4;
   
   if (MA1_M1 < MA5_M1) { bs_m1 = "-"; warna_m1 = Lime; }
   if (MA1_M1 > MA5_M1) { bs_m1 = "-"; warna_m1 = Red; }
   if (MA3_M1 < MA5_M1) { bs_m1 = "-"; warna_m1 = SeaGreen; }
   if (MA3_M1 > MA5_M1) { bs_m1 = "-"; warna_m1 = FireBrick; }

   if (MA1_M5 < MA5_M5) { bs_m5 = "-"; warna_m5 = Lime; }
   if (MA1_M5 > MA5_M5) { bs_m5 = "-"; warna_m5 = Red; }
   if (MA3_M5 < MA5_M5) { bs_m5 = "-"; warna_m5 = SeaGreen; }
   if (MA3_M5 > MA5_M5) { bs_m5 = "-"; warna_m5 = FireBrick; }

   if (MA1_M15 < MA5_M15) { bs_m15 = "-"; warna_m15 = Lime; }
   if (MA1_M15 > MA5_M15) { bs_m15 = "-"; warna_m15 = Red; }
   if (MA3_M15 < MA5_M15) { bs_m15 = "-"; warna_m15 = SeaGreen; }
   if (MA3_M15 > MA5_M15) { bs_m15 = "-"; warna_m15 = FireBrick; }

   if (MA1_M30 < MA5_M30) { bs_m30 = "-"; warna_m30 = Lime; }
   if (MA1_M30 > MA5_M30) { bs_m30 = "-"; warna_m30 = Red; }
   if (MA3_M30 < MA5_M30) { bs_m30 = "-"; warna_m30 = SeaGreen; }
   if (MA3_M30 > MA5_M30) { bs_m30 = "-"; warna_m30 = FireBrick; }

   if (MA1_H1 < MA5_H1) { bs_h1 = "-"; warna_h1 = Lime; }
   if (MA1_H1 > MA5_H1) { bs_h1 = "-"; warna_h1 = Red; }
   if (MA3_H1 < MA5_H1) { bs_h1 = "-"; warna_h1 = SeaGreen; }
   if (MA3_H1 > MA5_H1) { bs_h1 = "-"; warna_h1 = FireBrick; }

   if (MA1_H4 < MA5_H4) { bs_h4 = "-"; warna_h4 = Lime; }
   if (MA1_H4 > MA5_H4) { bs_h4 = "-"; warna_h4 = Red; }  
   if (MA3_H4 < MA5_H4) { bs_h4 = "-"; warna_h4 = SeaGreen; }
   if (MA3_H4 > MA5_H4) { bs_h4 = "-"; warna_h4 = FireBrick; }  

   double rsi_d1 = iRSI(NULL, PERIOD_D1, RSI_Period , RSI_PRICE_TYPE, 0);
   double rsi_h4 = iRSI(NULL, PERIOD_H4, RSI_Period , RSI_PRICE_TYPE, 0);
   double rsi_h1 = iRSI(NULL, PERIOD_H1, RSI_Period , RSI_PRICE_TYPE, 0);
   double rsi_m30 = iRSI(NULL, PERIOD_M30, RSI_Period , RSI_PRICE_TYPE, 0);
   double rsi_m15 = iRSI(NULL, PERIOD_M15, RSI_Period , RSI_PRICE_TYPE, 0);
   double rsi_m5 = iRSI(NULL, PERIOD_M5, RSI_Period , RSI_PRICE_TYPE, 0);
   double rsi_m1 = iRSI(NULL, PERIOD_M1, RSI_Period , RSI_PRICE_TYPE, 0);
   
   //*****************************************************************************************************
   //Info
   string Teks="", Teks_Menit, Teks_Detik;
   double d_A, d_B;

   //Time for Next Candle
   d_B = (Time[4]-Time[5])-MathMod(TimeCurrent(),Time[4]-Time[5]);
   d_A = d_B/60;
   d_B = (d_A-MathFloor(d_A))*60;
   d_A = MathFloor(d_A);
   Teks_Menit = DoubleToStr(d_A,0);
   Teks_Detik = DoubleToStr(d_B,0);
   Teks=Teks_Menit+":"+Teks_Detik;

   //Price
   double Price1 = iMA(Symbol(),0,1,0,MODE_EMA,PRICE_CLOSE,0);   
    Teks=DoubleToStr(Price1,Digits);

   int R1=0,R5=0,R10=0,R20=0,RAvg=0,i=0;
   R1 =  (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/point;
   for(i=1;i<=5;i++)
      R5    =    R5  +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/point;
   for(i=1;i<=10;i++)
      R10   =    R10 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/point;
   for(i=1;i<=20;i++)
      R20   =    R20 +  (iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i))/point;

   R5 = R5/5;
   R10 = R10/10;
   R20 = R20/20;
   RAvg  =  (R1+R5+R10+R20)/4;    
   
   string HI="",LO="",SPREAD="",PIPS="",DAV="",HILO="",Pips="",Av="",AV_Yest="";
   string OPEN="";
   color color_pip,color_av;
   double Open_Today = iOpen(NULL,1440,0);
   double CLOSE = iClose(NULL,1440,0);
   double SPRD = (Ask - Bid)/point;
   double High_Today = iHigh(NULL,1440,0);
   double Low_Today = iLow(NULL,1440,0);
   PIPS =  DoubleToStr((CLOSE-Open_Today)/point,0);
   SPREAD = (DoubleToStr(SPRD,Digits-4));
   DAV = (DoubleToStr(RAvg,Digits-4));
   AV_Yest =  (iHigh(NULL,PERIOD_D1,1)-iLow(NULL,PERIOD_D1,1))/point;
   HILO = DoubleToStr((High_Today-Low_Today)/point,0);
   OPEN =  (DoubleToStr(Open_Today,Digits));
   HI =  (DoubleToStr(High_Today,Digits));
   LO =  (DoubleToStr(Low_Today,Digits));
  
     if (CLOSE >= Open_Today) {Pips= "-";color_pip = LimeGreen; }
     if (CLOSE < Open_Today) {Pips= "-";color_pip = DarkOrange; }
     if (DAV > AV_Yest) {Av= "-";color_av = LimeGreen; }
     if (DAV < AV_Yest) {Av= "-";color_av = DarkOrange; }

  //*****************************************************************************************************
   //D1_TREND
   string D1Mid="",D1Pivot="",D1OPEN="";
   color color_d1op,color_d1mid,color_MTD1,clr_TdD1,color_BuyTPD1,color_SellTPD1;
   double Open_D1 = iOpen(NULL,1440,0);
   D1OPEN =  (DoubleToStr(Open_D1,Digits));
   double D1r = iHigh(NULL,PERIOD_D1,1) - iLow(NULL,PERIOD_D1,1);
   double D1R = (iHigh(NULL,PERIOD_D1,1) + iLow(NULL,PERIOD_D1,1))/2;
   double D1P = (iHigh(NULL,PERIOD_D1,1) + iLow(NULL,PERIOD_D1,1) + iClose(NULL,PERIOD_D1,1))/3;
   D1Mid = DoubleToStr(D1R,Digits);
   D1Pivot = DoubleToStr(D1P,Digits);

   //D1_TREND
   string  D1TProfit1="",D1TProfit2="",D1TargetBUY1="",D1TargetBUY2="",D1TargetBUY3="",
           D1_Trend="",D1_Today="",D1TargetSELL1="",D1TargetSELL2="",D1TargetSELL3="";
   double D1TB1 = D1P + (D1r * 0.382);
   D1TargetBUY1 = DoubleToStr(D1TB1,Digits);
   double D1TS1 = D1P - (D1r * 0.382);
   D1TargetSELL1 = DoubleToStr(D1TS1,Digits);
   double D1TB2 = D1P + (D1r * 0.618);
   D1TargetBUY2 = DoubleToStr(D1TB2,Digits);
   double D1TS2 = D1P - (D1r * 0.618);
   D1TargetSELL2 = DoubleToStr(D1TS2,Digits);
   double D1TB3 = D1P + (D1r * 1.236);
   D1TargetBUY3 = DoubleToStr(D1TB3,Digits);
   double D1TS3 = D1P - (D1r * 1.236);
   D1TargetSELL3 = DoubleToStr(D1TS3,Digits);

     if (D1OPEN > D1Pivot) {color_d1op=Lime;}
     if (D1OPEN < D1Pivot) {color_d1op=Red;}
     if (D1OPEN == D1Pivot) {color_d1op=Gray;}
     if (D1Mid > D1Pivot) {color_d1mid=Lime; D1TProfit2=D1TargetBUY1;}
     if (D1Mid < D1Pivot) {color_d1mid=Red; D1TProfit2=D1TargetSELL1;}
     if (D1Mid == D1Pivot) {color_d1mid=Gray; D1TProfit2="---------";}

   //MarketD1
     if (Teks > D1OPEN) D1_Trend = "p";
     if (Teks > D1OPEN) D1TProfit1 = D1TargetBUY1;
     if (Teks < D1Pivot) D1_Trend = "q";
     if (Teks < D1Pivot) D1TProfit1 = D1TargetSELL1;
     if ((Teks <= D1OPEN) && (Teks >= D1Pivot)) D1_Trend = "n";
     if ((Teks <= D1OPEN) && (Teks >= D1Pivot)) D1TProfit1 = "---------";
     if ((Teks <= D1OPEN) && (Teks >= D1Pivot)) {color_MTD1 = Gray; color_BuyTPD1 = Gray; color_SellTPD1 = Gray;}
     if (Teks > D1OPEN) {color_MTD1 = Lime; color_BuyTPD1 = Lime; color_SellTPD1 = Gray;}
     if (Teks < D1Pivot) {color_MTD1 = Red; color_BuyTPD1 = Gray; color_SellTPD1 = Red;}

     if ((Teks > D1OPEN) && (MA1_D1 > MA2_D1) && (MA1_D1 < MA5_D1)) {D1_Today = "p"; clr_TdD1 = Lime;}
     if ((Teks < D1OPEN) && (MA1_D1 < MA2_D1) && (MA1_D1 > MA5_D1)) {D1_Today = "q"; clr_TdD1 = Red;}

           ObjectCreate("OPD1", OBJ_LABEL, window, 0, 0);
   ObjectSet("OPD1", OBJPROP_CORNER, corner);
   ObjectSetText("OPD1", "OPEN", 7, "Arial Bold", Label_color);
   ObjectSet("OPD1", OBJPROP_XDISTANCE, 55);
   ObjectSet("OPD1", OBJPROP_YDISTANCE, 228); 
           ObjectCreate("OPD1a", OBJ_LABEL, window, 0, 0);
   ObjectSet("OPD1a", OBJPROP_CORNER, corner);
   ObjectSetText("OPD1a", D1OPEN, 9, "Arial", color_d1op);
   ObjectSet("OPD1a", OBJPROP_XDISTANCE, 55);
   ObjectSet("OPD1a", OBJPROP_YDISTANCE, 215); 

           ObjectCreate("BuyTP1D1", OBJ_LABEL, window, 0, 0);
   ObjectSet("BuyTP1D1", OBJPROP_CORNER, corner);
   ObjectSetText("BuyTP1D1", "BuyTP1", 7, "Arial Bold", Label_color);
   ObjectSet("BuyTP1D1", OBJPROP_XDISTANCE, 55);
   ObjectSet("BuyTP1D1", OBJPROP_YDISTANCE, 303); 
           ObjectCreate("BuyTP1D1a", OBJ_LABEL, window, 0, 0);
   ObjectSet("BuyTP1D1a", OBJPROP_CORNER, corner);
   ObjectSetText("BuyTP1D1a", D1TargetBUY1, 9, "Arial", color_BuyTPD1);
   ObjectSet("BuyTP1D1a", OBJPROP_XDISTANCE, 55);
   ObjectSet("BuyTP1D1a", OBJPROP_YDISTANCE, 290); 

           ObjectCreate("SellTP1D1", OBJ_LABEL, window, 0, 0);
   ObjectSet("SellTP1D1", OBJPROP_CORNER, corner);
   ObjectSetText("SellTP1D1", "SellTP1", 7, "Arial Bold", Label_color);
   ObjectSet("SellTP1D1", OBJPROP_XDISTANCE, 5);
   ObjectSet("SellTP1D1", OBJPROP_YDISTANCE, 303); 
           ObjectCreate("SellTP1D1a", OBJ_LABEL, window, 0, 0);
   ObjectSet("SellTP1D1a", OBJPROP_CORNER, corner);
   ObjectSetText("SellTP1D1a", D1TargetSELL1, 9, "Arial", color_SellTPD1);
   ObjectSet("SellTP1D1a", OBJPROP_XDISTANCE, 5);
   ObjectSet("SellTP1D1a", OBJPROP_YDISTANCE, 290); 

           ObjectCreate("MToday", OBJ_LABEL, window, 0, 0);
   ObjectSet("MToday", OBJPROP_CORNER, corner);
   ObjectSetText("MToday", "MToday", 12, "Arial Narrow", Pair_color);
   ObjectSet("MToday", OBJPROP_XDISTANCE, 27);
   ObjectSet("MToday", OBJPROP_YDISTANCE, 315); 
           ObjectCreate("MToday1", OBJ_LABEL, window, 0, 0);
   ObjectSet("MToday1", OBJPROP_CORNER, corner);
   ObjectSetText("MToday1", "g", 11, "Webdings",Gray);
   ObjectSet("MToday1", OBJPROP_XDISTANCE, 7);
   ObjectSet("MToday1", OBJPROP_YDISTANCE, 317); 
           ObjectCreate("MToday2", OBJ_LABEL, window, 0, 0);
   ObjectSet("MToday2", OBJPROP_CORNER, corner);
   ObjectSetText("MToday2", D1_Trend, 9, "Wingdings 3",color_MTD1);
   ObjectSet("MToday2", OBJPROP_XDISTANCE, 8);
   ObjectSet("MToday2", OBJPROP_YDISTANCE, 320); 

           ObjectCreate("BuyTP2D1", OBJ_LABEL, window, 0, 0);
   ObjectSet("BuyTP2D1", OBJPROP_CORNER, corner);
   ObjectSetText("BuyTP2D1", "BuyTP2", 7, "Arial Bold", Label_color);
   ObjectSet("BuyTP2D1", OBJPROP_XDISTANCE, 55);
   ObjectSet("BuyTP2D1", OBJPROP_YDISTANCE, 278); 
           ObjectCreate("BuyTP2D1a", OBJ_LABEL, window, 0, 0);
   ObjectSet("BuyTP2D1a", OBJPROP_CORNER, corner);
   ObjectSetText("BuyTP2D1a", D1TargetBUY2, 9, "Arial", color_BuyTPD1);
   ObjectSet("BuyTP2D1a", OBJPROP_XDISTANCE, 55);
   ObjectSet("BuyTP2D1a", OBJPROP_YDISTANCE, 265); 

           ObjectCreate("SellTP2D1", OBJ_LABEL, window, 0, 0);
   ObjectSet("SellTP2D1", OBJPROP_CORNER, corner);
   ObjectSetText("SellTP2D1", "SellTP1", 7, "Arial Bold", Label_color);
   ObjectSet("SellTP2D1", OBJPROP_XDISTANCE, 5);
   ObjectSet("SellTP2D1", OBJPROP_YDISTANCE, 278); 
           ObjectCreate("SellTP2D1a", OBJ_LABEL, window, 0, 0);
   ObjectSet("SellTP2D1a", OBJPROP_CORNER, corner);
   ObjectSetText("SellTP2D1a", D1TargetSELL2, 9, "Arial", color_SellTPD1);
   ObjectSet("SellTP2D1a", OBJPROP_XDISTANCE, 5);
   ObjectSet("SellTP2D1a", OBJPROP_YDISTANCE, 265); 

           ObjectCreate("PVD1", OBJ_LABEL, window, 0, 0);
   ObjectSet("PVD1", OBJPROP_CORNER, corner);
   ObjectSetText("PVD1", "PIVOT", 7, "Arial Bold", Label_color);
   ObjectSet("PVD1", OBJPROP_XDISTANCE, 5);
   ObjectSet("PVD1", OBJPROP_YDISTANCE, 228); 
           ObjectCreate("PVD1a", OBJ_LABEL, window, 0, 0);
   ObjectSet("PVD1a", OBJPROP_CORNER, corner);
   ObjectSetText("PVD1a", D1Pivot, 9, "Arial", White);
   ObjectSet("PVD1a", OBJPROP_XDISTANCE, 5);
   ObjectSet("PVD1a", OBJPROP_YDISTANCE, 215); 

           ObjectCreate("BuyTP3D1", OBJ_LABEL, window, 0, 0);
   ObjectSet("BuyTP3D1", OBJPROP_CORNER, corner);
   ObjectSetText("BuyTP3D1", "BuyTP3", 7, "Arial Bold", Label_color);
   ObjectSet("BuyTP3D1", OBJPROP_XDISTANCE, 55);
   ObjectSet("BuyTP3D1", OBJPROP_YDISTANCE, 253); 
           ObjectCreate("BuyTP3D1a", OBJ_LABEL, window, 0, 0);
   ObjectSet("BuyTP3D1a", OBJPROP_CORNER, corner);
   ObjectSetText("BuyTP3D1a", D1TargetBUY3, 9, "Arial", color_BuyTPD1);
   ObjectSet("BuyTP3D1a", OBJPROP_XDISTANCE, 55);
   ObjectSet("BuyTP3D1a", OBJPROP_YDISTANCE, 240); 

           ObjectCreate("SellTP3D1", OBJ_LABEL, window, 0, 0);
   ObjectSet("SellTP3D1", OBJPROP_CORNER, corner);
   ObjectSetText("SellTP3D1", "SellTP3", 7, "Arial Bold", Label_color);
   ObjectSet("SellTP3D1", OBJPROP_XDISTANCE, 5);
   ObjectSet("SellTP3D1", OBJPROP_YDISTANCE, 253); 
           ObjectCreate("SellTP3D1a", OBJ_LABEL, window, 0, 0);
   ObjectSet("SellTP3D1a", OBJPROP_CORNER, corner);
   ObjectSetText("SellTP3D1a", D1TargetSELL3, 9, "Arial", color_SellTPD1);
   ObjectSet("SellTP3D1a", OBJPROP_XDISTANCE, 5);
   ObjectSet("SellTP3D1a", OBJPROP_YDISTANCE, 240); 

  //*****************************************************************************************************
   //H4_TREND
   string H4Mid="",H4Pivot="",H4OPEN="";
   color color_h4op,color_h4mid,color_MTH4,clr_TdH4;
   double Open_H4 = iOpen(NULL,240,0);
   H4OPEN =  (DoubleToStr(Open_H4,Digits));
   double H4r = iHigh(NULL,PERIOD_H4,1) - iLow(NULL,PERIOD_H4,1);
   double H4R = (iHigh(NULL,PERIOD_H4,1) + iLow(NULL,PERIOD_H4,1))/2;
   double H4P = (iHigh(NULL,PERIOD_H4,1) + iLow(NULL,PERIOD_H4,1) + iClose(NULL,PERIOD_H4,1))/3;
   H4Mid = DoubleToStr(H4R,Digits);
   H4Pivot = DoubleToStr(H4P,Digits);

   //H4_TREND
   string  H4TProfit1="",H4TProfit2="",H4TargetBUY1="",H4TargetSELL1="",
           H4_Trend="",H4_Today="";
   double H4TB1 = H4P + (H4r * 1.236);
   H4TargetBUY1 = DoubleToStr(H4TB1,Digits);
   double H4TS1 = H4P - (H4r * 1.236);
   H4TargetSELL1 = DoubleToStr(H4TS1,Digits);

     if (H4OPEN > H4Pivot) {color_h4op=Lime;}
     if (H4OPEN < H4Pivot) {color_h4op=Red;}
     if (H4OPEN == H4Pivot) {color_h4op=Gray;}
     if (H4Mid > H4Pivot) {color_h4mid=Lime; H4TProfit2=H4TargetBUY1;}
     if (H4Mid < H4Pivot) {color_h4mid=Red; H4TProfit2=H4TargetSELL1;}
     if (H4Mid == H4Pivot) {color_h4mid=Gray; H4TProfit2="---------";}

   //MarketH4
     if (Teks > H4OPEN) H4_Trend = "UP";
     if (Teks > H4OPEN) H4TProfit1 = H4TargetBUY1;
     if (Teks < H4Pivot) H4_Trend = "DN";
     if (Teks < H4Pivot) H4TProfit1 = H4TargetSELL1;
     if ((Teks <= H4OPEN) && (Teks >= H4Pivot)) H4_Trend = "sw";
     if ((Teks <= H4OPEN) && (Teks >= H4Pivot)) H4TProfit1 = "---------";
     if ((Teks <= H4OPEN) && (Teks >= H4Pivot)) color_MTH4 = Gray;
     if (Teks > H4OPEN) color_MTH4 = Lime;
     if (Teks < H4Pivot) color_MTH4 = Red;

     if ((Teks > H4OPEN) && (MA1_H4 > MA2_H4) && (MA1_H4 < MA5_H4) && (rsi_h4 > 50)) {H4_Today = "p"; clr_TdH4 = Lime;}
     if ((Teks < H4OPEN) && (MA1_H4 < MA2_H4) && (MA1_H4 > MA5_H4) && (rsi_h4 < 50)) {H4_Today = "q"; clr_TdH4 = Red;}

           ObjectCreate("H4a", OBJ_LABEL, window, 0, 0);
   ObjectSet("H4a", OBJPROP_CORNER, corner);
   ObjectSetText("H4a", "H4", 9, "Arial Bold", clr_h4);
   ObjectSet("H4a", OBJPROP_XDISTANCE, 70);
   ObjectSet("H4a", OBJPROP_YDISTANCE, 170); 
           ObjectCreate("H4TProfit1", OBJ_LABEL, window, 0, 0);
   ObjectSet("H4TProfit1", OBJPROP_CORNER, corner);
   ObjectSetText("H4TProfit1", H4TProfit1, 9, "Arial Bold",color_MTH4);
   ObjectSet("H4TProfit1", OBJPROP_XDISTANCE, 18);
   ObjectSet("H4TProfit1", OBJPROP_YDISTANCE, 170); 
           ObjectCreate("H4Trend", OBJ_LABEL, window, 0, 0);
   ObjectSet("H4Trend", OBJPROP_CORNER, corner);
   ObjectSetText("H4Trend", H4_Today, 7, "Wingdings 3",clr_TdH4);
   ObjectSet("H4Trend", OBJPROP_XDISTANCE, 5);
   ObjectSet("H4Trend", OBJPROP_YDISTANCE, 170); 

   //*****************************************************************************************************
   //H1_TREND
   string H1Mid="",H1Pivot="",H1OPEN="";
   color color_h1op,color_h1mid,color_MTH1,clr_TdH1;
   double Open_H1 = iOpen(NULL,60,0);
   H1OPEN =  (DoubleToStr(Open_H1,Digits));
   double H1r = iHigh(NULL,PERIOD_H1,1) - iLow(NULL,PERIOD_H1,1);
   double H1R = (iHigh(NULL,PERIOD_H1,1) + iLow(NULL,PERIOD_H1,1))/2;
   double H1P = (iHigh(NULL,PERIOD_H1,1) + iLow(NULL,PERIOD_H1,1) + iClose(NULL,PERIOD_H1,1))/3;
   H1Mid = DoubleToStr(H1R,Digits);
   H1Pivot = DoubleToStr(H1P,Digits);

   //H1_TREND
   string  H1TProfit1="",H1TProfit2="",H1TargetBUY1="",H1TargetSELL1="",
           H1_Trend="",H1_Today="";
   double H1TB1 = H1P + (H1r * 1.236);
   H1TargetBUY1 = DoubleToStr(H1TB1,Digits);
   double H1TS1 = H1P - (H1r * 1.236);
   H1TargetSELL1 = DoubleToStr(H1TS1,Digits);

     if (H1OPEN > H1Pivot) {color_h1op=Lime;}
     if (H1OPEN < H1Pivot) {color_h1op=Red;}
     if (H1OPEN == H1Pivot) {color_h1op=Gray;}
     if (H1Mid > H1Pivot) {color_h1mid=Lime; H1TProfit2=H1TargetBUY1;}
     if (H1Mid < H1Pivot) {color_h1mid=Red; H1TProfit2=H1TargetSELL1;}
     if (H1Mid == H1Pivot) {color_h1mid=Gray; H1TProfit2="---------";}

   //MarketH1
     if (Teks > H1OPEN) H1_Trend = "UP";
     if (Teks > H1OPEN) H1TProfit1 = H1TargetBUY1;
     if (Teks < H1Pivot) H1_Trend = "DN";
     if (Teks < H1Pivot) H1TProfit1 = H1TargetSELL1;
     if ((Teks <= H1OPEN) && (Teks >= H1Pivot)) H1_Trend = "sw";
     if ((Teks <= H1OPEN) && (Teks >= H1Pivot)) H1TProfit1 = "---------";
     if ((Teks <= H1OPEN) && (Teks >= H1Pivot)) color_MTH1 = Gray;
     if (Teks > H1OPEN) color_MTH1 = Lime;
     if (Teks < H1Pivot) color_MTH1 = Red;

     if ((Teks > H1OPEN) && (MA1_H1 > MA2_H1) && (MA1_H1 < MA5_H1) && (rsi_h1 > 50)) {H1_Today = "p"; clr_TdH1 = Lime;}
     if ((Teks < H1OPEN) && (MA1_H1 < MA2_H1) && (MA1_H1 > MA5_H1) && (rsi_h1 < 50)) {H1_Today = "q"; clr_TdH1 = Red;}

           ObjectCreate("H1a", OBJ_LABEL, window, 0, 0);
   ObjectSet("H1a", OBJPROP_CORNER, corner);
   ObjectSetText("H1a", "H1", 9, "Arial Bold", clr_h1);
   ObjectSet("H1a", OBJPROP_XDISTANCE, 70);
   ObjectSet("H1a", OBJPROP_YDISTANCE, 155); 
           ObjectCreate("H1TProfit1", OBJ_LABEL, window, 0, 0);
   ObjectSet("H1TProfit1", OBJPROP_CORNER, corner);
   ObjectSetText("H1TProfit1", H1TProfit1, 9, "Arial Bold",color_MTH1);
   ObjectSet("H1TProfit1", OBJPROP_XDISTANCE, 18);
   ObjectSet("H1TProfit1", OBJPROP_YDISTANCE, 155); 
           ObjectCreate("H1Trend", OBJ_LABEL, window, 0, 0);
   ObjectSet("H1Trend", OBJPROP_CORNER, corner);
   ObjectSetText("H1Trend", H1_Today, 7, "Wingdings 3",clr_TdH1);
   ObjectSet("H1Trend", OBJPROP_XDISTANCE, 5);
   ObjectSet("H1Trend", OBJPROP_YDISTANCE, 155); 

   //*****************************************************************************************************
   //M30_TREND
   string M30Mid="",M30Pivot="",M30OPEN="";
   color color_m30op,color_m30mid,color_MTM30,clr_TdM30;
   double Open_M30 = iOpen(NULL,30,0);
   M30OPEN =  (DoubleToStr(Open_M30,Digits));
   double M30r = iHigh(NULL,PERIOD_M30,1) - iLow(NULL,PERIOD_M30,1);
   double M30R = (iHigh(NULL,PERIOD_M30,1) + iLow(NULL,PERIOD_M30,1))/2;
   double M30P = (iHigh(NULL,PERIOD_M30,1) + iLow(NULL,PERIOD_M30,1) + iClose(NULL,PERIOD_M30,1))/3;
   M30Mid = DoubleToStr(M30R,Digits);
   M30Pivot = DoubleToStr(M30P,Digits);

   //M30_TREND
   string  M30TProfit1="",M30TProfit2="",M30TargetBUY1="",M30TargetSELL1="",
           M30_Trend="",M30_Today="";
   double M30TB1 = M30P + (M30r * 1.236);
   M30TargetBUY1 = DoubleToStr(M30TB1,Digits);
   double M30TS1 = M30P - (M30r * 1.236);
   M30TargetSELL1 = DoubleToStr(M30TS1,Digits);

     if (M30OPEN > M30Pivot) {color_m30op=Lime;}
     if (M30OPEN < M30Pivot) {color_m30op=Red;}
     if (M30OPEN == M30Pivot) {color_m30op=Gray;}
     if (M30Mid > M30Pivot) {color_m30mid=Lime; M30TProfit2=M30TargetBUY1;}
     if (M30Mid < M30Pivot) {color_m30mid=Red; M30TProfit2=M30TargetSELL1;}
     if (M30Mid == M30Pivot) {color_m30mid=Gray; M30TProfit2="---------";}

   //MarketM30
     if (Teks > M30OPEN) M30_Trend = "UP";
     if (Teks > M30OPEN) M30TProfit1 = M30TargetBUY1;
     if (Teks < M30Pivot) M30_Trend = "DN";
     if (Teks < M30Pivot) M30TProfit1 = M30TargetSELL1;
     if ((Teks <= M30OPEN) && (Teks >= M30Pivot)) M30_Trend = "sw";
     if ((Teks <= M30OPEN) && (Teks >= M30Pivot)) M30TProfit1 = "---------";
     if ((Teks <= M30OPEN) && (Teks >= M30Pivot)) color_MTM30 = Gray;
     if (Teks > M30OPEN) color_MTM30 = Lime;
     if (Teks < M30Pivot) color_MTM30 = Red;

     if ((Teks > M30OPEN) && (MA1_M30 > MA2_M30) && (MA1_M30 < MA5_M30) && (rsi_m30 > 50)) {M30_Today = "p"; clr_TdM30 = Lime;}
     if ((Teks < M30OPEN) && (MA1_M30 < MA2_M30) && (MA1_M30 > MA5_M30) && (rsi_m30 < 50)) {M30_Today = "q"; clr_TdM30 = Red;}

           ObjectCreate("M30a", OBJ_LABEL, window, 0, 0);
   ObjectSet("M30a", OBJPROP_CORNER, corner);
   ObjectSetText("M30a", "M30", 9, "Arial Bold", clr_m30);
   ObjectSet("M30a", OBJPROP_XDISTANCE, 70);
   ObjectSet("M30a", OBJPROP_YDISTANCE, 140); 
           ObjectCreate("M30TProfit1", OBJ_LABEL, window, 0, 0);
   ObjectSet("M30TProfit1", OBJPROP_CORNER, corner);
   ObjectSetText("M30TProfit1", M30TProfit1, 9, "Arial Bold",color_MTM30);
   ObjectSet("M30TProfit1", OBJPROP_XDISTANCE, 18);
   ObjectSet("M30TProfit1", OBJPROP_YDISTANCE, 140); 
           ObjectCreate("M30Trend", OBJ_LABEL, window, 0, 0);
   ObjectSet("M30Trend", OBJPROP_CORNER, corner);
   ObjectSetText("M30Trend", M30_Today, 7, "Wingdings 3",clr_TdM30);
   ObjectSet("M30Trend", OBJPROP_XDISTANCE, 5);
   ObjectSet("M30Trend", OBJPROP_YDISTANCE, 140); 

   //*****************************************************************************************************
   //M15_TREND
   string M15Mid="",M15Pivot="",M15OPEN="";
   color color_m15op,color_m15mid,color_MTM15,clr_TdM15;
   double Open_M15 = iOpen(NULL,15,0);
   M15OPEN =  (DoubleToStr(Open_M15,Digits));
   double M15r = iHigh(NULL,PERIOD_M15,1) - iLow(NULL,PERIOD_M15,1);
   double M15R = (iHigh(NULL,PERIOD_M15,1) + iLow(NULL,PERIOD_M15,1))/2;
   double M15P = (iHigh(NULL,PERIOD_M15,1) + iLow(NULL,PERIOD_M15,1) + iClose(NULL,PERIOD_M15,1))/3;
   M15Mid = DoubleToStr(M15R,Digits);
   M15Pivot = DoubleToStr(M15P,Digits);

   //M15_TREND
   string  M15TProfit1="",M15TProfit2="",M15TargetBUY1="",M15TargetSELL1="",
           M15_Trend="",M15_Today="";
   double M15TB1 = M15P + (M15r * 1.236);
   M15TargetBUY1 = DoubleToStr(M15TB1,Digits);
   double M15TS1 = M15P - (M15r * 1.236);
   M15TargetSELL1 = DoubleToStr(M15TS1,Digits);

     if (M15OPEN > M15Pivot) {color_m15op=Lime;}
     if (M15OPEN < M15Pivot) {color_m15op=Red;}
     if (M15OPEN == M15Pivot) {color_m15op=Gray;}
     if (M15Mid > M15Pivot) {color_m15mid=Lime; M15TProfit2=M15TargetBUY1;}
     if (M15Mid < M15Pivot) {color_m15mid=Red; M15TProfit2=M15TargetSELL1;}
     if (M15Mid == M15Pivot) {color_m15mid=Gray; M15TProfit2="---------";}

   //MarketM15
     if (Teks > M15OPEN) M15_Trend = "UP";
     if (Teks > M15OPEN) M15TProfit1 = M15TargetBUY1;
     if (Teks < M15Pivot) M15_Trend = "DN";
     if (Teks < M15Pivot) M15TProfit1 = M15TargetSELL1;
     if ((Teks <= M15OPEN) && (Teks >= M15Pivot)) M15_Trend = "sw";
     if ((Teks <= M15OPEN) && (Teks >= M15Pivot)) M15TProfit1 = "---------";
     if ((Teks <= M15OPEN) && (Teks >= M15Pivot)) color_MTM15 = Gray;
     if (Teks > M15OPEN) color_MTM15 = Lime;
     if (Teks < M15Pivot) color_MTM15 = Red;

     if ((Teks > M15OPEN) && (MA1_M15 > MA2_M15) && (MA1_M15 < MA5_M15) && (rsi_m15 > 50)) {M15_Today = "p"; clr_TdM15 = Lime;}
     if ((Teks < M15OPEN) && (MA1_M15 < MA2_M15) && (MA1_M15 > MA5_M15) && (rsi_m15 < 50)) {M15_Today = "q"; clr_TdM15 = Red;}

           ObjectCreate("M15a", OBJ_LABEL, window, 0, 0);
   ObjectSet("M15a", OBJPROP_CORNER, corner);
   ObjectSetText("M15a", "M15", 9, "Arial Bold", clr_m15);
   ObjectSet("M15a", OBJPROP_XDISTANCE, 70);
   ObjectSet("M15a", OBJPROP_YDISTANCE, 125); 
           ObjectCreate("M15TProfit1", OBJ_LABEL, window, 0, 0);
   ObjectSet("M15TProfit1", OBJPROP_CORNER, corner);
   ObjectSetText("M15TProfit1", M15TProfit1, 9, "Arial Bold",color_MTM15);
   ObjectSet("M15TProfit1", OBJPROP_XDISTANCE, 18);
   ObjectSet("M15TProfit1", OBJPROP_YDISTANCE, 125); 
           ObjectCreate("M15Trend", OBJ_LABEL, window, 0, 0);
   ObjectSet("M15Trend", OBJPROP_CORNER, corner);
   ObjectSetText("M15Trend", M15_Today, 7, "Wingdings 3",clr_TdM15);
   ObjectSet("M15Trend", OBJPROP_XDISTANCE, 5);
   ObjectSet("M15Trend", OBJPROP_YDISTANCE, 125); 

   //*****************************************************************************************************
   //M5_TREND
   string M5Mid="",M5Pivot="",M5OPEN="";
   color color_m5op,color_m5mid,color_MTM5,clr_TdM5;
   double Open_M5 = iOpen(NULL,5,0);
   M5OPEN =  (DoubleToStr(Open_M5,Digits));
   double M5r = iHigh(NULL,PERIOD_M5,1) - iLow(NULL,PERIOD_M5,1);
   double M5R = (iHigh(NULL,PERIOD_M5,1) + iLow(NULL,PERIOD_M5,1))/2;
   double M5P = (iHigh(NULL,PERIOD_M5,1) + iLow(NULL,PERIOD_M5,1) + iClose(NULL,PERIOD_M5,1))/3;
   M5Mid = DoubleToStr(M5R,Digits);
   M5Pivot = DoubleToStr(M5P,Digits);

   //M5_TREND
   string  M5TProfit1="",M5TProfit2="",M5TargetBUY1="",M5TargetSELL1="",
           M5_Trend="",M5_Today="";
   double M5TB1 = M5P + (M5r * 1.236);
   M5TargetBUY1 = DoubleToStr(M5TB1,Digits);
   double M5TS1 = M5P - (M5r * 1.236);
   M5TargetSELL1 = DoubleToStr(M5TS1,Digits);
     
     if (M5OPEN > M5Pivot) {color_m5op=Lime;}
     if (M5OPEN < M5Pivot) {color_m5op=Red;}
     if (M5OPEN == M5Pivot) {color_m5op=Gray;}
     if (M5Mid > M5Pivot) {color_m5mid=Lime; M5TProfit2=M5TargetBUY1;}
     if (M5Mid < M5Pivot) {color_m5mid=Red; M5TProfit2=M5TargetSELL1;}
     if (M5Mid == M5Pivot) {color_m5mid=Gray; M5TProfit2="---------";}

   //MarketM5
     if (Teks > M5OPEN) M5_Trend = "UP";
     if (Teks > M5OPEN) M5TProfit1 = M5TargetBUY1;
     if (Teks < M5Pivot) M5_Trend = "DN";
     if (Teks < M5Pivot) M5TProfit1 = M5TargetSELL1;
     if ((Teks <= M5OPEN) && (Teks >= M5Pivot)) M5_Trend = "sw";
     if ((Teks <= M5OPEN) && (Teks >= M5Pivot)) M5TProfit1 = "---------";
     if ((Teks <= M5OPEN) && (Teks >= M5Pivot)) color_MTM5 = Gray;
     if (Teks > M5OPEN) color_MTM5 = Lime;
     if (Teks < M5Pivot) color_MTM5 = Red;

     if ((Teks > M5OPEN) && (MA1_M5 > MA2_M5) && (MA1_M5 < MA5_M5) && (rsi_m5 > 50)) {M5_Today = "p"; clr_TdM5 = Lime;}
     if ((Teks < M5OPEN) && (MA1_M5 < MA2_M5) && (MA1_M5 > MA5_M5) && (rsi_m5 < 50)) {M5_Today = "q"; clr_TdM5 = Red;}

           ObjectCreate("M5a", OBJ_LABEL, window, 0, 0);
   ObjectSet("M5a", OBJPROP_CORNER, corner);
   ObjectSetText("M5a", "M5", 9, "Arial Bold", clr_m5);
   ObjectSet("M5a", OBJPROP_XDISTANCE, 70);
   ObjectSet("M5a", OBJPROP_YDISTANCE, 110); 
           ObjectCreate("M5TProfit1", OBJ_LABEL, window, 0, 0);
   ObjectSet("M5TProfit1", OBJPROP_CORNER, corner);
   ObjectSetText("M5TProfit1", M5TProfit1, 9, "Arial Bold",color_MTM5);
   ObjectSet("M5TProfit1", OBJPROP_XDISTANCE, 18);
   ObjectSet("M5TProfit1", OBJPROP_YDISTANCE, 110); 
           ObjectCreate("M5Trend", OBJ_LABEL, window, 0, 0);
   ObjectSet("M5Trend", OBJPROP_CORNER, corner);
   ObjectSetText("M5Trend", M5_Today, 7, "Wingdings 3",clr_TdM5);
   ObjectSet("M5Trend", OBJPROP_XDISTANCE, 5);
   ObjectSet("M5Trend", OBJPROP_YDISTANCE, 110); 

   //*****************************************************************************************************
   //M1_TREND
   string M1Mid="",M1Pivot="",M1OPEN="";
   color color_m1op,color_m1mid,color_MTM1,clr_TdM1;
   double Open_M1 = iOpen(NULL,1,0);
   M1OPEN =  (DoubleToStr(Open_M1,Digits));
   double M1r = iHigh(NULL,PERIOD_M1,1) - iLow(NULL,PERIOD_M1,1);
   double M1R = (iHigh(NULL,PERIOD_M1,1) + iLow(NULL,PERIOD_M1,1))/2;
   double M1P = (iHigh(NULL,PERIOD_M1,1) + iLow(NULL,PERIOD_M1,1) + iClose(NULL,PERIOD_M1,1))/3;
   M1Mid = DoubleToStr(M1R,Digits);
   M1Pivot = DoubleToStr(M1P,Digits);

   //M1_TREND
   string  M1TProfit1="",M1TProfit2="",M1TargetBUY1="",M1TargetSELL1="",
           M1_Trend="",M1_Today="";
   double M1TB1 = M1P + (M1r * 1.236);
   M1TargetBUY1 = DoubleToStr(M1TB1,Digits);
   double M1TS1 = M1P - (M1r * 1.236);
   M1TargetSELL1 = DoubleToStr(M1TS1,Digits);
     
     if (M1OPEN > M1Pivot) {color_m1op=Lime;}
     if (M1OPEN < M1Pivot) {color_m1op=Red;}
     if (M1OPEN == M1Pivot) {color_m1op=Gray;}
     if (M1Mid > M1Pivot) {color_m1mid=Lime; M1TProfit2=M1TargetBUY1;}
     if (M1Mid < M1Pivot) {color_m1mid=Red; M1TProfit2=M1TargetSELL1;}
     if (M1Mid == M1Pivot) {color_m1mid=Gray; M1TProfit2="---------";}

   //MarketM1
     if (Teks > M1OPEN) M1_Trend = "UP";
     if (Teks > M1OPEN) M1TProfit1 = M1TargetBUY1;
     if (Teks < M1Pivot) M1_Trend = "DN";
     if (Teks < M1Pivot) M1TProfit1 = M1TargetSELL1;
     if ((Teks <= M1OPEN) && (Teks >= M1Pivot)) M1_Trend = "sw";
     if ((Teks <= M1OPEN) && (Teks >= M1Pivot)) M1TProfit1 = "---------";
     if ((Teks <= M1OPEN) && (Teks >= M1Pivot)) color_MTM1 = Gray;
     if (Teks > M1OPEN) color_MTM1 = Lime;
     if (Teks < M1Pivot) color_MTM1 = Red;

     if ((Teks > M1OPEN) && (MA1_M1 > MA2_M1) && (MA1_M1 < MA5_M1) && (rsi_m1 > 50)) {M1_Today = "p"; clr_TdM1 = Lime;}
     if ((Teks < M1OPEN) && (MA1_M1 < MA2_M1) && (MA1_M1 > MA5_M1) && (rsi_m1 < 50)) {M1_Today = "q"; clr_TdM1 = Red;}

           ObjectCreate("M1a", OBJ_LABEL, window, 0, 0);
   ObjectSet("M1a", OBJPROP_CORNER, corner);
   ObjectSetText("M1a", "M1", 9, "Arial Bold", clr_m1);
   ObjectSet("M1a", OBJPROP_XDISTANCE, 70);
   ObjectSet("M1a", OBJPROP_YDISTANCE, 95); 
           ObjectCreate("M1TProfit1", OBJ_LABEL, window, 0, 0);
   ObjectSet("M1TProfit1", OBJPROP_CORNER, corner);
   ObjectSetText("M1TProfit1", M1TProfit1, 9, "Arial Bold",color_MTM1);
   ObjectSet("M1TProfit1", OBJPROP_XDISTANCE, 18);
   ObjectSet("M1TProfit1", OBJPROP_YDISTANCE, 95); 
           ObjectCreate("M1Trend", OBJ_LABEL, window, 0, 0);
   ObjectSet("M1Trend", OBJPROP_CORNER, corner);
   ObjectSetText("M1Trend", M1_Today, 7, "Wingdings 3",clr_TdM1);
   ObjectSet("M1Trend", OBJPROP_XDISTANCE, 5);
   ObjectSet("M1Trend", OBJPROP_YDISTANCE, 95); 

   //*****************************************************************************************************
   //Info Label

           ObjectCreate("line1", OBJ_LABEL, window, 0, 0);
   ObjectSetText("line1", "_______________", 7, "Verdana",  Line_color);
   ObjectSet("line1", OBJPROP_CORNER, corner);
   ObjectSet("line1", OBJPROP_XDISTANCE, 5);
   ObjectSet("line1", OBJPROP_YDISTANCE, 80);  

           ObjectCreate("line2", OBJ_LABEL, window, 0, 0);
   ObjectSetText("line2", ">>:::::mus:::::<<", 7, "Verdana",  Line_color);
   ObjectSet("line2", OBJPROP_CORNER, corner);
   ObjectSet("line2", OBJPROP_XDISTANCE, 5);
   ObjectSet("line2", OBJPROP_YDISTANCE, 183);  

           ObjectCreate("Pair", OBJ_LABEL, window, 0, 0);
   ObjectSetText("Pair", Symbol(), 12, "Arial Bold",  Pair_color);
   ObjectSet("Pair", OBJPROP_CORNER, corner);
   ObjectSet("Pair", OBJPROP_XDISTANCE, 13);
   ObjectSet("Pair", OBJPROP_YDISTANCE, 195);  

           ObjectCreate("Price", OBJ_LABEL, window, 0, 0);
   ObjectSetText("Price",""+Teks+"", 23, "Arial Narrow",  color_MTM15);
   ObjectSet("Price", OBJPROP_CORNER, corner);
   ObjectSet("Price", OBJPROP_XDISTANCE, 5);
   ObjectSet("Price", OBJPROP_YDISTANCE, 55);  

           ObjectCreate("DAV", OBJ_LABEL, window, 0, 0);
   ObjectSetText("DAV",""+DAV+"", 9, "Arial Bold",  color_av);
   ObjectSet("DAV", OBJPROP_CORNER, corner);
   ObjectSet("DAV", OBJPROP_XDISTANCE, 35);
   ObjectSet("DAV", OBJPROP_YDISTANCE, 45);  

           ObjectCreate("PipsToOpen", OBJ_LABEL, window, 0, 0);
   ObjectSetText("PipsToOpen",""+PIPS+"", 9, "Arial Bold",  color_pip);
   ObjectSet("PipsToOpen", OBJPROP_CORNER, corner);
   ObjectSet("PipsToOpen", OBJPROP_XDISTANCE, 5);
   ObjectSet("PipsToOpen", OBJPROP_YDISTANCE, 30);  

           ObjectCreate("HILO", OBJ_LABEL, window, 0, 0);
   ObjectSetText("HILO",""+HILO+"", 9, "Arial Bold",  Line_color);
   ObjectSet("HILO", OBJPROP_CORNER, corner);
   ObjectSet("HILO", OBJPROP_XDISTANCE, 5);
   ObjectSet("HILO", OBJPROP_YDISTANCE, 45);  

           ObjectCreate("Spread", OBJ_LABEL, window, 0, 0);
   ObjectSetText("Spread",""+SPREAD+"", 9, "Arial Bold",  Pair_color);
   ObjectSet("Spread", OBJPROP_CORNER, corner);
   ObjectSet("Spread", OBJPROP_XDISTANCE, 70);
   ObjectSet("Spread", OBJPROP_YDISTANCE, 45);  

           ObjectCreate("Candle_Time", OBJ_LABEL, window, 0, 0);
   ObjectSet("Candle_Time", OBJPROP_CORNER, corner);
   ObjectSetText("Candle_Time", Teks_Menit+":"+Teks_Detik, 9, "Arial Bold", CandleTime_color);
   ObjectSet("Candle_Time", OBJPROP_XDISTANCE, 35);
   ObjectSet("Candle_Time", OBJPROP_YDISTANCE, 30); 

   //******************************************************************************************************************
   string joget="",jogetTP="",TP="";
   color clr_joget;

     if ((Teks > M1OPEN) && (MA1_M1 > MA2_M1) && (MA1_M1 < MA5_M1) && (rsi_m1 > 50)
        && (Teks > M5OPEN) && (MA1_M5 > MA2_M5) && (MA1_M5 < MA5_M5) && (rsi_m5 > 50)
        && (Teks > M15OPEN) && (MA1_M15 > MA2_M15) && (MA1_M15 < MA5_M15) && (rsi_m15 > 50)
        && (Teks > M30OPEN) && (MA1_M30 > MA2_M30) && (MA1_M30 < MA5_M30) && (rsi_m30 > 50)
        && (Teks > H1OPEN) && (MA1_H1 > MA2_H1) && (MA1_H1 < MA5_H1) && (rsi_h1 > 50)
        && (Teks > H4OPEN) && (MA1_H4 > MA2_H4) && (MA1_H4 < MA5_H4) && (rsi_h4 > 50))
        {joget="BUY"; clr_joget=Lime;}

   else if ((Teks < M1OPEN) && (MA1_M1 < MA2_M1) && (MA1_M1 > MA5_M1) && (rsi_m1 < 50)
        && (Teks < M5OPEN) && (MA1_M5 < MA2_M5) && (MA1_M5 > MA5_M5) && (rsi_m5 < 50)
        && (Teks < M15OPEN) && (MA1_M15 < MA2_M15) && (MA1_M15 > MA5_M15) && (rsi_m15 < 50)
        && (Teks < M30OPEN) && (MA1_M30 < MA2_M30) && (MA1_M30 > MA5_M30) && (rsi_m30 < 50)
        && (Teks < H1OPEN) && (MA1_H1 < MA2_H1) && (MA1_H1 > MA5_H1) && (rsi_h1 < 50)
        && (Teks < H4OPEN) && (MA1_H4 < MA2_H4) && (MA1_H4 > MA5_H4) && (rsi_h4 < 50))
        {joget="SELL"; clr_joget=Red;}
        
   else {joget="WAIT"; clr_joget=Gray;}

           ObjectCreate("jogetSignal", OBJ_LABEL, window, 0, 0);
   ObjectSet("jogetSignal", OBJPROP_CORNER, corner);
   ObjectSetText("jogetSignal", joget, 12, "Arial Bold", clr_joget);
   ObjectSet("jogetSignal", OBJPROP_XDISTANCE, 25);
   ObjectSet("jogetSignal", OBJPROP_YDISTANCE, 340); 

   //******************************************************************************************************************
 
 //----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int ObjectMakeLabel( string n, int xoff, int yoff ) {
   ObjectCreate( n, OBJ_LABEL, window, 0, 0 );
   ObjectSet( n, OBJPROP_CORNER, corner );
   ObjectSet( n, OBJPROP_XDISTANCE, xoff );
   ObjectSet( n, OBJPROP_YDISTANCE, yoff );
   ObjectSet( n, OBJPROP_BACK, true );
 return(0);}

string FormatDateTime(int nYear,int nMonth,int nDay,int nHour,int nMin,int nSec)
  {
   string sMonth,sDay,sHour,sMin,sSec;
//----
   sMonth=100+nMonth;
   sMonth=StringSubstr(sMonth,1);
   sDay=100+nDay;
   sDay=StringSubstr(sDay,1);
   sHour=100+nHour;
   sHour=StringSubstr(sHour,1);
   sMin=100+nMin;
   sMin=StringSubstr(sMin,1);
   sSec=100+nSec;
   sSec=StringSubstr(sSec,1);
//----
   return(StringConcatenate(nYear,".",sMonth,".",sDay," ",sHour,":",sMin,":",sSec));
  }

int init()
  {
  
    if(Digits%2==1) point=Point*10;
   else point=Point;
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   
   int top = 5;
   int left = 5;

   ObjectMakeLabel( "wibl", left+0, top+0 );
   ObjectMakeLabel( "wibt", left+0, top+10 );
   ObjectMakeLabel( "brol", left+55, top+0 );
   ObjectMakeLabel( "brot", left+55, top+10 );
   //ObjectMakeLabel( "barl", left+90, top+0 );
   //ObjectMakeLabel( "bart", left+90, top+10 );
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectsDeleteAll(0,OBJ_LABEL);
   ObjectsDeleteAll(1,OBJ_LABEL);
   ObjectsDeleteAll(2,OBJ_LABEL);
   ObjectsDeleteAll(3,OBJ_LABEL);
//----
   return(0);
  }
//+------------------------------------------------------------------+

