Download MetaTrader 5
To add comments, please log in or register
Deposit to your account via Visa QIWI Wallet
MetaQuotes Software Corp.
Moderator
181001
MetaQuotes Software Corp. 2014.01.27 06:52 

popup tip: any bar's local time:

popup tip: any bar's local time, with help of a verticle line.

Author: joshatt

Bambang Sugianto
10224
Bambang Sugianto 2014.02.25 18:00  

try this one..

auto create the line.

if vline deleted.. script removed

#property show_inputs
extern int INTERVAL_MILLIS = 100;
extern int serverzone = 0;
extern int localzone = 8;
 
 
int deinit()
   {
   ObjectDelete("test09msg");  
   WindowRedraw();
   return(0);
   }
   
 
int start()
   {
 
   int Diff = localzone - serverzone;
   
   string VlineName="time_line",var1;
   datetime VlineTime, VlineTimePrevious, tlocal;
   double drawpos;
   
   ObjectCreate(VlineName,OBJ_VLINE,0,WindowTimeOnDropped(),0);  // add this to create line
   ObjectSet(VlineName,OBJPROP_COLOR,Yellow);                    // set color
 
   while( !(IsTesting() || IsStopped()) ) 
      {
      
      drawpos = 0.1*WindowPriceMax() + 0.9*WindowPriceMin();  // <----- 0.1+0.9=1,(0.2+0.8,0.3+0.7....) just adjust this to change Text object hight position.
         VlineTime = ObjectGet(VlineName,OBJPROP_TIME1);
         if(ObjectFind(VlineName) == -1 ) break;  //  if vline deleted.. script removed
      if(VlineTime != VlineTimePrevious  ) 
         {
         if(ObjectFind("test09msg") == -1 )          
            ObjectCreate("test09msg", OBJ_TEXT, 0, VlineTime, drawpos);
         
         tlocal = VlineTime + (Diff * PERIOD_H1 * 60);
         
        
         
         ObjectSetText("test09msg", "                              "+ TimeToStr(tlocal,TIME_DATE )+"_"+ TimeToStr(tlocal,TIME_MINUTES), 10, "Times New Roman", Gray);
         ObjectSet("test09msg",OBJPROP_TIME1,VlineTime);
         //Print(WindowPriceMin()*1.1);
         ObjectSet("test09msg",OBJPROP_PRICE1,drawpos);
         WindowRedraw();
                  
         VlineTimePrevious = VlineTime;
         
         }
         
      Sleep(INTERVAL_MILLIS);
     
      }
   return(0);
}
Bambang Sugianto
10224
Bambang Sugianto 2014.02.25 18:00  

try this one..

auto create the line.

if vline deleted.. script removed

#property show_inputs
extern int INTERVAL_MILLIS = 100;
extern int serverzone = 0;
extern int localzone = 8;
 
 
int deinit()
   {
   ObjectDelete("test09msg");  
   WindowRedraw();
   return(0);
   }
   
 
int start()
   {
 
   int Diff = localzone - serverzone;
   
   string VlineName="time_line",var1;
   datetime VlineTime, VlineTimePrevious, tlocal;
   double drawpos;
   
   ObjectCreate(VlineName,OBJ_VLINE,0,WindowTimeOnDropped(),0);  // add this to create line
   ObjectSet(VlineName,OBJPROP_COLOR,Yellow);                    // set color
 
   while( !(IsTesting() || IsStopped()) ) 
      {
      
      drawpos = 0.1*WindowPriceMax() + 0.9*WindowPriceMin();  // <----- 0.1+0.9=1,(0.2+0.8,0.3+0.7....) just adjust this to change Text object hight position.
         VlineTime = ObjectGet(VlineName,OBJPROP_TIME1);
         if(ObjectFind(VlineName) == -1 ) break;  //  if vline deleted.. script removed
      if(VlineTime != VlineTimePrevious  ) 
         {
         if(ObjectFind("test09msg") == -1 )          
            ObjectCreate("test09msg", OBJ_TEXT, 0, VlineTime, drawpos);
         
         tlocal = VlineTime + (Diff * PERIOD_H1 * 60);
         
        
         
         ObjectSetText("test09msg", "                              "+ TimeToStr(tlocal,TIME_DATE )+"_"+ TimeToStr(tlocal,TIME_MINUTES), 10, "Times New Roman", Gray);
         ObjectSet("test09msg",OBJPROP_TIME1,VlineTime);
         //Print(WindowPriceMin()*1.1);
         ObjectSet("test09msg",OBJPROP_PRICE1,drawpos);
         WindowRedraw();
                  
         VlineTimePrevious = VlineTime;
         
         }
         
      Sleep(INTERVAL_MILLIS);
     
      }
   return(0);
}
joshatt
15
joshatt 2014.05.27 16:37  

That's cool. I can learn from this.

So sorry I did not check this thread for such a long time, thought nobody likes this code.......

/
To add comments, please log in or register