Actually I know that the issue is certainly OnChartEvernt() function, I have a lot of code lines in my OnChartEvernt() function and the dashboard has many objects, when I reduce number of objects the it takes less time to load the panel on new chart when I change time frame. however I have no solution to make it faster with the existing number of objects.
If it is fast when you first load it, it may suggest that having many objects in memory could be a factor when changing timeframes.
So is it necessary to retain all the objects when changing timeframe? Can't you just delete them all and re-create to simulate a fresh re-load (which I assume is faster)?
I have a method called chart_CleanObjects() to do this and it helps me avoid build up of obsolete objects
The crux of the code is like this
int ObjAtStart = ObjectsTotal(0);
int cleanup = ObjectsDeleteAll(0, "autotrade");
cleanup += ObjectsDeleteAll(0, def_ChartDispPrefixLive);
cleanup += ObjectsDeleteAll(0, def_ChartRailsPrefix);
If it is fast when you first load it, it may suggest that having many objects in memory could be a factor when changing timeframes.
So is it necessary to retain all the objects when changing timeframe? Can't you just delete them all and re-create to simulate a fresh re-load (which I assume is faster)?
I have a method called chart_CleanObjects() to do this and it helps me avoid build up of obsolete objects
The crux of the code is like this
To be honest, I suspect the issue is coming from deleting and recreating the objects.
It is an asynchronous process as it will trigger a message within the terminals queue and needs to be processed before you can access the parameters of an object.
But the question stays unresolved as long as we cannot see the code.
Also, as a sidenote, allot of objects is a very relative definition, as I know, up to 100.000 objects on a chart will only slightly impact performance, even on older hardware, and memory consumption is also moderate.
I have experienced performance penalties with object counts above 150k and severe penalties above 300k object count on a 16GB i3770k machine with an 980pro NVMe SSD.
I suspect it's a combination of creation and accessing the objects... Maintaining the objects could be beneficial, as it will not introduce the terminal to fill it's processing queue.
To be honest, I suspect the issue is coming from deleting and recreating the objects.
It is an asynchronous process as it will trigger a message within the terminals queue and needs to be processed before you can access the parameters of an object.
But the question stays unresolved as long as we cannot see the code.
Also, as a sidenote, allot of objects is a very relative definition, as I know, up to 100.000 objects on a chart will only slightly impact performance, even on older hardware, and memory consumption is also moderate.
I have experienced performance penalties with object counts above 150k and severe penalties above 300k object count on a 16GB i3770k machine with an 980pro NVMe SSD.
I suspect it's a combination of creation and accessing the objects... Maintaining the objects could be beneficial, as it will not introduce the terminal to fill it's processing queue.
In my case I delete the objects to reduce clutter and it works well for me- it takes microseconds if not less. But as the OP is have a 15 to 20 sec reload time, there is something which is amiss so worth a try.
As you say, without analyzing the code, its impossible to say for sure
Thank you for all your generous comments. I really appreciate it.
First of all I use Dialog library to create this panel, I use CAppDialog to create the main Interface and every object is within the interface and attached to at using MyInterface.Add() method. In Ondeinit I have of course MyInterface.Destroy(reason) method.(Mohammad Hossein Sadeghi) I don see a way to change that piece of code.
The Panel has several tabs and windows (see the attach pic) and number of objects are huge, but It is not near 100000 as Mr Dominik Christian Egert suggested. However when I reduce the number of objects by deleting some of tabs, the issue of huge load time when timeframe changes is gone. On the other hand I cannot remove some of the objects from the panel, because to remove any object I have to use Destroy() method, for example MyBuyButton.Destroty(), and when I create that button again using MyBuyButton.Create() the button will no longer attach to the panel, that is, it does move proportionally when I move the panel. (Check my example picture plz)
Thank you for all your generous comments. I really appreciate it.
First of all I use Dialog library to create this panel, I use CAppDialog to create the main Interface and every object is within the interface and attached to at using MyInterface.Add() method. In Ondeinit I have of course MyInterface.Destroy(reason) method.(Mohammad Hossein Sadeghi) I don see a way to change that piece of code.
The Panel has several tabs and windows (see the attach pic) and number of objects are huge, but It is not near 100000 as Mr Dominik Christian Egert suggested. However when I reduce the number of objects by deleting some of tabs, the issue of huge load time when timeframe changes is gone. On the other hand I cannot remove some of the objects from the panel, because to remove any object I have to use Destroy() method, for example MyBuyButton.Destroty(), and when I create that button again using MyBuyButton.Create() the button will no longer attach to the panel, that is, it does move proportionally when I move the panel. (Check my example picture plz)
So I have find no way to solve this issue yet.
I had a similar issue once in MT4, so I just used the MT5 controls library and it solved the issue and never got to research more on the issue. Yours already seem to be MT5. May be you could try to see if duplicate objects are being created on initialization ( check objects ) and if so then find the reason.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Actually I know that the issue is certainly OnChartEvernt() function, I have a lot of code lines in my OnChartEvernt() function and the dashboard has many objects, when I reduce number of objects the it takes less time to load the panel on new chart when I change time frame. however I have no solution to make it faster with the existing number of objects.
If it is fast when you first load it, it may suggest that having many objects in memory could be a factor when changing timeframes.
So is it necessary to retain all the objects when changing timeframe? Can't you just delete them all and re-create to simulate a fresh re-load (which I assume is faster)?
I have a method called chart_CleanObjects() to do this and it helps me avoid build up of obsolete objects
The crux of the code is like thisIf it is fast when you first load it, it may suggest that having many objects in memory could be a factor when changing timeframes.
So is it necessary to retain all the objects when changing timeframe? Can't you just delete them all and re-create to simulate a fresh re-load (which I assume is faster)?
I have a method called chart_CleanObjects() to do this and it helps me avoid build up of obsolete objects
The crux of the code is like thisIn my case I delete the objects to reduce clutter and it works well for me- it takes microseconds if not less. But as the OP is have a 15 to 20 sec reload time, there is something which is amiss so worth a try.
As you say, without analyzing the code, its impossible to say for sureThank you for all your generous comments. I really appreciate it.
First of all I use Dialog library to create this panel, I use CAppDialog to create the main Interface and every object is within the interface and attached to at using MyInterface.Add() method.
In Ondeinit I have of course MyInterface.Destroy(reason) method.(Mohammad Hossein Sadeghi) I don see a way to change that piece of code.
The Panel has several tabs and windows (see the attach pic) and number of objects are huge, but It is not near 100000 as Mr Dominik Christian Egert suggested. However when I reduce the number of objects by deleting some of tabs, the issue of huge load time when timeframe changes is gone. On the other hand I cannot remove some of the objects from the panel, because to remove any object I have to use Destroy() method, for example MyBuyButton.Destroty(), and when I create that button again using MyBuyButton.Create() the button will no longer attach to the panel, that is, it does move proportionally when I move the panel. (Check my example picture plz)
So I have find no way to solve this issue yet.
Thank you for all your generous comments. I really appreciate it.
First of all I use Dialog library to create this panel, I use CAppDialog to create the main Interface and every object is within the interface and attached to at using MyInterface.Add() method.
In Ondeinit I have of course MyInterface.Destroy(reason) method.(Mohammad Hossein Sadeghi) I don see a way to change that piece of code.
The Panel has several tabs and windows (see the attach pic) and number of objects are huge, but It is not near 100000 as Mr Dominik Christian Egert suggested. However when I reduce the number of objects by deleting some of tabs, the issue of huge load time when timeframe changes is gone. On the other hand I cannot remove some of the objects from the panel, because to remove any object I have to use Destroy() method, for example MyBuyButton.Destroty(), and when I create that button again using MyBuyButton.Create() the button will no longer attach to the panel, that is, it does move proportionally when I move the panel. (Check my example picture plz)
So I have find no way to solve this issue yet.
I had a similar issue once in MT4, so I just used the MT5 controls library and it solved the issue and never got to research more on the issue. Yours already seem to be MT5. May be you could try to see if duplicate objects are being created on initialization ( check objects ) and if so then find the reason.