Forex Forum - EarnForex
Serving Traders Since 2005
 

Go Back   Forex Forum - EarnForex > MetaTrader > MetaTrader 5

MetaTrader 5 MT5 is already out of its beta stage, but the development is ongoing. Some brokers already offer real accounts and the interest of traders is growing. You can discuss anything related to MetaTrader 5 in this forum.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 3rd October 2011, 22:20
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default GMT time

Hi
Isn't this the right way to find the EST time?
It is not giving the correct EST time. please help.


thx

MQL5 Code:
   dt_local = TimeLocal();
   EST = dt_local - (TimeGMTOffset()+5*3600);
Reply With Quote
  #2 (permalink)  
Old 3rd October 2011, 23:31
Default Avatar
Senior Member
 
Join Date: Aug 2011
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

After some thinking, I need to mark the EST 0 hr.

MQL5 Code:
datetime dt_local;
datetime EST;
MqlDateTime dt_EST;
datetime EST_hr;

int OnInit()
  {
   SetIndexBuffer(0,iBuf,INDICATOR_DATA);
   ArraySetAsSeries(iBuf,true);
   EST = TimeLocal() + TimeGMTOffset()-4*3600;
   TimeToStruct(EST,dt_EST);      
   EST_hr = dt_EST.hour;  


   return(0);
  }

int OnCalculate(const int rates_total,
 ...
   
   ArraySetAsSeries(time,true);
   
   MqlDateTime dt_bar;
   for(int i=0; i<100; i++)
   {
      TimeToStruct(time[i],dt_bar);
      if(dt_bar.hour ==0) iBuf[i] = high[i]+0.2;
     
   }
//--- return value of prev_calculated for next call
   return(rates_total);
  }

Last edited by samjesse; 3rd October 2011 at 23:35.
Reply With Quote
  #3 (permalink)  
Old 4th October 2011, 07:51
Enivid's Avatar
Administrator
 
Join Date: Nov 2008
Posts: 1,548
Thanks: 18
Thanked 20 Times in 16 Posts
Default

That's a correct way to covert local time to EST in your first post. You should just not forget about the current daylight saving time settings.
__________________
Please, read the Forum Rules and the Signature Rules to avoid termination of your account.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Part time trader? dojo General Forex Discussion 10 25th November 2011 08:07
series array by time samjesse MetaTrader 5 1 3rd October 2011 07:28
A few word about stochasticity of EUR/USD time series ryaron Technical Analysis 0 16th June 2011 20:18
Interbank FX time lines JoBa Newbie Questions 2 22nd May 2011 18:28
time frame buschell General Forex Discussion 3 11th June 2010 00:36


All times are GMT. The time now is 11:08.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Inactive Reminders By Icora Web Design

SEO by vBSEO 3.3.2