Errors, bugs, questions - page 1804

 
Comments not related to this topic have been moved to "Any questions from newbies on MQL4, help and discussion on algorithms and codes".
 
fxsaber:
Sleep is only needed when the symbol is not in Market Watch. For all symbols that are in Market Watch before (and during) the indicator, no slips are needed.
I see.
 

1531 - the Metaquotes-Demo brakes have not gone away.

Request and response

Request.action = TRADE_ACTION_DEAL (1)
Request.magic = 0
Request.order = 0
Request.symbol = #KO
Request.volume = 1.0
Request.price = 40.31
Request.stoplimit = 0.0
Request.sl = 0.0
Request.tp = 0.0
Request.deviation = 100
Request.type = ORDER_TYPE_BUY (0)
Request.type_filling = ORDER_FILLING_RETURN (2)
Request.type_time = ORDER_TIME_GTC (0)
Request.expiration = 1970.01.01 00:00:00
Request.comment = My Position
Request.position = 0
Request.position_by = 0
Result.retcode = 10009
Result.deal = 117613087
Result.order = 133997293
Result.volume = 1.0
Result.price = 40.31
Result.bid = 40.28
Result.ask = 40.31
Result.comment = Request executed 345.781 + 26.356 ms
Result.request_id = 5712
Result.retcode_external = 0

OrderSend took 345 ms, and it took 26 ms for the corresponding order and deal to become available in the history. I.e. a very slow synchronization which I've never seen before.

Standard Log

2017.02.14 22:26:46.767 Trades  '5122740': prices for #KO 1.00
2017.02.14 22:26:46.852 Trades  '5122740': accepted prices for #KO 1.00
2017.02.14 22:26:46.852 Trades  '5122740': answer prices for #KO 1.00 40.28 / 40.31 in 86.046 ms (0.190 ms on server)
2017.02.14 22:26:46.852 Trades  '5122740': request buy 1.00 #KO at 40.31
2017.02.14 22:26:47.107 Trades  '5122740': accepted request buy 1.00 #KO at 40.31
2017.02.14 22:26:47.107 Trades  '5122740': deal #117613087 buy 1.00 #KO at 40.31 done (based on order #133997293)
2017.02.14 22:26:47.107 Trades  '5122740': order #133997293 buy 1.00 / 1.00 #KO at 40.31 done in 345.709 ms (3.022 ms on server)

The new log is now in 1531! Please explain on this case, what's what.

ZZY log almost immediately after the slowdown.

2017.02.14 22:26:47.433 Trades  '5122740': prices for #KFT 1.00
2017.02.14 22:26:47.503 Trades  '5122740': accepted prices for #KFT 1.00
2017.02.14 22:26:47.506 Trades  '5122740': answer prices for #KFT 1.00 49.17 / 49.20 in 70.980 ms (4.166 ms on server)
2017.02.14 22:26:47.506 Trades  '5122740': request buy 1.00 #KFT at 49.20
2017.02.14 22:26:47.583 Trades  '5122740': accepted request buy 1.00 #KFT at 49.20
2017.02.14 22:26:47.583 Trades  '5122740': deal #117613092 buy 1.00 #KFT at 49.20 done (based on order #133997299)
2017.02.14 22:26:47.583 Trades  '5122740': order #133997299 buy 1.00 / 1.00 #KFT at 49.20 done in 149.304 ms (3.015 ms on server)

These are Requested characters, so the market orders are slower than others.

 

The brakes on TRADE_ACTION_REMOVE.

Request.action = TRADE_ACTION_REMOVE (8)
Request.magic = 0
Request.order = 134003202
Request.symbol =
Request.volume = 0.0
Request.price = 0.0
Request.stoplimit = 0.0
Request.sl = 0.0
Request.tp = 0.0
Request.deviation = 0
Request.type = ORDER_TYPE_BUY (0)
Request.type_filling = ORDER_FILLING_FOK (0)
Request.type_time = ORDER_TIME_GTC (0)
Request.expiration = 1970.01.01 00:00:00
Request.comment =
Request.position = 0
Request.position_by = 0
Result.retcode = 10009
Result.deal = 0
Result.order = 134003202
Result.volume = 0.0
Result.price = 0.0
Result.bid = 0.0
Result.ask = 0.0
Result.comment = Request executed 290.089 + 0.005 ms
Result.request_id = 10078
Result.retcode_external = 0
FL      0       23:02:46.797    Trades  '5122740': buy limit 1.00 Si-3.17 at 56288
GG      0       23:02:46.849    Trades  '5122740': accepted buy limit 1.00 Si-3.17 at 56288
PR      0       23:02:46.852    Trades  '5122740': order #134003202 buy limit 1.00 / 1.00 Si-3.17 at market done in 54.423 ms (0.342 ms on server)
PR      0       23:02:46.854    Trades  '5122740': cancel order #134003202 buy limit 1.00 Si-3.17 at 56288
LL      0       23:02:47.142    Trades  '5122740': accepted cancel order #134003202 buy limit 1.00 Si-3.17 at 56288
CE      0       23:02:47.144    Trades  '5122740': cancel #134003202 buy limit 1.00 Si-3.17 at market done in 290.050 ms (1.400 ms on server)
HH Looking through the logbook from the terminal did not give these lines in any way. Had to take them directly from the file.
 
