Features of the mql5 language, subtleties and tricks - page 34

 
Alexey Kozitsyn:
How else can I get the data from the right symbol/TF? CopyBuffer works with handles only.

This is how it happens in MT4:

//+------------------------------------------------------------------+
double GetDataAO(string symbol_name, int timeframe, int shift) {
   return(iAO(symbol_name,timeframe,shift));
}
//+------------------------------------------------------------------+

The data you send to the function is the same as the data you get. Without creating 21 handles of one and the same indicator.


 
Artyom Trishkin:

This is how it happens in MT4:

The data you send to the function is the same as the data you get. Immediately, without creating 21 handles of the same indicator in advance.

I know how to receive data from MT4. You can resist the way it is done in MT5, but it will not change.
 
Alexey Kozitsyn:
I know how to get data from MT4. You can resist the way how to do it in MT5, but it will not change.

I'm not resisting, and I'm not trying to change. I want to achieve the same result on MT5 as in the video, which shows receiving data from any traf on MT4 without visible delays.

How?

By running the indicator, I collect all data of all prices in arrays and then read from them according to the index? But the memory is not rubbery.

To request at one moment the data on one bar of the required price - but it says there is no data, but what should I do to have it?

Do you understand? I'm not criticizing МТ5, I want to understand and get the result as a result not worse than МТ4.

 
Artyom Trishkin:

I'm not resisting, and I'm not trying to change. I want to achieve the same result on MT5 as in the video, which shows receiving data from any traf on MT4 without visible delays.

How?

By running the indicator I collect all data of all prices in arrays and then read from them according to the index? But the memory is not rubbery.

To request at one moment the data on one bar of the required price - but it says there is no data, and what to do to have them?

Do you understand? I'm not criticizing MT5, I want to understand and get the result as good as MT4.

If you want without delays - a timer to start every 60-90 seconds for the desired symbol / TF to keep the data up-to-date. Although. Not sure if this method will work for indicator data from alien symbol/TF. I'll have to try it out.
 

28 characters per 6 TF = 168 handles (MA). Starts up in 8 seconds, updates once every 4 seconds without any problems.

But in the tester, alas, it's a dead end.

 
Alexey Kozitsyn:
You want no delays - timer to start every 60-90s for the desired symbol/TF to keep the data up to date.
And what to do at the first start? On the video there is no delay in starting the indicator. On MT5 everything hangs without any signs of life at the start of the indicator. If the user waits, he/she will see the data being drawn. But they may think that the indicator is not working. Display messages on the chart with large font - "Wait, I am downloading data on the 21st timeframe"? Crutch.
 
Alexander Puzanov:

28 characters per 6 TF = 168 handles (MA). Starts up in 8 seconds, updates once every 4 seconds without any problems.

But in the tester, alas, it's a dead end.

You may try to run it on a symbol which has never been used and for which you simply have no data at all.

And, yes, it's good that you got a result - that's what I want to achieve. Gathering my opinions on how to do it better.

 
Artyom Trishkin:
What to do at the first launch? There is no delay on indicator launching in the video. In MT5 everything hangs without any signs of life at indicator start. If the user waited, he would see the data being drawn. But they may think that the indicator is not working. Display messages on the chart with large font - "Wait, I am downloading data on the 21st timeframe"? Crutch.

If the user is so impatient - let him buy an iron faster, and for the rest of the normal and reasonable behavior is:

1. Set the adequate number of bars in the window and in the history;

2. In case of serious calculations, inform the user that everything is ok, he just needs to wait. You can make a history sub-indicator for the sake of beauty.

 
Alexey Kozitsyn:

If the user is so impatient - let him buy an iron faster, and for the rest of the normal and reasonable behavior is:

1. Set the adequate number of bars in the window and in the history;

2. In case of serious calculations, inform the user that everything is ok, he just needs to wait. For the sake of beauty, you can create an indicator of history subtracking.

I have set 5000 bars of history in MT4 and MT5. I have a visual instant start in MT4, but there is about 20 to 30 seconds waiting in MT5. And that's assuming that the EURUSD symbol is used repeatedly for tests - there is a history in both terminals.

There is no need to tell the "impatient" user that he should wait. There should not be unreasonable delays when starting and switching the timeframe.

That's why I am interested in possible methods to solve this problem. For now. Then I'll experiment with them - what will really work.

 
Artyom Trishkin:

I set 5000 bars of history in MT4 and MT5. I have a visual instant start in MT4, and a waiting period of 20 to 30 seconds in MT5. And that's assuming that the EURUSD symbol is used repeatedly for tests - there is a history in both terminals.

It is not necessary to tell the "impatient" user in every way to wait. It is necessary that there are no unreasonable delays when starting and switching the timeframe.

That's why I am interested in possible ways to solve this problem. For now. I'll experiment with them later - what really happens.

20-30 seconds!? .... Omg... I think you did something wrong. My tick indicators count many times faster. Several per chart.
Reason: