Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1284
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
use https://www.mql5.com/ru/docs/dateandtime/timecurrent
second version of the function call
in general it ishttps://www.mql5.com/ru/docs/dateandtime/timetostructThank you very much for the valuable information.
I understand what the structure is and how it works, but I haven't yet understood all the details.
I have not yet fully grasped the subtleties associated with it. I'm learning the new material much better with the help of clear examples.
I would be very grateful to you if you could show me how to write the code of the following condition in mql5
I've learned how to open an order using the structure
if(Hour()==10)
to open an order.
You don't have to write the pattern to open the order.... only the writing of the condition.
Thanks again for your help.
must be how you want to determine the price and time of the bar:
Or rather it's the mouse click coordinates in the time + price values on the chart, the bar needs to be defined via iBarShift()Yes, that's it, as it's further understood. Thank you)
Thank you very much for the valuable information.
I understand what the structure is and how it works, but I haven't yet grasped the ins and outs
I'm learning new material better with examples. I'm learning new material much better with the help of clear examples.
I would be very grateful to you if you could show me how to write the code of the following condition in mql5
I've already learned how to open an order using the structure
if(Hour()==10)
to open an order.
You don't have to write the pattern to open the order.... Just a record of the condition.
Thanks again for your help.
Thank you very much for your help. Everything is now clear and understandable.
Good day all!
I am trying to mql4 to mql5. I have created a simple code that opens orders for testing. In the tester, the EA opens orders. I have placed the function Print() at the beginning of the void OnTick() function and my Expert Advisor would enter this function at every tick and print it on every tick in the journal. And on the fifth tick the Expert Advisor enters none of the Print() functions and prints nothing in the Car Registration Journal. Visualization and optimization are disabled in Expert Advisor.
Please advise how to change the code so that Print() is printed in the journal on every tick, as in the 4.
Many thanks in advance to those who help me.
Here is my code
I have increased EA's deposit up to 100 000. As a result, on every tick Print() is printed in the journal.... But not a single trade has opened.
But I need it to open deals and Print() be printed.
Good day all!
I am trying to mql4 to mql5. I have created a simple code that opens orders for testing. In the tester, the EA opens orders. I have placed the function Print() at the beginning of the void OnTick() function and my Expert Advisor would enter this function at every tick and print it on every tick in the journal. And on the fifth tick the Expert Advisor enters none of the Print() functions and prints nothing in the Car Registration Journal. Visualization and optimization are disabled in Expert Advisor.
Please advise how to change the code so that Print() is printed in the journal on every tick, as in the 4.
Many thanks in advance to those who help me.
Here is my code
I have increased EA's deposit up to 100 000. As a result, on every tick Print() is printed in the journal.... But not a single trade has opened.
But I need trades were opened and Print() was printed.
Look at the logs, look at what is printed, the information is entered there at each step. Most probably, something is wrong with opening of orders and the EA does not work.
C:\Users\....\AppData\Roaming\MetaQuotes\Terminal\99193835FC75DE8874B99F9A3B93F15E\MQL5\Logs
We have already discussed whether it is necessary to repeatedly access terminal data from MQL4, then OrderSelecthttps://www.mql5.com/ru/forum/342989#comment_16743716
i think it is possible to use it 100500 times per tick as well, because the output will be increased millions of times per second
the more symbols in the market watch window, the bigger will be load on the terminal itself, and respectively, if you call data from a lot of different symbols, then you will also get lags
i.e. if you use the terminal sensibly, nothing will freeze - in the market watch window there are ten symbols you use
i haven't checkedhow many charts you can open at the same time, but i think that if you limit the history to 1000 bars, then i think the terminal will probably open a couple dozen chart windows without any problems
100
Look at the logs to see what it prints, there is information recorded at each step. Most probably there is something wrong with opening orders and the EA is not working.
C:\Users\....\AppData\Roaming\MetaQuotes\Terminal\99193835FC75DE8874B99F9A3B93F15E\MQL5\Logs
Thanks for the tip.
It really doesn't work. It says.
2020.10.27 06:40:45.311 Tester EURUSD: history data begins from 2018.01.02 00:00
2020.10.27 06:40:45.312 Core 1 connecting to 127.0.0.1:3000
2020.10.27 06:40:45.312 Core 1 connected
2020.10.27 06:40:45.320 Core 1 authorized (agent build 2650)
2020.10.27 06:40:45.323 Tester EURUSD,M1 (Alpari-MT5-Demo): testing of experts\GRAAL.ex5 from 2020.09.01 00:00 to 2020.09.03 00:00
2020.10.27 06:40:45.327 Core 1 common synchronization completed
2020.10.27 06:40:45.328 Tester quality of analyzed history is 100%
2020.10.27 06:40:45.348 Core 1 test experts\GRAAL.ex5 on EURUSD,M1 thread finished
2020.10.27 06:40:45.348 Core 1
2020.10.27 06:40:45.348 Core 1 login (build 2650)
2020.10.27 06:40:45.348 Core 1 account info found with currency USD
2020.10.27 06:40:45.348 Core 1 1482 bytes of tester parameters loaded
2020.10.27 06:40:45.348 Core 1 1724 bytes of input parameters loaded
2020.10.27 06:40:45.348 Core 1 calculate profit in pips, initial deposit 10000, leverage 1:100
2020.10.27 06:40:45.348 Core 1 successfully initialized
2020.10.27 06:40:45.348 Core 1 731 bytes of total initialization data received
2020.10.27 06:40:45.348 Core 1 Intel Core i5-6400 @ 2.70GHz, 7883 MB
2020.10.27 06:40:45.348 Core 1 EURUSD: symbol to be synchronized
2020.10.27 06:40:45.348 Core 1 EURUSD: symbol synchronized already, 18 bytes received
2020.10.27 06:40:45.348 Core 1 EURUSD,M1: history cached from 2019.01.02 06:00
2020.10.27 06:40:45.348 Core 1 EURUSD,M1 (Alpari-MT5-Demo): every tick is cached
2020.10.27 06:40:45.348 Core 1 EURUSD,M1: testing of experts\GRAAL.ex5 from 2020.09.01 00:00 to 2020.09.03 00:00 started with inputs:
2020.10.27 06:40:45.348 Core 1 StopLoss=30
2020.10.27 06:40:45.348 Core 1 TakeProfit=100
2020.10.27 06:40:45.348 Core 1 Lot=0.1
2020.10.27 06:40:45.348 Core 1 final balance 10000.00 pips
2020.10.27 06:40:45.348 Core 1 EURUSD,M1: 111967 ticks, 2880 bars generated. Test passed in 0:00:00.019.
2020.10.27 06:40:45.348 Core 1 270 Mb memory used including 35 Mb of history data, 64 Mb of tick data
2020.10.27 06:40:45.348 Core 1 log file "C:\Users\a1960\AppData\Roaming\MetaQuotes\Tester\36A64B8C79A6163D85E6173B54096685\Agent-127.0.0.1-3000\logs\20201027.log" written
2020.10.27 06:40:45.371 Core 1 connection closed
I am testing it for one day period. It means that Expert Advisor should open 1440 orders. May be it is a problem. Maybe, there are some limitations on the number of open orders at the same time.
If I checked it, it may be because when I had 10 000 on my EA's deposit, it only opened 300 orders and missed the rest for some reason related to money (as I understood from the journal entries). Later, I increased EA's deposit to 100 000 and it did not have right to skip any more. And it stopped opening orders altogether.
But then I decreased the EA's deposit to 10 000 again. However, my Expert Advisor still opens nothing and always writes the values I have stated above.
I have created another EA. I downloaded the same code into it. I have a deposit of 10 000. I got the same problem: I have not opened orders.
Please advise how to make my EA work properly. It sends the same message, only my highlighted yellow line has 271 instead of 270 mb
I have Windows 10. I have 64bit OS and 8GB RAM.
Thank you.
Thanks for the tip.
It really doesn't work. It says.
2020.10.27 06:40:45.348 Core 1 EURUSD,M1: 111967 ticks, 2880 bars generated. Test passed at 0:00:00.019.
2020.10.27 06:40:45.348 Core 1 270 Mb memory used including 35 Mb of history data, 64 Mb of tick data
2020.10.27 06:40:45.348 Core 1 log file "C:\Users\a1960\AppData\Roaming\MetaQuotes\Tester\36A64B8C79A6163D85E6173B54096685\Agent-127.0.0.1-3000\logs\20201027.log" written
2020.10.27 06:40:45.371 Core 1 connection closed
I am testing it for one day period. It means that Expert Advisor should open 1440 orders. May be it is a problem. Maybe, there are some limitations on the number of orders opened simultaneously.
If I checked it, it may be because when I had 10 000 on my EA's deposit, it only opened 300 orders and missed the rest for some reason related to money (as I understood from the journal entries). Later, I increased EA's deposit to 100 000 and it did not have right to skip any more. And it stopped opening orders altogether.
Please advise how to make my EA work normally.
I will always try to get it to work as it was before.
If there are 1440 orders per day, the Expert Advisor should check for the beginning of the minute or, easier, for the appearance of the one-minute bar. And it opens at this moment. You don't have it and therefore the EA opens a position at every tick, which is a tough condition itself according to our symbol at the current quote. This condition may be not fulfilled, and the ticks will be missed. And at some point, a critical error will occur.
Also the type of order execution (order to create a position) All or nothing.
Can you tell me please!
Why isn't the server time updated when new ticks come in?
At the moment when EA starts, everything works as it should, but then the time goes, but new value of the current minute does not come into the variable.
I.e., the Expert Advisor works depending on the number obtained in the variable int M = TimeMinute(TimeCurrent());
Actually this code line is from the reference and it doesn't work.
For example, I start it at 12-the current time returned by the server corresponds to the time in the variable, but then the variable remains at 12, although it is already 15-20 minutes on the clock