Problem with iOpen daily data

 

Hi friends.

I need your help about one case. I try to code some MT4 expert advisor in which i use iOpen(Symbol(),PERIOD_D1,0). The problem is that in 00:07 hour iOpen give me data from previous day. Is that normal, and if yes in what time i can take correct data for current day?

Thank you in advance.

 
kanov:

Hi friends.

I need your help about one case. I try to code some MT4 expert advisor in which i use iOpen(Symbol(),PERIOD_D1,0). The problem is that in 00:07 hour iOpen give me data from previous day. Is that normal, and if yes in what time i can take correct data for current day?

Thank you in advance.

Seems your regional setting are wrong
Try to correct your time zone + your time then share what could be happened here
 
Mohammad Soubra:
Seems your regional setting are wrong
Try to correct your time zone + your time then share what could be happened here

i think that my time zone is ok. Is possible on 00:07 to not have information for current Daily bar?

 
kanov:

i think that my time zone is ok. Is possible on 00:07 to not have information for current Daily bar?

iOpen is returning the broker's open price of the candle in theire time
All brokers are same in that  .. so seems not an error
--
Suppose the new day (new candle) is the 00:07 in your time zone 
So, 7 minutes diffirent 
..
May i know which broker? 

 
Mohammad Soubra:
iOpen is returning the broker's open price of the candle in theire time
All brokers are same in that  .. so seems not an error
--
Suppose the new day (new candle) is the 00:07 in your time zone 
So, 7 minutes diffirent 
..
May i know which broker? 


Benchmark is my brocker.

I have idea to print every minute iOpen and then i will understand exactly in which minute change data for current day.

Did you know some other to have the same problem?

 
kanov:

i think that my time zone is ok. Is possible on 00:07 to not have information for current Daily bar?

You might find this useful. I wrote it a while back to monitor the M1 bars on my chart.

You can change it from 1 to PERIOD_D1 if you want to monitor the daily.

#property copyright "nothing"
#property link      "localhost"
#property version   "1.00"
#property strict
int OnInit(){
EventSetTimer(1);
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason){EventKillTimer();}
void OnTick(){}
void OnTimer(){
double current = iOpen(Symbol(),1,0); //get the current open price
double previous = iOpen(Symbol(),1,1); //get the previous open price
datetime curTime = iTime(Symbol(),1,0); //get the current timestamp
datetime prevTime = iTime(Symbol(),1,1); //get the previous timestamp
Comment("Broker time: "+TimeToString(TimeCurrent(),TIME_SECONDS)+"\nSystem time: "+TimeToString(TimeLocal(),TIME_SECONDS)+"\n\nCurrent open: "+DoubleToString(current,Digits)+" @ "+TimeToString(curTime,TIME_SECONDS)+"\n\nPrevious open: "+DoubleToString(previous,Digits)+" @ "+TimeToString(prevTime,TIME_SECONDS));
}

When you load it, you should see something similar to this screenshot:

- Jack

Files:
m1Open.mq4  1 kb
 
Jack Thomas:

You might find this useful. I wrote it a while back to monitor the M1 bars on my chart.

You can change it from 1 to PERIOD_D1 if you want to monitor the daily.

When you load it, you should see something similar to this screenshot:

- Jack

Thank you. I will try.

 
kanov: I need your help about one case. I try to code some MT4 expert advisor in which i use iOpen(Symbol(),PERIOD_D1,0). The problem is that in 00:07 hour iOpen give me data from previous day. Is that normal, and if yes in what time i can take correct data for current day?

Please be aware that your broker's timezone is almost certainly different to your time zone and the time on your PC.

Just because it is 00:07 on your PC's clock, does not mean that your broker time is the same. Their time could be 23:07, meaning that it has still not closed the day yet, so have a look at the "Market Watch" window on MetaTrader to see your brokers time.

Also consult your broker's web-page to see at what timezone they operate and what daylight savings rules they apply.

 
maybe the broker themselves are stopping for 7 minutes each new daily candle
I had noted that issue with icmarkets before some years ago