//+------------------------------------------------------------------+
//| TRO+JoGET_bs+                                     +JoGET_bs+.mq4 |
//| MODIFIED BY AVERY T. HORTON, JR.                         masemus |
//| aka TheRumpledOne@gmail.com            Gresik_EastJAVA_Indonesia |
//+------------------------------------------------------------------+
#property copyright "masemus"
#property link      "Gresik_EastJAVA_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 window = 0;

//****************************************
extern int MA1_Period = 1;
extern int MA1_Shift = 0;
extern int MA1_Method = 0;
extern int MA1_Price_Type = 0;

extern int MA2_Period = 5;
extern int MA2_Shift = 0;
extern int MA2_Method = 1;
extern int MA2_Price_Type = 0;

extern int MA3_Period = 240;
extern int MA3_Shift = 0;
extern int MA3_Method = 3;
extern int MA3_Price_Type = 0;

extern int RSI_Period = 2;
extern int RSI_Price_Type = 0;
extern int myRSI_OB = 95;
extern int myRSI_MP = 50;
extern int myRSI_OS = 05;

//****************************************
int corner = 3;
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

string TimeToString( datetime when ) {
   int hour = TimeHour( when );
   int minute = TimeMinute( when );
   
   string timeStr;
   timeStr = DoubleToStr( hour, 0 ) + ":";
   if ( minute < 10 )
      timeStr = timeStr + "0";
   timeStr = timeStr + DoubleToStr( minute, 0 );
   
   return (timeStr);
}

//+------------------------------------------------------------------+
//| 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;
  }
   int    counted_bars=IndicatorCounted();
