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.
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
--
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?
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
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.
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.
I had noted that issue with icmarkets before some years ago
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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.