Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1220

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
One second is often the loss of the last trade/order on the real. For example, on many breeches an order goes to execution for TTL time, which can be five seconds. If it isn't executed in five seconds, the order is a redirect. Or it is executed, but in three seconds.
In the case, if there were no ticks from the acceptance to the execution, such call HistorySelect will not receive information about it.
Perhaps, the TimeCurrent should be equal to MathMax(LastOrder_time, MarketWatch_Time). Then the HistorySelect will be correct. But TimeCurrent may be too expensive.
By the way, such a scheme of working HistorySelect will skip some of the history of trades.
Although, at first glance, everything is clear.
Writing a cheap DealsTotal() is not easy in MT5. It's not elementary (and free) OrdersHistoryTotal() in MT4.
thoughts aloud, no claim to relevance or competence:
If there were no ticks from the acceptance to the execution, such a call to HistorySelect will not get information about it.
You won't solve this problem, the model of server - terminal - MQL interaction was originally designed
I haven't reached the point of checking in MT5, but in MT4 I know for sure that there are situations, when there are price changes on our symbol in the market watching window, but there may be no ticks or less than there are in ЕА
ok, never mind, so it works, you just need to choose in the TS decision, what happens to the order in the absence of information from the server from the moment you send the order - ie, the order will be set or rejected a priori, and received the answer to confirm this preliminary decision or cancel - ie, work with unconfirmed information or still wait for the answer from the server - this offer MQ and you probably will not suit
It is not easy to use cheap DealsTotal() in MT5. It's not the elementary (and free) OrdersHistoryTotal() in MT4.
not write ;)
or rather, most likely you will, and you'll spend EA resources to maintain the algorithm, I think you need to find out how SQLite works, MQ performance tests declared, work with large tables and samples is just the purpose of the database - the EA code will be minimalistic, all the work the database will do, all the work comes down to filling data when placing an order and updating when the server responds (synchronization, of course, when you run EA, the database in memory)
but you won't ;)
or rather, most likely you will write and will spend EA resources to maintain the algorithm, I think you need to figure out how SQLite works, MQ performance tests stated, work with large tables and samples is exactly the purpose of the database - EA code will be minimalistic, all the work the database will do you, all work will be reduced to filling data when placing an order and update when responding from the server (synchronization, of course at startup EA, the database in memory)
It was originally written and posted. It is unlikely to get any faster.
It was originally written and posted. It is unlikely to get any faster.
I must have seen the task incorrectly.
I thought that I needed to update the list of orders from two pointsOnTradeTransaction() and OnTick() , therefore I suggested to do it in the database
Here is my code. In the initialization it creates one record in the table. In the OnTick body it should immediately return an error, because I try to add a record with the same PRIMARY KEY, and after that the base closes immediately. But at the same time I should see at least that first record when I open it, but when I run it in the tester it's not there. And even the table is not created. If I just open it in the terminal, everything is normal. The first record is there.
With the location of the database you do not messed up hopefully?
You're not confused about the location of the base, are you?
No, I'm not. Everything is in Files. I think that in tester mode, the database is created in memory and destroyed after the test.
thoughts aloud, no claim to relevance or competence:
...
or rather, most likely you will write and will spend EA resources to maintain the algorithm, I think you need to find out how SQLite works, MQ performance tests stated, work with large tables and samples is precisely the purpose of the database - EA code will be minimalistic, all the work the database will do you, all work is reduced to filling data when placing an order and update when responding from the server (synchronization, of course, when running EA, the database in memory)
And what database will do all your work? Can you tell me?
On one terminal only placing orders, on the other (with the same broker and account) controlling execution. communication either through the database or through PUB/SUB ZMQ. Of course the database is not SQLite. The most suitable for these purposes is Redis, of course my personal opinion.
Good luck