Error [No prices] on the spot
2017.02.14 23:18:41.442 '5122740': failed instant buy 1.00 EURPLN at 4.30632 (deviation: 100) [No prices]

How is it that there is no price, there is even a price in the log?!

Query

2017.02.14 23:18:41.442 Request.action = TRADE_ACTION_DEAL (1)
2017.02.14 23:18:41.442 Request.magic = 0
2017.02.14 23:18:41.442 Request.order = 0
2017.02.14 23:18:41.442 Request.symbol = EURPLN
2017.02.14 23:18:41.442 Request.volume = 1.0
2017.02.14 23:18:41.442 Request.price = 4.30632
2017.02.14 23:18:41.442 Request.stoplimit = 0.0
2017.02.14 23:18:41.442 Request.sl = 0.0
2017.02.14 23:18:41.442 Request.tp = 0.0
2017.02.14 23:18:41.442 Request.deviation = 100
2017.02.14 23:18:41.442 Request.type = ORDER_TYPE_BUY (0)
2017.02.14 23:18:41.442 Request.type_filling = ORDER_FILLING_RETURN (2)
2017.02.14 23:18:41.442 Request.type_time = ORDER_TIME_GTC (0)
2017.02.14 23:18:41.442 Request.expiration = 1970.01.01 00:00:00
2017.02.14 23:18:41.442 Request.comment = My Position
2017.02.14 23:18:41.442 Request.position = 0
2017.02.14 23:18:41.442 Request.position_by = 0
2017.02.14 23:18:41.442 Result.retcode = 10021
2017.02.14 23:18:41.442 Result.deal = 0
2017.02.14 23:18:41.442 Result.order = 0
2017.02.14 23:18:41.442 Result.volume = 0.0
2017.02.14 23:18:41.442 Result.price = 0.0
2017.02.14 23:18:41.442 Result.bid = 0.0
2017.02.14 23:18:41.442 Result.ask = 0.0
2017.02.14 23:18:41.442 Result.comment = No prices 0.028 + 0.000 ms
2017.02.14 23:18:41.442 Result.request_id = 0
2017.02.14 23:18:41.442 Result.retcode_external = 0
2017.02.14 23:18:41.442
2017.02.14 23:18:41.442 SymbolInfoDouble(Symb,::SYMBOL_BID) = 4.30151
2017.02.14 23:18:41.442 SymbolInfoDouble(Symb,::SYMBOL_ASK) = 4.30632
 
fxsaber:
Error [No prices] on the spot
2017.02.14 23:18:41.442 '5122740': failed instant buy 1.00 EURPLN at 4.30632 (deviation: 100) [No prices]

How can there be no prices, even in the log?!

I got the same error recently on my real account. I tried to place an order but server did not execute it.

I`m currently communicating with technical support of a very famous company on L... (At the moment I'm chatting with tech support from a very well-known company L. (our correspondence is confidential, I won't call it that), they explain that their server's execution time is the same for orders coming from MT4, they have MT4, they have FIX and it's about 1-6 ms. Then, I asked them what is the time spent on 40-50 ms. when trading from MT4, since from the moment of sending the order and getting an answer about 40-60 ms. They shrug tolerantly, like they look for network latency, I tell them the ping 1-2ms, and they again shrug. The conclusion is that the server part of MT4/5 is slow. Now new logs show it. I understand that time can't be "clean" like FIX, but at least it should be of the same order.
 
Andrey Dik:
SZY. At the moment I'm talking to tech support of very famous company on L... (I don't know why I'm not going to call them, they explain that time of execution on their trade server is the same as for orders going out from MT4 (they have MT4) that sent by FIX and is about 1-6ms. Then, I asked them what is the time spent on 40-50 ms. when trading from MT4, since from the moment of sending the order and getting an answer about 40-60 ms. They shrug tolerantly, like they look for network latency, I tell them the ping 1-2ms, and they again shrug. The conclusion is that the server part of MT4/5 is slow. Now new logs show it. I understand that time can't be "clean" like FIX, but at least it should be of the same order.

IN L... had in mind that when they receive an order into their system, the execution time in the system itself and sending it back is negligible. They can get the order from the MT4-server or through FIX and their other API. The MT4 server itself spends many tens of ms for its internal processing, which is not connected with the execution in any way.

Once upon a time the minimum time on MT4 was 150 ms. It seems that something has been seriously tweaked, as it has become 40-60. But MT5 is noticeably faster. Now I can see in logs how much time the server worked. All that remains is to understand what the main time is spent on.

 
Comments not relevant to this topic have been moved to "CopyClose why an error?".
 

Compilation error: cannot access f() //2

typedef void (*fn)();
#import "Test.ex5"
        void f(); //1
#import
void f() {} //2
void OnStart()
{
        fn g1 = Test::f; //нормально
        fn g2 =       f; //Error: 'f' - cannot resolve function address
}
 
@Slawa, please clarify, are there any restrictions on writing the indicator buffers outside the OnCalculate() function? Will everything be written correctly in case of writing buffers in functions: OnTimer(), OnBookEvent(), OnChartEvent()?