return the price at a particular time of day...... simple i'm sure but.....

 

............ it's driving me nuts!! lol

hi guys n gals

firstly, this is my very first post on the forum so may i wish you a happy new year to all, and all the very best for the coming year!

my name is michael and i'm pretty new to programming in mql4. i'm enjoying it immensly and generally i've been getting on grand so far...... except for one thing. it's probably very simple but i can't seem to work it out.

im having a look a demark's work and recently purchased jason perls book - demark indicators. with reference to daily charts in the book he states he uses 10.00pm gmt as the closing time for various calulations. this differs from the actual closing time on my metatrader. i would be most grateful for any help with the code. more specifically....

from the daily chart return the price for each day at 10.00pm gmt (or even any other time of day a user specifies? ) - so as to be able to populate an array and use price at 10.00pm for various calcluations.

in advance many thanks for assistance - i trust you won't embarrass me too much if the soln turns out to be really simple!! lol

regards

mjc

 

Hi

if ( TimeHour(LocalTime())==10 )

or

if ( TimeHour(TimeCurrent ())==10 )

 
Matutin wrote >>

Hi

if ( TimeHour(LocalTime())==10 )

or

if ( TimeHour(TimeCurrent ())==10 )

hi matutin

many thanks for your speedy reply!

apologies but im still a little confused .... could you expand your code a little. im not sure how your code can be used to obtain price, for instance could you develop it to show it returning the price at 10.00pm gmt on a given day?

regards

mjc

 

Something like this :

double PriceAt10Hours=0;

refreshrates;

if ( TimeHour(TimeCurrent ())==10 ) PriceAt10Hours = ask;

 
Matutin wrote >>

Hi

if ( TimeHour(LocalTime())==10 )

or

if ( TimeHour(TimeCurrent ())==10 )

Both the if statements above will return true when the hour = 10.

However, you need to verify that you use one that is the same as GMT as this is when you want it to be true.

If neither is equal to GMT, you can add a GMT offset:

int GMToffset = x;

You need to see what the difference is between GM and your local time (or LocalTime() ) or if you chose to use the server (TimeCurrent() ) to get the value of x.

Then change the if statement

if (TimeHour(LocalTime()) == 10 + GMToffset)

or

if (TImeHour(TimeCurrent()) == 10 + GMToffset)

Note that your GMToffset may be negative.

whocares

Reason: