Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1029
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
advise how to determine the day in mt5 ? an analogue of DayOfYear from mt4
this is the function to write
if (TimeDayOfYear(transaction_time)==DayOfYear())
https://www.mql5.com/ru/docs/constants/structures/mqldatetime
https://www.mql5.com/ru/docs/constants/structures/mqldate
I've read that, I just don't know how to put it in the code
advise how to determine the day in mt5 ? an analogue of DayOfYear from mt4
this is the function to write
if (TimeDayOfYear(transaction_time)==DayOfYear())
Example code:
There are twoMqlDateTime structures -STimeTransaction and STimeCurrent. In theSTimeTransaction structure we convert transaction time (transaction_time), and in theSTimeCurrent structure - last known time of the trade server.
Then we simply compareday_of_year field of these two structures(STimeTransaction andSTimeCurrent)
Example code:
TwoMqlDateTime structures -STimeTransaction and STimeCurrent. In theSTimeTransaction structure we convert transaction time (transaction_time), and in theSTimeCurrent structure we convert the last known time of the trade server.
Then, we simply compareday_of_year field of these two structures(STimeTransaction andSTimeCurrent)
cool, thanks
A word of advice to an old man...
For some reason, printing does not work when debugging the Expert Advisor.
I.e. there is a piece of program:
And it doesn't print anything. I even removed if(IsNewBar) to print on every tick - but nothing.
I looked through all the tabs like "Expert Advisor", "logs", "logs" - nothing.
What is the problem? I had no problems with MT4, but I have no idea where to go with MT5... I don't know where to go... I don't know where to look...
Yes, the Expert Advisor is not running in "optimization" mode, it's just running on historical data
A word of advice to an old man...
For some reason, printing does not work when debugging the Expert Advisor.
I.e. there's a piece of program:
And it doesn't print anything. I even removed if(IsNewBar) to print on every tick - but nothing.
I looked through all the tabs like "Expert Advisor", "logs", "logs" - nothing.
What is the problem? I had no problems with MT4, but I have no idea where to go with MT5... I don't know where to go... I don't know where to look...
Yes, the Expert Advisor is not running in "optimization" mode, it's just running on historical data
See the logs in the "Tester" folder.
See the logs in the "Tester" folder.
The logs of the "Tester" folder are full of all sorts of stuff, but the printout I'm looking for, i.e. from the program, is not there...
There's also a folder called "Agent-127.0.0.1-3000" which also has logs.
There's also a folder "Agent-127.0.0.1-3000" with logs in it too.
Miracle! Removed ALL the logs in the tester and printing appeared in the "Log" tab. Amazing!
I can't imagine how it happened! )))) But the fact is - it prints!
Thanks for the help!
What flag should be set to open a file to start the Expert Advisor writing data into the file in the tester, so that after a run in the tester the written file can be found in the "MQL5\Files" folder?
I tried it this way: FILE_WRITE|FILE_TXT - i cannot find where the tester has saved the file.
I tried it this way: FILE_WRITE|FILE_TXT|FILE_COMMON - everything is as described in Help, I find the file in "Roaming\MetaQuotes\Terminal\Common\Files".
but I want the file in "MQL5\Files" !!!