//+------------------------------------------------------------------+
//|                                                  ArjunaArrow.mq4 |
//|                               Originally by Pat Chiko (Time.mq4) |
//|                                               Modified by Gibril |
//+------------------------------------------------------------------+
#property copyright "Gibril"
#property link      "gibrilhadad@gmail.com"

//------------------------------------------------------------------
// Instructions
//    BrokerTZ  - Timezone of your Broker (in hours from GMT)
//    LocalTz   - Your timezone in hours from GMT
//    DST       - Is it daylight savings time?
//    ShowLocal - Set to tru to show your local time zone
//    corner    - 0 = top left, 1 = top right, 2 = bottom left, 3 = bottom right
//    topOff    - pixels from top to show the clock
//    labelColor- Color of label
//    clockColor- Color of clock
//
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red


//---- input parameters
extern int corner = 2;
extern int topOff = 75;
extern color labelColor = Red;
extern color clockColor = Red;
extern bool ShowServerTime = false;

//---- buffers
double ExtMapBuffer1[];

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
    int counted_bars = IndicatorCounted();
//----
    datetime brokerTime = CurTime();
    string srvtime = TimeToStr( brokerTime, TIME_SECONDS );
    string bars = TimeToStr( brokerTime - Time[0], TIME_SECONDS );

    ObjectSetText( "brol", "Broker:", 10, "ArialBlsck", labelColor );
    ObjectSetText( "brot", srvtime, 10, "Arial", clockColor );
    ObjectSetText( "barl", "Read Arjun Thread - there are no short cuts !", 15, "ArialBlack", labelColor );
    ObjectSetText( "bart", bars, 10, "Black", clockColor );

//----
    return( 0 );
}

//+------------------------------------------------------------------+

int init() {
//---- indicators
    ObjectDelete( "brol" );
    ObjectDelete( "brot" );
    ObjectDelete( "barl" );
    ObjectDelete( "bart" );

    SetIndexStyle( 0, DRAW_LINE );
    SetIndexBuffer( 0, ExtMapBuffer1 );

    int top = topOff;

    if ( ShowServerTime ) {
        ObjectMakeLabel( "brol", 110, top - 15 );
        ObjectMakeLabel( "brot", 45, top - 15 );
    }
    ObjectMakeLabel( "barl", 110, top - 30 );
    ObjectMakeLabel( "bart", 45, top - 30 );
//----
    return( 0 );
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit() {
//----
    ObjectDelete( "brol" );
    ObjectDelete( "brot" );
    ObjectDelete( "barl" );
    ObjectDelete( "bart" );
//----
    return( 0 );
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int ObjectMakeLabel( string n, int xoff, int yoff ) {
    ObjectCreate( n, OBJ_LABEL, 0, 0, 0 );
    ObjectSet( n, OBJPROP_CORNER, corner );
    ObjectSet( n, OBJPROP_XDISTANCE, xoff );
    ObjectSet( n, OBJPROP_YDISTANCE, yoff );
    ObjectSet( n, OBJPROP_BACK, true );
}




