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
Look at the time of the log. This all happened in one ms, and next to it (in the same ms) a bunch of OnBooks.
You can count all events by counters, but even visually you can see that there are more OnBooks.
Didn't you write that you use Async orders?
I was wondering, what algorithm do you use to control the execution of trades?
Andrew, the numbers there are fixed microseconds when OnFunctions are triggered, and everything is printed together then from the array. OnBooks in total may be more - I will count, but it is unclear why they skip ahead of the OnTicks in the queue or what. Or not every OnTick corresponds to an OnBook?
welcome to the world of networking ))))
The easiest thing to do is to runNetstat - a -b under the administrator.
You will see ports and software, I don't want to bother, but I think MT5 server asynchronously passes packets with different information which terminal puts into needed "shelves".
HH: Do you know about Print() and skipping of prints if you output a lot of them at once? - Just write your information in the file - that way you'll save everything and in order, but don't forget to close the file before closing. In theory and Print() in the logs in the file should be complete, but have not checked and in general I do not trust if a lot of data output. Discussed herehttps://www.mql5.com/ru/forum/329730, very often "missing prints" are discussed ))) - search
Andrew, the numbers are fixed microseconds when OnFunctions are triggered, and then printed all together from the array. Maybe there are more OnBooks in total - I will count them, but it is unclear why they skip ahead of the OnTicks in the queue. Or not every OnTick corresponds to an OnBook?
Got it.
Well, there's a lot of OnBooks around anyway. It's hard to draw any conclusions with a log like that.
I thought you wrote that you were using Async orders?
I was wondering, what algorithm do you use to control trade execution?
In OnTradeTransaction()+ check function if there is no server response for a long time.
Generally by magic.
I reserve 65535 magic symbols for each symbol when setting an EA,
and when sending an order I assign it a unique magic number which does not intersect other symbols in any way.
which does not overlap in any way with other instruments.
This is how I set the initial magic number for a symbol
Magic - ulong (8 bytes) e.g.
GAZR-3.12
Byte[7] (high byte) is "G"
Byte[6] is "A"
Byte[5] for "Z"
Byte[4] is "R
Byte[3] is "3
Byte[2] is "12"
Byte[1] and Byte[0] are magiks reserve (65535)
This is how I go through the magiks when sending an order:
But this only works for FORTS as the symbol names are standardised!
Added
If the order is successfully sent, then
remember the time
And then (if there is no response in OnTradeTransaction)
And then theFindOrderBuyMagic function itself
Added by
"Good idea" to add EA identifier(0-255) to the 1st byte of the automagic,
but I don't need it yet, so I haven't done it :)
In OnTradeTransaction()+ check function if there is no server response for a long time.
Thanks for the tip.
1. The second and subsequent terminals at the broker are pay-as-you-go and I have no strategies where I trade only stocks(stock portfolios).
2. If you are going to output the accumulatedGetMicrosecondCount(), then
do it without timer in OnDeinit(), when EA exits, everything will print.
Please send me the link to the broker, it's possible in the LC.
This is an interesting branch... :-)
welcome to the world of networking ))))
The easiest thing to do is to runNetstat - a -b under the administrator.
You will see ports and software, I don't want to bother, but I think MT5 server asynchronously passes packets with different information which terminal puts into needed "shelves".
HH: Do you know about Print() and skipping of prints if you output a lot of them at once? - Just write your information in the file - that way you'll save everything in order, but don't forget to close the file before closing it. In theory and Print() in the logs in the file should be complete, but have not checked and in general I do not trust if a lot of data output. Discussed herehttps://www.mql5.com/ru/forum/329730, very often "missing prints" are discussed ))) - search
Igor, the loss of prints is discussed by those who haven't opened the log file, a hundred times and Rinat Fatkullin himself wrote that nothing is lost in the log file. But for your post was not in vain :) I've added output in a separate file, besides I've made the second file, where I output a little differently (collecting all events in CArrayObj) to bypass possible bugs of my design, which orders two arrays, i.e. I put everything in CArrayObj from two arrays, then sort by microseconds and output with marking what event Tick or Book.
And yes, what's that got to do with ports, what's that got to do with it? I'm just testing the EA event queue. If a tick came, two events should be formed - OnTick, and corresponding OnBook, and OnBook is always placed in queue, and OnTick can disappear if there is already OnTick in the queue (as in manual), ie . the situation when one after another OnTick without OnTick can be only if 1. the OnTicks go "without queuing" 2. there is a system delay of OnBook, this is what I want to check, this can explain the lag of seconds, previously identified by colleagues. Total OnBooks are 2+ times more in a day, but why are they lagging? If this delay is due to asynchronous packets and parsing, maybe, but I only check the fact of their arrival in the Expert Advisor so far. How to test with the rest of the nuances in mind, haven't thought about it yet.
Here is the new code, on opening I will test the correctness of work and run for the day.
s.w. The reason may also be: if Tick passed at the same prices without changing the cup - OnBook is not formed? I'm not a specialist in stock trading, who can tell me. I thought OnTick always causes OnBook.
But I wonder if the person in charge is satisfied with the answers to his question.
I have already received all the answers and have drawn my own conclusions.
I need to analyse the strip of trades for a fixed period of time - prices of trades, realised volumes, etc.
And I also need to simulate the operation of the algorithm in the strategy tester.
The OnTick event copes perfectly with this, the results of real trading and the results of modeling in the tester agree with a small error to my satisfaction.
If you need faster analysis of the strip, you can use OnTimer.
And it is not necessary that every tick that comes to the terminal should be placed in OnBook - this is the specifics of market orders execution.
And every tick that comes into the terminal does not necessarily have to go into OnBook - it is specific to the execution of market orders.
On the contrary, every tick(event) coming to the OnTick handler must be synchronized with OnBook.
There are three events in the OnTick handler, the change of price of the best bid, the change of price of the best ask, and the trade(last).
If the bid or ask price changes without a trade, this will be an event and OnTick will receive these events.
And OnBook also has to catch these events, but its own events, its handler, otherwise there will be a mismatch of bid and ask prices between handlers.
And if OnTick receives a last event, it means a trade has passed.
The trade generates the event in OnTick, because after the trade the price or the volume of bids and asks to change in the market.
It is a vicious circle.
In OnTick as well as in OnBook, there is an event Best Bid and Best Ask.
These events should always be synchronous in both handlers.
And the event last by itself, it generates an event in OnBook after the trade.
Therefore, any event that comes to OnTick handler must be synchronously reflected in OnBook.