Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1458
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
https://www.mql5.com/ru/docs/objects/objectmove
How can I find out the number of the first trading day in January of any year using MQL4.5?
You can't. You can only collect such data yourself.
How can I find out the number of the first trading day in January of any year using MQL4.5?
Result
Result
Why decide it was a trading day? Is the idea in the presence of quotes? And if there were quotes but you couldn't trade - I think that's the question.
What made the decision that it was a trading day? Is the idea that there were quotes available? And if there were quotes but you couldn't trade - I think that's the question.
Open MT and take a look. Why ask such questions without looking? The bar is there with all the attributes of OHLC. Everything else is just your imagination.....
I noticed that trading days start in January in one of three variants: 2 January or 3 January or 4 January.
And I was even able to write a subroutine in MQL4 to determine the date of the first trading day in the new year.
int inp_Year=2016; //put the number of the year of interest into the variable
datetimefirst_day_New_Year=StringToTime(IntegerToString(inp_Year)+".01.02 00:00"); //variable where we will record the exact date of the beginning of the trading year, if the trading of a certain year started on the 2nd of January, if the 2nd of January was a weekday
if (TimeDayOfWeek(first_day_New_Year)==0) first_day_New_Year=StringToTime(StringSubstr(TimeToString(first_day_New_Year),0,4)+".01.03 00:00"); //3 January started trading of a certain year, if 2 January was Sunday
if (TimeDayOfWeek(first_day_New_Year)==6) first_day_New_Year=StringToTime(StringSubstr(TimeToString(first_day_New_Year),0,4)+"".01.04 00:00"); //4 January trades of a certain year started, if 2 January was Saturday
Comment("first trading day in ", inp_Year, " year= ",first_day_New_Year);
Open the MT and take a look. Why ask such questions without looking? The bar is there with all the attributes of OHLC. Everything else is in your head.....
I just came across the fact that the quotes are there but trading is prohibited on futures contracts. That's why I thought it was the same situation.