The problem of transferring from MT4 to MT5. Or, more precisely, the inability to execute some algorithms in MT5 without'err. - page 4

 
Eugeni Neumoin:

There is no problem with OnCalculate(). The entire GUI works through OnChartEvent() . There are more than 400 buttons in the GUI. Some of the buttons do not interact with the timeseries in any way. Functions OnCalculate() and OnTrade() can wait until the next tick. This is not psychologically noticeable. And it is more complicated with OnChartEvent(). Here human psychology is involved. The program user presses the GUI button. And he/she doesn't get the response he/she wants. What is his/her reaction? One of the reactions is that he/she presses the same button a second time. I have made it so that a second press on many of the buttons disables the functionality connected by that button. I anticipate your suggestion to make the button action disable in some other way. But there is the same program for MT4. It works there normally. It will turn out that MT4 has one algorithm of interaction with the graphical interface, while MT5 has a different one. Such behavior of the same program will only cause rejection.

I did something similar when translating to MT5 - I enabled exit from OnChartEvent(). I don't want to lie, that's why GUI was just dying.

And in my case the reference to timeseries in OnTimer() occurs after 5 minutes. I'll do it after 2 minutes. I'll check what will happen.

Artem, your suggestions have been useful before.

No, there will certainly be no suggestions to change the logic of working with graphics - the cross-platform code should work in the same way.

  1. Applying to timeseries should be done at least once every two minutes - only in this case it will be guaranteed to be always up-to-date. I.e., in multi... indicators, this part of the code must be by default.
  2. In MQL5, unlike in MQL4, the chart must be updated using CartRedraw() to display the changes of the chart after all the necessary manipulations with all graphical objects that can be updated at once - you don't need to update the chart after each change of one element. I don't know if I have made myself clear. For example, if a user clicked a button and something should be drawn additionally, e.g. a table object consisting of several elements, then all the elements should be drawn and only then the graph should be updated once. Not to update after each drawn element of a single object.
    It may well be that when the user has clicked the button but does not see anything, then in fact everything is there, only the graph is not updated yet (it will update itself only with the arrival of the tick)
 
Artyom Trishkin:

No, there will certainly be no suggestion to change the graphics logic - cross-platform code should work in the same way.

The only thing I can suggest to improve the buttons is that in any case, when the required timeseries is not yet available, it is still not possible to build a graphic on its data. In this case we need to wait for the moment when data becomes available and make buttons inactive while waiting - for example make them similar to Windows interfaces: if no action is available on the button, then the button is grayed out. This logic can be present for both platforms, so that there is no difference in the code.

 

I have ChartRedraw() triggered when exiting large blocks, such as OnChartEvent() and others. So there's nothing wrong with this function.

About tooltips. They are just like indicators that when you click on a number or symbol everything will work.

If you click on the number and symbol, one of the elements OnChartEvent() - CHARTEVENT_OBJECT_CLICK must trigger. It is not triggered if the tooltip does not appear. I would like to know why it happens. CHARTEVENT_OBJECT_CLICK does not work .

And I will keep a close eye on access to timeseries.

 
Eugeni Neumoin:

I have ChartRedraw() triggered when exiting large blocks, such as OnChartEvent() and others. So there's nothing wrong with this function.

About tooltips. They are just like indicators that when you click on a number or symbol everything will work.

If you click on the number and symbol, one of the elements OnChartEvent() - CHARTEVENT_OBJECT_CLICK must trigger. It is not triggered if the tooltip does not appear. I would like to know why it happens. CHARTEVENT_OBJECT_CLICK does not work .

And I will keep a close eye on access to timeseries.

At the very beginning of the graph event handler, log the sparam parameter - then any action will be logged. Then start limiting the output - if there is an object click event (id==CHARTEVENT_OBJECT_CLICK), then output sparam to the log. And so you will slowly get to the cause.

 
Artyom Trishkin:

At the very beginning of the graph event handler, log the sparam parameter - then any action will be logged. Then start limiting the output - if there is an object click event (id== CHARTEVENT_OBJECT_CLICK), then output sparam to the log. And so you will slowly get to the cause.

That's exactly how I debugged everything. And in the code the bits for debugging in OnChartEvent() are always present in a commented form. But, thanks. I will do it that way. I'll look for the cause.
 

To avoid problems with number and symbol binding, you need to increase the priority of numbers and symbols with OBJPROP_ZORDER.

It works in MT4 without it. However, I increased the priority in MT4 just in case. Moreover, the priority of wave symbols was higher than that of numbers.

I have sorted it out.

I am trying to change all timeseries after 2 minutes - I am selecting different variants for the smoothest performance of this task.

The process has started...

 
Eugeni Neumoin:

To avoid problems with number and symbol binding, you need to increase the priority of numbers and symbols with OBJPROP_ZORDER.

It works in MT4 without it. However, I increased the priority in MT4 just in case. Moreover, the priority of wave symbols was higher than that of numbers.

I have sorted it out.

I am trying to change all timeseries after 2 minutes - I am selecting different variants for the smoothest performance of this task.

The process has started...

Smoothness has nothing to do with it :)
Just need to access all the working tf's at least once every two minutes. I usually access every 90 seconds. You can distribute the time of access for the different trader, so as not to pull them all at once. But each one should be accessed at least once every two minutes.
 
Artyom Trishkin:
Smoothness is not an option here :)
You just need to access all the working cf's at least once every two minutes. I usually call every 90 seconds. You can spread out the access times for the different traffics so that you don't have to pull all of them at once. But each one should be accessed at least once every two minutes.

There are brakes.

But we have to put up with what we have.

It is impossible to embrace the immensity).

 
Artyom Trishkin:
Smoothness is not an option here :)
You just need to access all the working cf's at least once every two minutes. I usually call every 90 seconds. You can spread out the access times for the different traffics so that you don't have to pull all of them at once. But each one should be accessed at least once every two minutes.

It is impossible to separate. If at least one trade is not updated, the indicator may make some graphical constructions incorrect.

On the other hand, I checked availability of timeseries before OnCalculate and OnChartEvent. As suggested.

Updating timeseries and checking the availability of timeseries causes severe lags.

Still get timeseries access interruptions. As I said when creating the branch in one of the first posts. This confirms that we have to update the timeseries programmatically.

This is the first one.

Second. Why is it that every developer has to bother with organizing access to timeseries?

Why isn't there some additional "mechanism" that eliminates this hassle?

If someone needs this hassle, no one forbids the use of what is now available. And for those who think that universal alternative access to timeseries is fine, it's better that such access is made by the developers.

I've had several people ask me to translate a program from MT4 to MT5. I have done it. I am not satisfied with the translation. But as long as I have downloaded the program, I have no complaints. May be they are satisfied with it. Although I doubt it.

I would like to add something from my side. I've stopped experimenting with optimizing access to timeseries. This is an unproductive use of time. There are more interesting things to do. Let those who are interested work with MT5. The only thing that can be chewed out of MT5 is the quotes history. For use in teaching NS.

 
Eugeni Neumoin:

On the other hand, did time-series availability checks before OnCalculate and OnChartEvent functions. As suggested.

Updating timeseries and checking availability of timeseries causes severe slowdowns.

It was suggested to do this on a timer every minute and a half. Not before every tick, and certainly not on a chart event.

Access to timeseries in MT5 really isn't ideal. But if you need to solve a problem rather than find an excuse, it is possible.