2 Views
0 Downloads
0 Favorites
CLOCK_MT4
 //+----------------------------------------------------------------  
//|       "×ÀÑÈÊÈ MT4"                    CLOCK MT4.mq4  
//+----------------------------------------------------------------- 
#property indicator_chart_window
 //+----------------------------------------------------------------  
   extern int     Corner = 1;     // values [0-3] - îïîðíûé óãîë
   extern int  XDistance = 25;    // x ðàññòîÿíèå îò îïîðíîãî óãëà
   extern int  YDistance = 25;    // y ðàññòîÿíèå îò îïîðíîãî óãëà
   extern color   Color1 = Lime;   //öâåò ëèíèè äëÿ  Ïðèáûëü
   extern  color  Color2 = Maroon; // White  öâåò ëèíèè äëÿ óáûòîê
   extern int   FontSize = 9;
   extern string FontName = "Tahoma" ;  // "Arial" "Arial Black"
   double profit=0;  double   nPoint = 0;
//+----------------------------------------------------------- 
int init(){
   return(0);}
//+-----------------------------------------------------------   
int deinit()
  {  ObjectDelete("CLOCK_3"); ObjectDelete("CLOCK_31");
   return(0); }                                        
//+----------------------------------------------------------- 
 int start(){ 
   double nPoint = GetPoint(Symbol()); profit=0;
  for (int w1=0; w1<OrdersTotal(); w1++) 
  if ((OrderSelect(w1, SELECT_BY_POS, MODE_TRADES))&&
  (OrderSymbol()==Symbol())&&(OrderType()==OP_BUY)||(OrderType()==OP_SELL))
   profit+=OrderProfit();
 //+---------------------------------------------------------   
      color colir ;
  if(profit >0) colir = Color1 ; else colir = Color2; 
 // ======================================================================================== 
     ObjectCreate ("CLOCK_3", OBJ_LABEL,   0,0,0); 
     ObjectSetText("CLOCK_3",  DoubleToStr(profit,2)+"$.   D/" + 
     DoubleToStr  (iHigh(NULL,PERIOD_D1,0)/ nPoint-iLow(NULL,PERIOD_D1,0)/ nPoint,0) +   ",  "+ 
      "M" + Period() + "/" +  DoubleToStr(iHigh(NULL,0,0)/ nPoint-iLow(NULL,0,0)/ nPoint,0) +" ï = " +
    (TimeCurrent()-Time[0])/60 + ":"+(TimeCurrent()-Time[0])%60 +  ",  "  +
    TimeToStr(TimeCurrent(), TIME_SECONDS)   ,FontSize, FontName, colir);
          ObjectSet( "CLOCK_3", OBJPROP_CORNER,    Corner); 
          ObjectSet( "CLOCK_3", OBJPROP_XDISTANCE, XDistance);  
          ObjectSet( "CLOCK_3", OBJPROP_YDISTANCE, YDistance); 
   ObjectSet("CLOCK_3",OBJPROP_TIMEFRAMES,OBJ_PERIOD_M1 |OBJ_PERIOD_M5| OBJ_PERIOD_M15 | OBJ_PERIOD_M30 | OBJ_PERIOD_H1 );            
 // ========================================================================================
  // ======================================================================================== 
     ObjectCreate ("CLOCK_31", OBJ_LABEL,   0,0,0); 
     ObjectSetText("CLOCK_31",  DoubleToStr(profit,2)+ "$. H1/" +
              DoubleToStr  (iHigh(NULL,PERIOD_H1,0) / nPoint-iLow(NULL,PERIOD_H1,0)/ nPoint,0) + ", " + 
     "H4/" +  DoubleToStr  (iHigh(NULL,PERIOD_H4,0) / nPoint-iLow(NULL,PERIOD_H4,0)/ nPoint,0) + ", " + 
     "D/"  +  DoubleToStr  (iHigh(NULL,PERIOD_D1,0) / nPoint-iLow(NULL,PERIOD_D1,0)/ nPoint,0) + ", " +
     "W/"  +  DoubleToStr  (iHigh(NULL,PERIOD_W1,0) / nPoint-iLow(NULL,PERIOD_W1,0)/ nPoint,0) + ", " +
     "M/"  +  DoubleToStr  (iHigh(NULL,PERIOD_MN1,0)/ nPoint-iLow(NULL,PERIOD_MN1,0)/nPoint,0) + ". " +  
    TimeToStr(TimeCurrent(), TIME_SECONDS)   ,FontSize, FontName, colir);
          ObjectSet( "CLOCK_31", OBJPROP_CORNER,    Corner); 
          ObjectSet( "CLOCK_31", OBJPROP_XDISTANCE, XDistance);  
          ObjectSet( "CLOCK_31", OBJPROP_YDISTANCE, YDistance);  
    ObjectSet("CLOCK_31",OBJPROP_TIMEFRAMES, OBJ_PERIOD_H4| OBJ_PERIOD_D1 |OBJ_PERIOD_W1| OBJ_PERIOD_MN1 );                
 // ========================================================================================
     return(0);  }
  //======================================================================================== 
 double GetPoint(string vSymbol){
 int vres = StringFind(vSymbol,"JPY");
 if (vres == -1) return(0.0001); return(0.01);}  
//+------------------------------------------------------------------
 //======================================================================================== 

Comments