Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1285

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
If there are 1440 orders a day, there should be a check at the start of the minute, or more simply at the appearance of the minute bar. And at this point to open. You don't have it, so the EA opens a position at every tick, which is a strict condition in itself, according to the condition on 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 perform a trade to create a position) All or nothing.
I understand. Thanks for the help.
I also thought it was difficult for my EA to open so many orders. I tried to limit the number of orders with this code
That is, open an order only at 10:00. But the result is the same.
2020.10.27 10:25:17.548 Core 1 272 Mb memory used including 36 Mb of history data, 64 Mb of tick data
What am I doing wrong?
I colored the code I added and changed
This is what it says in the log file
FD 0 10:57:05.453 Core 1 agent process started on 127.0.0.1:3000
CS 0 10:57:05.453 Core 1 connecting to 127.0.0.1:3000
JD 0 10:57:05.953 Core 1 connected
OD 0 10:57:05.975 Core 1 authorized (agent build 2650)
JL 0 10:57:05.980 Tester EURUSD,M1 (Alpari-MT5-Demo): testing of experts\GRAAL.ex5 from 2020.09.01 00:00 to 2020.09.10 00:00
ON 0 10:57:05.997 Core 1 common synchronization completed
CJ 0 10:57:06.223 Tester quality of analyzed history is 100%
LM 0 10:57:06.248 Core 1 MetaTester 5 started on 127.0.0.1:3000
EJ 0 10:57:06.248 Core 1 initialization finished
LS 0 10:57:06.248 Core 1 login (build 2650)
KO 0 10:57:06.248 Core 1 4372 bytes of account info loaded
LI 0 10:57:06.248 Core 1 1482 bytes of tester parameters loaded
FN 0 10:57:06.248 Core 1 1724 bytes of input parameters loaded
OK 0 10:57:06.248 Core 1 423 bytes of symbols list loaded (72 symbols)
HO 0 10:57:06.248 Core 1 expert file added: Experts\GRAAL.ex5 13680 bytes loaded
CP 0 10:57:06.248 Core 1 4077 Mb available, 50 blocks set for ticks generating
DI 0 10:57:06.248 Core 1 calculate profit in pips, initial deposit 10000, leverage 1:100
LP 0 10:57:06.248 Core 1 successfully initialized
RI 0 10:57:06.248 Core 1 15 Kb of total initialization data received
DN 0 10:57:06.248 Core 1 Intel Core i5-6400 @ 2.70GHz, 7883 MB
IG 0 10:57:06.248 Core 1 EURUSD: symbol to be synchronized
RS 0 10:57:06.248 Core 1 EURUSD: symbol synchronized, 3720 bytes of symbol info received
OL 0 10:57:06.248 Core 1 EURUSD: load 27 bytes of history data to synchronize in 0:00:00.003
EK 0 10:57:06.248 Core 1 EURUSD: history synchronized from 2019.01.02 to 2020.10.23
LK 0 10:57:06.248 Core 1 EURUSD,M1: history cache allocated for 628432 bars and contains 619175 bars from 2019.01.02 06:00 to 2020.08.31 23:59
LH 0 10:57:06.248 Core 1 EURUSD,M1: history begins from 2019.01.02 06:00
LN 0 10:57:06.248 Core 1 EURUSD,M1 (Alpari-MT5-Demo): OHLC bar states generating. OnTick execution on the bar begin only
JM 0 10:57:06.248 Core 1 EURUSD,M1: testing of experts\GRAAL.ex5 from 2020.09.01 00:00 to 2020.09.10 00:00 started with inputs:
LS 0 10:57:06.248 Core 1 StopLoss=30
PL 0 10:57:06.248 Core 1 TakeProfit=100
FJ 0 10:57:06.248 Core 1 Lot=0.1
DP 0 10:57:06.248 Core 1 final balance 10000.00 pips
EE 0 10:57:06.248 Core 1 EURUSD,M1: 39553 ticks, 10068 bars generated. Environment synchronized at 0:00:00.031. Test passed in 0:00:00.247 (including ticks preprocessing 0:00:00.016).
DE 0 10:57:06.248 Core 1 EURUSD,M1: total time from login to stop testing 0:00:00.278 (including 0:00:00.031 for history data synchronization)
NQ 0 10:57:06.248 Core 1 272 Mb memory used including 36 Mb of history data, 64 Mb of tick data
KE 0 10:57:06.248 Core 1 log file "C:\Users\a1960\AppData\Roaming\MetaQuotes\Tester\36A64B8C79A6163D85E6173B54096685\Agent-127.0.0.1-3000\logs\20201027.log" written
OS 0 10:57:06.260 Core 1 connection closed
Please advise!
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
The code is completely better, more precisely where you create the function and in which function (OnInit, OnTick, OnTime) get the value of minutes and call the print function. If in OnInit or outside the terminal function fields, that's how it should be. If in OnTick, it will print on every tick and update the value with a new minute.
Valeriy Yastremskiy:
The code is completely better, or rather where you create the function and in which function (OnInit, OnTick, OnTime) you get the value of minutes and call the print function. If in OnInit or outside the terminal function fields, that's how it should be. If in OnTick, it will print on every tick and update the value with a new minute.
Well, here is the full code. In the void OnTick() function it is triggered at the very beginning by the first line to be executed.
It is triggered only at the moment of recompiling or appending to the schedule/deletion field/. For the rest of the time, the variable M holds the value of the minute obtained during the first run of the EA.
Well the code here is all there is to it. The void OnTick() is triggered at the very beginning by the first line to be executed.
It is triggered only at the moment of recompilation or joining to the graph/deletion field/ . For the rest of the time, the variable M holds the value of the minute obtained during the first run of the EA.
Got it, thanks!
I should have
put it in the body of the function, not in front of it by assigning the value M
Got it, thanks!
I should have
put it in the body of the function, instead of assigning the M value before it.
You can do it in different ways. Read global and local variables and their visibility.
Afternoon. Trying to get the angle of the trendline from the angle. Here is the code:
angle is always 0. Regardless of whether to use standard library methods or built-in functions. At the same time, the line is drawn. What is wrong? How to get the angle?
Afternoon. Trying to get the angle of the trendline from the angle. Here is the code:
angle is always 0. Regardless of whether to use standard library methods or built-in functions. At the same time, the line is drawn. What is wrong? How do I get the angle?
https://www.mql5.com/ru/forum/103591
I see, but how do you calculate the angle?
https://www.mql5.com/ru/forum/103591
I see, but how do you calculate the angle?
You're a comedian.
Who am I kidding?
Forum on trading, automated trading systems and strategy testing
Any questions from newbies on MQL4 and MQL5, any help and discussion of algorithms and codes
Nikolai Semko, 2020.10.26 00:34
You should not be afraid of speed. It's just a conditionality for type conversion.
As a variant of the angle definition function:
After MT5 the feeling of MT4 is just awful. The access to the history is somehow emasculated. I am not even speaking about the ticks.
Can you please tell me if this font selection is possible in the indicator?