MT5 and speed in action - page 91

 
Anton:

Is ObjectGetInterger braking the norm?

 
fxsaber:

Is ObjectGetInterger braking the norm?

Get methods are already synchronous, so they wait. Working with objects is done through a special command queue, not through direct access to objects.

For information, it is highly recommended not to mix Set and Get methods. It is better to pluralize write and then pluralize read. Or vice versa.

 
Renat Fatkhullin:

Get methods are already synchronous, so they are waiting. Objects are handled by a special command queue, not by direct access to objects.

For information, it is not recommended to mix Set and Get methods. It is better to write set and then read set. Or vice versa.

I have problems with it, unfortunately. Shown by the code above.

Thanks for the clarifications.

 
Got it out of the way in certain situations.

a real account.

2021.03.29 17:18:55.280 TradesID_Example (EURUSD,M1)    HistoryDealsTotal() = 99663
2021.03.29 17:18:55.280 TradesID_Example (EURUSD,M1)    HistoryOrdersTotal() = 174307

2021.03.29 17:24:15.862 TradesID_Example (EURUSD,M1)    GetSumByPositionsID(PositionsID,GetSumByPositionID) = 29906412.60837016
2021.03.29 17:24:15.862 TradesID_Example (EURUSD,M1)    Alert: Bench_Stack = 0, 1 <= Time[GetSumByPositionsID(PositionsID,GetSumByPositionID))] = 320581370 mcs.

2021.03.29 17:24:16.057 TradesID_Example (EURUSD,M1)    GetSumByPositionsID(PositionsID,GetSumByPositionID2) = 29906412.60837016
2021.03.29 17:24:16.057 TradesID_Example (EURUSD,M1)    Alert: Bench_Stack = 0, 1 <= Time[GetSumByPositionsID(PositionsID,GetSumByPositionID2))] = 195526 mcs.
2021.03.29 17:24:16.170 TradesID_Example (EURUSD,M1)    GetSumByPositionsID(PositionsID,GetSumByPositionID2) = 29906412.60837016
2021.03.29 17:24:16.170 TradesID_Example (EURUSD,M1)    Alert: Bench_Stack = 0, 1 <= Time[GetSumByPositionsID(PositionsID,GetSumByPositionID2))] = 112839 mcs.

Library is ~2500 times faster than usual implementation. Only alternative approach allows to do some calculations in reasonable time.

 

To force the terminal to allocate memory, you can run this script

void OnStart()
  {
   short arr[];
   ArrayResize(arr,INT_MAX);
   ArrayInitialize(arr,0);
   Print(ArraySize(arr));
   Sleep(5000);
  }

Adjustarray size to your RAM size

 
Rorschach:

To force the terminal to allocate memory, you can run this script

Adjustarray size to your RAM size

What's the idea?

 
fxsaber:

What's the idea?

Apparently, putting the terminal into a memory shortage will trigger internal mechanisms to free it up.

 
traveller00:

Apparently, if you put the terminal in conditions of memory shortage, internal mechanisms of memory release will work.

Yes, the terminal runs out of memory and starts resetting cached data

 

A non-standard situation has arisen. The Expert Advisor takes a screenshot based on the indicator signal and, if the filters pass, gives a command to open/close positions.
The name of the screenshot contains time: day, hour and second, for example, CHFJPY_d29_h10_m24_s17. The time is taken from the TimeCurrent() function.

There are 28 instances of the Expert Advisor running in the terminal. At some point, for 44 minutes, the terminal seemed to freeze and at 10:27 it started working normally again. Here is the part of terminal log itself:


No connection interruptions can be seen. The first entry for EURUSD at 10:27 is the 10:14 sl close in the transaction history.

Below is part of the log from the EA. As you can see from the upper red frames, time of logging and TimeCurrent() that is in the name of the screenshot are almost the same.
And in the lower frames, the difference is half an hour.


On the CHFJPY symbol, formation of one screenshot with the opening signal took place at 10:12, while the second one with the signal was formed at 10:24. But the opening/closing and new opening happened within one minute at 10:27.

Anyway, such weirdness happened from 9:43 to 10:27 :
1) TimeCurrent() works and gets the actual server time, the Expert Advisor receives correct signals from the indicator.
2) The log was only written at 10:27. Screenshots were written to my hard drive in the Files folder at 10:27, new orders (based on old signals) were opened at 10:27.

Maybe someone has encountered this, what could be the reason for such hiccups or slowdowns? Please advise what function should be used to detect the reason? This situation has been repeated several times since April.

 
Vasiliy Pushkaryov:

Can you tell me what functions to use to catch the cause?

Monitor the discrepancy between TimeLocal and TimeCurrent.