//----
      
   int    TimeArray[4];
   int    TZInfoArray[43];
   int    nYear,nMonth,nDay,nHour,nMin,nSec,nMilliSec;
   string sMilliSec;
   
   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 = CurTime();
   datetime WIB = localTime + gmt_shift * 60;
   
   //Print( brokerTime, " ", WIB, " " );
   string WIBs = TimeToString( WIB );
   string brokers = TimeToString( CurTime() );
   string bars = TimeToStr( CurTime() - 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 MA1_M1 = iMA(Symbol(),1,MA1_Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA1_M5 = iMA(Symbol(),5,MA1_Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA1_M15 = iMA(Symbol(),15,MA1_Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA1_M30 = iMA(Symbol(),30,MA1_Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA1_H1 = iMA(Symbol(),60,MA1_Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA1_H4 = iMA(Symbol(),240,MA1_Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   double MA1_D1 = iMA(Symbol(),1440,MA1_Period,MA1_Shift,MA1_Method,MA1_Price_Type,0);
   
   double MA2_M1 = iMA(Symbol(),1,MA2_Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   double MA2_M5 = iMA(Symbol(),5,MA2_Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   double MA2_M15 = iMA(Symbol(),15,MA2_Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   double MA2_M30 = iMA(Symbol(),30,MA2_Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   double MA2_H1 = iMA(Symbol(),60,MA2_Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   double MA2_H4 = iMA(Symbol(),240,MA2_Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   double MA2_D1 = iMA(Symbol(),1440,MA2_Period,MA2_Shift,MA2_Method,MA2_Price_Type,0);
   
   double MA3_M1 = iMA(Symbol(),1,MA3_Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA3_M5 = iMA(Symbol(),5,MA3_Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA3_M15 = iMA(Symbol(),15,MA3_Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA3_M30 = iMA(Symbol(),30,MA3_Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA3_H1 = iMA(Symbol(),60,MA3_Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA3_H4 = iMA(Symbol(),240,MA3_Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);
   double MA3_D1 = iMA(Symbol(),1440,MA3_Period,MA3_Shift,MA3_Method,MA3_Price_Type,0);

   string S_m1a = "", S_m5a = "", S_m15a = "", S_m30a = "", S_h1a = "", S_h4a = "", S_d1a = "", S_w1a = "", S_mn1a = "";
   color  clr_signala, clr_m1a, clr_m5a, clr_m15a, clr_m30a, clr_h1a, clr_h4a, clr_d1a, clr_w1a, clr_mn1a;
   
   if (MA1_M1 < MA2_M1) { S_m1a = "n"; clr_m1a = Red; }
   if (MA1_M1 > MA2_M1) { S_m1a = "n"; clr_m1a = MediumSeaGreen; }
   if (MA1_M1 == MA2_M1) { S_m1a = "n"; clr_m1a = Gray; }
   
   if (MA1_M5 < MA2_M5) { S_m5a = "n"; clr_m5a = Red; }
   if (MA1_M5 > MA2_M5) { S_m5a = "n"; clr_m5a = MediumSeaGreen; }
   if (MA1_M5 == MA2_M5) { S_m5a = "n"; clr_m5a = Gray; }
   
   if (MA1_M15 < MA2_M15) { S_m15a = "n"; clr_m15a = Red; }
   if (MA1_M15 > MA2_M15) { S_m15a = "n"; clr_m15a = MediumSeaGreen; }
   if (MA1_M15 == MA2_M15) { S_m15a = "n"; clr_m15a = Gray; }
      
   if (MA1_M30 < MA2_M30) { S_m30a = "n"; clr_m30a = Red; }
   if (MA1_M30 > MA2_M30) { S_m30a = "n"; clr_m30a = MediumSeaGreen; }
   if (MA1_M30 == MA2_M30) { S_m30a = "n"; clr_m30a = Gray; }
   
   if (MA1_H1 < MA2_H1) { S_h1a = "n"; clr_h1a = Red; }
   if (MA1_H1 > MA2_H1) { S_h1a = "n"; clr_h1a = MediumSeaGreen; }
   if (MA1_H1 == MA2_H1) { S_h1a = "n"; clr_h1a = Gray; }

   if (MA1_H4 < MA2_H4) { S_h4a = "n"; clr_h4a = Red; }
   if (MA1_H4 > MA2_H4) { S_h4a = "n"; clr_h4a = MediumSeaGreen; }
   if (MA1_H4 == MA2_H4) { S_h4a = "n"; clr_h4a = Gray; }

   string S_m1b = "", S_m5b = "", S_m15b = "", S_m30b = "", S_h1b = "", S_h4b = "", S_d1b = "", S_w1b = "", S_mn1b = "";
   color  clr_signalb, clr_m1b, clr_m5b, clr_m15b, clr_m30b, clr_h1b, clr_h4b, clr_d1b, clr_w1b, clr_mn1b;

   if (MA1_M1 < MA3_M1) { S_m1b = "6"; clr_m1b = Yellow; }
   if (MA1_M1 > MA3_M1) { S_m1b = "5"; clr_m1b = Lime; }
   if (MA1_M1 == MA3_M1) { S_m1b = "<"; clr_m1b = Gray; }
   
   if (MA1_M5 < MA3_M5) { S_m5b = "6"; clr_m5b = Yellow; }
   if (MA1_M5 > MA3_M5) { S_m5b = "5"; clr_m5b = Lime; }
   if (MA1_M5 == MA3_M5) { S_m5b = "<"; clr_m5b = Gray; }
   
   if (MA1_M15 < MA3_M15) { S_m15b = "6"; clr_m15b = Yellow; }
   if (MA1_M15 > MA3_M15) { S_m15b = "5"; clr_m15b = Lime; }
   if (MA1_M15 == MA3_M15) { S_m15b = "<"; clr_m15b = Gray; }
      
   if (MA1_M30 < MA3_M30) { S_m30b = "6"; clr_m30b = Yellow; }
   if (MA1_M30 > MA3_M30) { S_m30b = "5"; clr_m30b = Lime; }
   if (MA1_M30 == MA3_M30) { S_m30b = "<"; clr_m30b = Gray; }
   
   if (MA1_H1 < MA3_H1) { S_h1b = "6"; clr_h1b = Yellow; }
   if (MA1_H1 > MA3_H1) { S_h1b = "5"; clr_h1b = Lime; }
   if (MA1_H1 == MA3_H1) { S_h1b = "<"; clr_h1b = Gray; }

   if (MA1_H4 < MA3_H4) { S_h4b = "6"; clr_h4b = Yellow; }
   if (MA1_H4 > MA3_H4) { S_h4b = "5"; clr_h4b = Lime; }
   if (MA1_H4 == MA3_H4) { S_h4b = "<"; clr_h4b = Gray; }

   double crsi_d1 = iRSI(NULL, PERIOD_D1, RSI_Period , RSI_Price_Type, 0);
   double crsi_h4 = iRSI(NULL, PERIOD_H4, RSI_Period , RSI_Price_Type, 0);
   double crsi_h1 = iRSI(NULL, PERIOD_H1, RSI_Period , RSI_Price_Type, 0);
   double crsi_m30 = iRSI(NULL, PERIOD_M30, RSI_Period , RSI_Price_Type, 0);
   double crsi_m15 = iRSI(NULL, PERIOD_M15, RSI_Period , RSI_Price_Type, 0);
   double crsi_m5 = iRSI(NULL, PERIOD_M5, RSI_Period , RSI_Price_Type, 0);
   double crsi_m1 = iRSI(NULL, PERIOD_M1, RSI_Period , RSI_Price_Type, 0);
   
   double prsi_d1 = iRSI(NULL, PERIOD_D1, RSI_Period , RSI_Price_Type, 1);
   double prsi_h4 = iRSI(NULL, PERIOD_H4, RSI_Period , RSI_Price_Type, 1);
   double prsi_h1 = iRSI(NULL, PERIOD_H1, RSI_Period , RSI_Price_Type, 1);
   double prsi_m30 = iRSI(NULL, PERIOD_M30, RSI_Period , RSI_Price_Type, 1);
   double prsi_m15 = iRSI(NULL, PERIOD_M15, RSI_Period , RSI_Price_Type, 1);
   double prsi_m5 = iRSI(NULL, PERIOD_M5, RSI_Period , RSI_Price_Type, 1);
   double prsi_m1 = iRSI(NULL, PERIOD_M1, RSI_Period , RSI_Price_Type, 1);
   
   string R_m1a = "", R_m5a = "", R_m15a = "", R_m30a = "", R_h1a = "", R_h4a = "", R_d1a = "", R_w1a = "", R_mn1a = "";
   color warna_signala, warna_m1a, warna_m5a, warna_m15a, warna_m30a, warna_h1a, warna_h4a, warna_d1a, warna_w1a, warna_mn1a;
   
   if ((crsi_m1 > myRSI_MP) && (crsi_m1 <= myRSI_OB)) { R_m1a = "n"; warna_m1a = MediumSeaGreen; }
   if ((crsi_m1 < myRSI_MP) && (crsi_m1 >= myRSI_OS)) { R_m1a = "n"; warna_m1a = DarkOrange; }
   if (crsi_m1 == myRSI_MP) { R_m1a = "n"; warna_m1a = Gray; }
   if ((crsi_m1 > myRSI_OB) && (crsi_m1 <= 100)) { R_m1a = "n"; warna_m1a = Green; }
   if ((crsi_m1 < myRSI_OS) && (crsi_m1 >= 0)) { R_m1a = "n"; warna_m1a = Red; }

   if ((crsi_m5 > myRSI_MP) && (crsi_m5 <= myRSI_OB)) { R_m5a = "n"; warna_m5a = MediumSeaGreen; }
   if ((crsi_m5 < myRSI_MP) && (crsi_m5 >= myRSI_OS)) { R_m5a = "n"; warna_m5a = DarkOrange; }
   if (crsi_m5 == myRSI_MP) { R_m5a = "n"; warna_m5a = Gray; }
   if ((crsi_m5 > myRSI_OB) && (crsi_m5 <= 100)) { R_m5a = "n"; warna_m5a = Green; }
   if ((crsi_m5 < myRSI_OS) && (crsi_m5 >= 0)) { R_m5a = "n"; warna_m5a = Red; }

   if ((crsi_m15 > myRSI_MP) && (crsi_m15 <= myRSI_OB)) { R_m15a = "n"; warna_m15a = MediumSeaGreen; }
   if ((crsi_m15 < myRSI_MP) && (crsi_m15 >= myRSI_OS)) { R_m15a = "n"; warna_m15a = DarkOrange; }
   if (crsi_m15 == myRSI_MP) { R_m15a = "n"; warna_m15a = Gray; }
   if ((crsi_m15 > myRSI_OB) && (crsi_m15 <= 100)) { R_m15a = "n"; warna_m15a = Green; }
   if ((crsi_m15 < myRSI_OS) && (crsi_m15 >= 0)) { R_m15a = "n"; warna_m15a = Red; }

   if ((crsi_m30 > myRSI_MP) && (crsi_m30 <= myRSI_OB)) { R_m30a = "n"; warna_m30a = MediumSeaGreen; }
   if ((crsi_m30 < myRSI_MP) && (crsi_m30 >= myRSI_OS)) { R_m30a = "n"; warna_m30a = DarkOrange; }
   if (crsi_m30 == myRSI_MP) { R_m30a = "n"; warna_m30a = Gray; }
   if ((crsi_m30 > myRSI_OB) && (crsi_m30 <= 100)) { R_m30a = "n"; warna_m30a = Green; }
   if ((crsi_m30 < myRSI_OS) && (crsi_m30 >= 0)) { R_m30a = "n"; warna_m30a = Red; }

   if ((crsi_h1 > myRSI_MP) && (crsi_h1 <= myRSI_OB)) { R_h1a = "n"; warna_h1a = MediumSeaGreen; }
   if ((crsi_h1 < myRSI_MP) && (crsi_h1 >= myRSI_OS)) { R_h1a = "n"; warna_h1a = DarkOrange; }
   if (crsi_h1 == myRSI_MP) { R_h1a = "n"; warna_h1a = Gray; }
   if ((crsi_h1 > myRSI_OB) && (crsi_h1 <= 100)) { R_h1a = "n"; warna_h1a = Green; }
   if ((crsi_h1 < myRSI_OS) && (crsi_h1 >= 0)) { R_h1a = "n"; warna_h1a = Red; }

   if ((crsi_h4 > myRSI_MP) && (crsi_h4 <= myRSI_OB)) { R_h4a = "n"; warna_h4a = MediumSeaGreen; }
   if ((crsi_h4 < myRSI_MP) && (crsi_h4 >= myRSI_OS)) { R_h4a = "n"; warna_h4a = DarkOrange; }
   if (crsi_h4 == myRSI_MP) { R_h4a = "n"; warna_h4a = Gray; }
   if ((crsi_h4 > myRSI_OB) && (crsi_h4 <= 100)) { R_h4a = "n"; warna_h4a = Green; }
   if ((crsi_h4 < myRSI_OS) && (crsi_h4 >= 0)) { R_h4a = "n"; warna_h4a = Red; }

   string R_m1b = "", R_m5b = "", R_m15b = "", R_m30b = "", R_h1b = "", R_h4b = "", R_d1b = "", R_w1b = "", R_mn1b = "";
   color warna_signalb, warna_m1b, warna_m5b, warna_m15b, warna_m30b, warna_h1b, warna_h4b, warna_d1b, warna_w1b, warna_mn1b;
   
   if (crsi_m1 > prsi_m1) { R_m1b = "5"; warna_m1b = Lime; }
   if (crsi_m1 < prsi_m1) { R_m1b = "6"; warna_m1b = Yellow; }
   if (crsi_m1 == prsi_m1) { R_m1b = "<"; warna_m1b = Gray; }

   if (crsi_m5 > prsi_m5) { R_m5b = "5"; warna_m5b = Lime; }
   if (crsi_m5 < prsi_m5) { R_m5b = "6"; warna_m5b = Yellow; }
   if (crsi_m5 == prsi_m5) { R_m5b = "<"; warna_m5b = Gray; }

   if (crsi_m15 > prsi_m15) { R_m15b = "5"; warna_m15b = Lime; }
   if (crsi_m15 < prsi_m15) { R_m15b = "6"; warna_m15b = Yellow; }
   if (crsi_m15 == prsi_m15) { R_m15b = "<"; warna_m15b = Gray; }

   if (crsi_m30 > prsi_m30) { R_m30b = "5"; warna_m30b = Lime; }
   if (crsi_m1 < prsi_m1) { R_m30b = "6"; warna_m30b = Yellow; }
   if (crsi_m1 == prsi_m1) { R_m30b = "<"; warna_m30b = Gray; }

   if (crsi_h1 > prsi_h1) { R_h1b = "5"; warna_h1b = Lime; }
   if (crsi_h1 < prsi_h1) { R_h1b = "6"; warna_h1b = Yellow; }
   if (crsi_h1 == prsi_h1) { R_h1b = "<"; warna_h1b = Gray; }

   if (crsi_h4 > prsi_h4) { R_h4b = "5"; warna_h4b = Lime; }
   if (crsi_h4 < prsi_h4) { R_h4b = "6"; warna_h4b = Yellow; }
   if (crsi_h4 == prsi_h4) { R_h4b = "<"; warna_h4b = Gray; }
   
   //*****************************************************************************************************
   //Info
   string Teks="", Teks_Menit, Teks_Detik;
   double d_A, d_B;

   //Time for Next Candle
   d_B = (Time[4]-Time[5])-MathMod(CurTime(),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="",PRC,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-5));
   DAV = (DoubleToStr(RAvg,Digits-5));
   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; }

  //*****************************************************************************************************
   //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 > MA3_H4) && (crsi_h4 > myRSI_MP) && (crsi_h4 > prsi_h4)) {H4_Today = "p"; clr_TdH4 = Lime;}
     if ((Teks < H4OPEN) && (MA1_H4 < MA2_H4) && (MA1_H4 < MA3_H4) && (crsi_h4 < myRSI_MP) && (crsi_h4 < prsi_h4)) {H4_Today = "q"; clr_TdH4 = Red;}

           ObjectCreate("H4a", OBJ_LABEL, window, 0, 0);
   ObjectSet("H4a", OBJPROP_CORNER, corner);
   ObjectSetText("H4a", "H4", 9, "Arial Bold", Label_color);
   ObjectSet("H4a", OBJPROP_XDISTANCE, 125);
   ObjectSet("H4a", OBJPROP_YDISTANCE, 192); 
           ObjectCreate("H4bs", OBJ_LABEL, window, 0, 0);
   ObjectSet("H4bs", OBJPROP_CORNER, corner);
   ObjectSetText("H4bs", S_h4a, 16, "Webdings",clr_h4a);
   ObjectSet("H4bs", OBJPROP_XDISTANCE, 100);
   ObjectSet("H4bs", OBJPROP_YDISTANCE, 190); 
           ObjectCreate("H4tr", OBJ_LABEL, window, 0, 0);
   ObjectSet("H4tr", OBJPROP_CORNER, corner);
   ObjectSetText("H4tr", S_h4b, 16, "Webdings",clr_h4b);
   ObjectSet("H4tr", OBJPROP_XDISTANCE, 100);
   ObjectSet("H4tr", OBJPROP_YDISTANCE, 190); 
           ObjectCreate("H4Ra", OBJ_LABEL, window, 0, 0);
   ObjectSet("H4Ra", OBJPROP_CORNER, corner);
   ObjectSetText("H4Ra", R_h4a, 16, "Webdings",warna_h4a);
   ObjectSet("H4Ra", OBJPROP_XDISTANCE, 75);
   ObjectSet("H4Ra", OBJPROP_YDISTANCE, 190); 
           ObjectCreate("H4Rb", OBJ_LABEL, window, 0, 0);
   ObjectSet("H4Rb", OBJPROP_CORNER, corner);
   ObjectSetText("H4Rb", R_h4b, 16, "Webdings",warna_h4b);
   ObjectSet("H4Rb", OBJPROP_XDISTANCE, 75);
   ObjectSet("H4Rb", OBJPROP_YDISTANCE, 190); 
           ObjectCreate("H4TProfit1", OBJ_LABEL, window, 0, 0);
   ObjectSet("H4TProfit1", OBJPROP_CORNER, corner);
   ObjectSetText("H4TProfit1", H4TProfit1, 9, "Arial Bold",color_MTH4);
   ObjectSet("H4TProfit1", OBJPROP_XDISTANCE, 23);
   ObjectSet("H4TProfit1", OBJPROP_YDISTANCE, 192); 
           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, 10);
   ObjectSet("H4Trend", OBJPROP_YDISTANCE, 192); 

   //*****************************************************************************************************
   //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 > MA3_H1) && (crsi_h1 > myRSI_MP) && (crsi_h1 > prsi_h1)) {H1_Today = "p"; clr_TdH1 = Lime;}
     if ((Teks < H1OPEN) && (MA1_H1 < MA2_H1) && (MA1_H1 < MA3_H1) && (crsi_h1 < myRSI_MP) && (crsi_h1 < prsi_h1)) {H1_Today = "q"; clr_TdH1 = Red;}

           ObjectCreate("H1a", OBJ_LABEL, window, 0, 0);
   ObjectSet("H1a", OBJPROP_CORNER, corner);
   ObjectSetText("H1a", "H1", 9, "Arial Bold", Label_color);
   ObjectSet("H1a", OBJPROP_XDISTANCE, 125);
   ObjectSet("H1a", OBJPROP_YDISTANCE, 167); 
           ObjectCreate("H1bs", OBJ_LABEL, window, 0, 0);
   ObjectSet("H1bs", OBJPROP_CORNER, corner);
   ObjectSetText("H1bs", S_h1a, 16, "Webdings",clr_h1a);
   ObjectSet("H1bs", OBJPROP_XDISTANCE, 100);
   ObjectSet("H1bs", OBJPROP_YDISTANCE, 165); 
           ObjectCreate("H1tr", OBJ_LABEL, window, 0, 0);
   ObjectSet("H1tr", OBJPROP_CORNER, corner);
   ObjectSetText("H1tr", S_h1b, 16, "Webdings",clr_h1b);
   ObjectSet("H1tr", OBJPROP_XDISTANCE, 100);
   ObjectSet("H1tr", OBJPROP_YDISTANCE, 165); 
           ObjectCreate("H1Ra", OBJ_LABEL, window, 0, 0);
   ObjectSet("H1Ra", OBJPROP_CORNER, corner);
   ObjectSetText("H1Ra", R_h1a, 16, "Webdings",warna_h1a);
   ObjectSet("H1Ra", OBJPROP_XDISTANCE, 75);
   ObjectSet("H1Ra", OBJPROP_YDISTANCE, 165); 
           ObjectCreate("H1Rb", OBJ_LABEL, window, 0, 0);
   ObjectSet("H1Rb", OBJPROP_CORNER, corner);
   ObjectSetText("H1Rb", R_h1b, 16, "Webdings",warna_h1b);
   ObjectSet("H1Rb", OBJPROP_XDISTANCE, 75);
   ObjectSet("H1Rb", OBJPROP_YDISTANCE, 165); 
           ObjectCreate("H1TProfit1", OBJ_LABEL, window, 0, 0);
   ObjectSet("H1TProfit1", OBJPROP_CORNER, corner);
   ObjectSetText("H1TProfit1", H1TProfit1, 9, "Arial Bold",color_MTH1);
   ObjectSet("H1TProfit1", OBJPROP_XDISTANCE, 23);
   ObjectSet("H1TProfit1", OBJPROP_YDISTANCE, 167); 
           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, 10);
   ObjectSet("H1Trend", OBJPROP_YDISTANCE, 167); 

   //*****************************************************************************************************
   //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 > MA3_M30) && (crsi_m30 > myRSI_MP) && (crsi_m30 > prsi_m30)) {M30_Today = "p"; clr_TdM30 = Lime;}
     if ((Teks < M30OPEN) && (MA1_M30 < MA2_M30) && (MA1_M30 < MA3_M30) && (crsi_m30 < myRSI_MP) && (crsi_m30 < prsi_m30)) {M30_Today = "q"; clr_TdM30 = Red;}

           ObjectCreate("M30a", OBJ_LABEL, window, 0, 0);
   ObjectSet("M30a", OBJPROP_CORNER, corner);
   ObjectSetText("M30a", "M30", 9, "Arial Bold", Label_color);
   ObjectSet("M30a", OBJPROP_XDISTANCE, 125);
   ObjectSet("M30a", OBJPROP_YDISTANCE, 142); 
           ObjectCreate("M30bs", OBJ_LABEL, window, 0, 0);
   ObjectSet("M30bs", OBJPROP_CORNER, corner);
   ObjectSetText("M30bs", S_m30a, 16, "Webdings",clr_m30a);
   ObjectSet("M30bs", OBJPROP_XDISTANCE, 100);
   ObjectSet("M30bs", OBJPROP_YDISTANCE, 140); 
           ObjectCreate("M30tr", OBJ_LABEL, window, 0, 0);
   ObjectSet("M30tr", OBJPROP_CORNER, corner);
   ObjectSetText("M30tr", S_m30b, 16, "Webdings",clr_m30b);
   ObjectSet("M30tr", OBJPROP_XDISTANCE, 100);
   ObjectSet("M30tr", OBJPROP_YDISTANCE, 140); 
           ObjectCreate("M30Ra", OBJ_LABEL, window, 0, 0);
   ObjectSet("M30Ra", OBJPROP_CORNER, corner);
   ObjectSetText("M30Ra", R_m30a, 16, "Webdings",warna_m30a);
   ObjectSet("M30Ra", OBJPROP_XDISTANCE, 75);
   ObjectSet("M30Ra", OBJPROP_YDISTANCE, 140); 
           ObjectCreate("M30Rb", OBJ_LABEL, window, 0, 0);
   ObjectSet("M30Rb", OBJPROP_CORNER, corner);
   ObjectSetText("M30Rb", R_m30b, 16, "Webdings",warna_m30b);
   ObjectSet("M30Rb", OBJPROP_XDISTANCE, 75);
   ObjectSet("M30Rb", 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, 23);
   ObjectSet("M30TProfit1", OBJPROP_YDISTANCE, 142); 
           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, 10);
   ObjectSet("M30Trend", OBJPROP_YDISTANCE, 142); 

   //*****************************************************************************************************
   //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 > MA3_M15) && (crsi_m15 > myRSI_MP) && (crsi_m15 > prsi_m15)) {M15_Today = "p"; clr_TdM15 = Lime;}
     if ((Teks < M15OPEN) && (MA1_M15 < MA2_M15) && (MA1_M15 < MA3_M15) && (crsi_m15 < myRSI_MP) && (crsi_m15 < prsi_m15)) {M15_Today = "q"; clr_TdM15 = Red;}

           ObjectCreate("M15a", OBJ_LABEL, window, 0, 0);
   ObjectSet("M15a", OBJPROP_CORNER, corner);
   ObjectSetText("M15a", "M15", 9, "Arial Bold", Label_color);
   ObjectSet("M15a", OBJPROP_XDISTANCE, 125);
   ObjectSet("M15a", OBJPROP_YDISTANCE, 117); 
           ObjectCreate("M15bs", OBJ_LABEL, window, 0, 0);
   ObjectSet("M15bs", OBJPROP_CORNER, corner);
   ObjectSetText("M15bs", S_m15a, 16, "Webdings",clr_m15a);
   ObjectSet("M15bs", OBJPROP_XDISTANCE, 100);
   ObjectSet("M15bs", OBJPROP_YDISTANCE, 115); 
           ObjectCreate("M15tr", OBJ_LABEL, window, 0, 0);
   ObjectSet("M15tr", OBJPROP_CORNER, corner);
   ObjectSetText("M15tr", S_m15b, 16, "Webdings",clr_m15b);
   ObjectSet("M15tr", OBJPROP_XDISTANCE, 100);
   ObjectSet("M15tr", OBJPROP_YDISTANCE, 115); 
           ObjectCreate("M15Ra", OBJ_LABEL, window, 0, 0);
   ObjectSet("M15Ra", OBJPROP_CORNER, corner);
   ObjectSetText("M15Ra", R_m15a, 16, "Webdings",warna_m15a);
   ObjectSet("M15Ra", OBJPROP_XDISTANCE, 75);
   ObjectSet("M15Ra", OBJPROP_YDISTANCE, 115); 
           ObjectCreate("M15Rb", OBJ_LABEL, window, 0, 0);
   ObjectSet("M15Rb", OBJPROP_CORNER, corner);
   ObjectSetText("M15Rb", R_m15b, 16, "Webdings",warna_m15b);
   ObjectSet("M15Rb", OBJPROP_XDISTANCE, 75);
   ObjectSet("M15Rb", OBJPROP_YDISTANCE, 115); 
           ObjectCreate("M15TProfit1", OBJ_LABEL, window, 0, 0);
   ObjectSet("M15TProfit1", OBJPROP_CORNER, corner);
   ObjectSetText("M15TProfit1", M15TProfit1, 9, "Arial Bold",color_MTM15);
   ObjectSet("M15TProfit1", OBJPROP_XDISTANCE, 23);
   ObjectSet("M15TProfit1", OBJPROP_YDISTANCE, 117); 
           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, 10);
   ObjectSet("M15Trend", OBJPROP_YDISTANCE, 117); 

   //*****************************************************************************************************
   //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 > MA3_M5) && (crsi_m5 > myRSI_MP) && (crsi_m5 > prsi_m5)) {M5_Today = "p"; clr_TdM5 = Lime;}
     if ((Teks < M5OPEN) && (MA1_M5 < MA2_M5) && (MA1_M5 < MA3_M5) && (crsi_m5 < myRSI_MP) && (crsi_m5 < prsi_m5)) {M5_Today = "q"; clr_TdM5 = Red;}

           ObjectCreate("M5a", OBJ_LABEL, window, 0, 0);
   ObjectSet("M5a", OBJPROP_CORNER, corner);
   ObjectSetText("M5a", "M5", 9, "Arial Bold", Label_color);
   ObjectSet("M5a", OBJPROP_XDISTANCE, 125);
   ObjectSet("M5a", OBJPROP_YDISTANCE, 92); 
           ObjectCreate("M5bs", OBJ_LABEL, window, 0, 0);
   ObjectSet("M5bs", OBJPROP_CORNER, corner);
   ObjectSetText("M5bs", S_m5a, 16, "Webdings",clr_m5a);
   ObjectSet("M5bs", OBJPROP_XDISTANCE, 100);
   ObjectSet("M5bs", OBJPROP_YDISTANCE, 90); 
           ObjectCreate("M5tr", OBJ_LABEL, window, 0, 0);
   ObjectSet("M5tr", OBJPROP_CORNER, corner);
   ObjectSetText("M5tr", S_m5b, 16, "Webdings",clr_m5b);
   ObjectSet("M5tr", OBJPROP_XDISTANCE, 100);
   ObjectSet("M5tr", OBJPROP_YDISTANCE, 90); 
           ObjectCreate("M5Ra", OBJ_LABEL, window, 0, 0);
   ObjectSet("M5Ra", OBJPROP_CORNER, corner);
   ObjectSetText("M5Ra", R_m5a, 16, "Webdings",warna_m5a);
   ObjectSet("M5Ra", OBJPROP_XDISTANCE, 75);
   ObjectSet("M5Ra", OBJPROP_YDISTANCE, 90); 
           ObjectCreate("M5Rb", OBJ_LABEL, window, 0, 0);
   ObjectSet("M5Rb", OBJPROP_CORNER, corner);
   ObjectSetText("M5Rb", R_m5b, 16, "Webdings",warna_m5b);
   ObjectSet("M5Rb", OBJPROP_XDISTANCE, 75);
   ObjectSet("M5Rb", OBJPROP_YDISTANCE, 90); 
           ObjectCreate("M5TProfit1", OBJ_LABEL, window, 0, 0);
   ObjectSet("M5TProfit1", OBJPROP_CORNER, corner);
   ObjectSetText("M5TProfit1", M5TProfit1, 9, "Arial Bold",color_MTM5);
   ObjectSet("M5TProfit1", OBJPROP_XDISTANCE, 23);
   ObjectSet("M5TProfit1", OBJPROP_YDISTANCE, 92); 
           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, 10);
   ObjectSet("M5Trend", OBJPROP_YDISTANCE, 92); 

   //*****************************************************************************************************
   //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 > MA3_M1) && (crsi_m1 > myRSI_MP) && (crsi_m1 > prsi_m1)) {M1_Today = "p"; clr_TdM1 = Lime;}
     if ((Teks < M1OPEN) && (MA1_M1 < MA2_M1) && (MA1_M1 < MA3_M1) && (crsi_m1 < myRSI_MP) && (crsi_m1 < prsi_m1)) {M1_Today = "q"; clr_TdM1 = Red;}

           ObjectCreate("M1a", OBJ_LABEL, window, 0, 0);
   ObjectSet("M1a", OBJPROP_CORNER, corner);
   ObjectSetText("M1a", "M1", 9, "Arial Bold", Label_color);
   ObjectSet("M1a", OBJPROP_XDISTANCE, 125);
   ObjectSet("M1a", OBJPROP_YDISTANCE, 67); 
           ObjectCreate("M1bs", OBJ_LABEL, window, 0, 0);
   ObjectSet("M1bs", OBJPROP_CORNER, corner);
   ObjectSetText("M1bs", S_m1a, 16, "Webdings",clr_m1a);
   ObjectSet("M1bs", OBJPROP_XDISTANCE, 100);
   ObjectSet("M1bs", OBJPROP_YDISTANCE, 65); 
           ObjectCreate("M1tr", OBJ_LABEL, window, 0, 0);
   ObjectSet("M1tr", OBJPROP_CORNER, corner);
   ObjectSetText("M1tr", S_m1b, 16, "Webdings",clr_m1b);
   ObjectSet("M1tr", OBJPROP_XDISTANCE, 100);
   ObjectSet("M1tr", OBJPROP_YDISTANCE, 65); 
           ObjectCreate("M1Ra", OBJ_LABEL, window, 0, 0);
   ObjectSet("M1Ra", OBJPROP_CORNER, corner);
   ObjectSetText("M1Ra", R_m1a, 16, "Webdings",warna_m1a);
   ObjectSet("M1Ra", OBJPROP_XDISTANCE, 75);
   ObjectSet("M1Ra", OBJPROP_YDISTANCE, 65); 
           ObjectCreate("M1Rb", OBJ_LABEL, window, 0, 0);
   ObjectSet("M1Rb", OBJPROP_CORNER, corner);
   ObjectSetText("M1Rb", R_m1b, 16, "Webdings",warna_m1b);
   ObjectSet("M1Rb", OBJPROP_XDISTANCE, 75);
   ObjectSet("M1Rb", OBJPROP_YDISTANCE, 65); 
           ObjectCreate("M1TProfit1", OBJ_LABEL, window, 0, 0);
   ObjectSet("M1TProfit1", OBJPROP_CORNER, corner);
   ObjectSetText("M1TProfit1", M1TProfit1, 9, "Arial Bold",color_MTM1);
   ObjectSet("M1TProfit1", OBJPROP_XDISTANCE, 23);
   ObjectSet("M1TProfit1", OBJPROP_YDISTANCE, 67); 
           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, 10);
   ObjectSet("M1Trend", OBJPROP_YDISTANCE, 67); 

   //*****************************************************************************************************
   //Info Label

           ObjectCreate("line1", OBJ_LABEL, window, 0, 0);
   ObjectSetText("line1", "+TF:::MA::RSI:::Market:::R+", 7, "Verdana",  Line_color);
   ObjectSet("line1", OBJPROP_CORNER, corner);
   ObjectSet("line1", OBJPROP_XDISTANCE, 5);
   ObjectSet("line1", OBJPROP_YDISTANCE, 50);  

           ObjectCreate("line2", OBJ_LABEL, window, 0, 0);
   ObjectSetText("line2", ">>::o+TRO JoGET_bs +o::<<", 7, "Verdana",  Line_color);
   ObjectSet("line2", OBJPROP_CORNER, corner);
   ObjectSet("line2", OBJPROP_XDISTANCE, 5);
   ObjectSet("line2", OBJPROP_YDISTANCE, 215);  

           ObjectCreate("Pair", OBJ_LABEL, window, 0, 0);
   ObjectSetText("Pair", Symbol(), 10, "Arial Bold",  Pair_color);
   ObjectSet("Pair", OBJPROP_CORNER, corner);
   ObjectSet("Pair", OBJPROP_XDISTANCE, 95);
   ObjectSet("Pair", OBJPROP_YDISTANCE, 225);  

           ObjectCreate("Price", OBJ_LABEL, window, 0, 0);
   ObjectSetText("Price",""+Teks+"", 20, "Arial Narrow",  color_MTM15);
   ObjectSet("Price", OBJPROP_CORNER, corner);
   ObjectSet("Price", OBJPROP_XDISTANCE, 10);
   ObjectSet("Price", OBJPROP_YDISTANCE, 225);  

           ObjectCreate("DAV", OBJ_LABEL, window, 0, 0);
   ObjectSetText("DAV",""+DAV+"", 9, "Arial Bold",  color_av);
   ObjectSet("DAV", OBJPROP_CORNER, corner);
   ObjectSet("DAV", OBJPROP_XDISTANCE, 85);
   ObjectSet("DAV", OBJPROP_YDISTANCE, 32);  

           ObjectCreate("PipsToOpen", OBJ_LABEL, window, 0, 0);
   ObjectSetText("PipsToOpen",""+PIPS+"", 9, "Arial Bold",  color_pip);
   ObjectSet("PipsToOpen", OBJPROP_CORNER, corner);
   ObjectSet("PipsToOpen", OBJPROP_XDISTANCE, 45);
   ObjectSet("PipsToOpen", OBJPROP_YDISTANCE, 32);  

           ObjectCreate("HILO", OBJ_LABEL, window, 0, 0);
   ObjectSetText("HILO",""+HILO+"", 9, "Arial Bold",  Line_color);
   ObjectSet("HILO", OBJPROP_CORNER, corner);
   ObjectSet("HILO", OBJPROP_XDISTANCE, 10);
   ObjectSet("HILO", OBJPROP_YDISTANCE, 32);  

           ObjectCreate("Spread", OBJ_LABEL, window, 0, 0);
   ObjectSetText("Spread",""+SPREAD+"", 9, "Arial Bold",  Pair_color);
   ObjectSet("Spread", OBJPROP_CORNER, corner);
   ObjectSet("Spread", OBJPROP_XDISTANCE, 125);
   ObjectSet("Spread", OBJPROP_YDISTANCE, 32);  

           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, 95);
   ObjectSet("Candle_Time", OBJPROP_YDISTANCE, 240); 

   //******************************************************************************************************************
 
 //----
   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 );
}

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()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   
   int top = 5;
   int left = 10;

   ObjectMakeLabel( "wibl", left+0, top+0 );
   ObjectMakeLabel( "wibt", left+0, top+10 );
   ObjectMakeLabel( "brol", left+45, top+0 );
   ObjectMakeLabel( "brot", left+45, 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);
  }
//+------------------------------------------------------------------+

