Loading objects in MT5 takes a lot of time.

 
Hello everyone, I created a dashboard with lot of objects, when it loads in MT4 it loads in just a blink, the same file when loads in MT5 takes about 10 to 20 sec (in different computer) to load on the chart, when I reduce number of objects it gets faster, but I need all the objects, Does anyone come to the same issue?  is there a solution for that? 
Thank for any response in advance.
(I don't know why Metaquote makes things harder in MT5, while it is upgraded version and things must be more easier.)
 
Fatemeh Ameri:
Hello everyone, I created a dashboard with lot of objects, when it loads in MT4 it loads in just a blink, the same file when loads in MT5 takes about 10 to 20 sec (in different computer) to load on the chart, when I reduce number of objects it gets faster, but I need all the objects, Does anyone come to the same issue?  is there a solution for that? 
Thank for any response in advance.
(I don't know why Metaquote makes things harder in MT5, while it is upgraded version and things must be more easier.)

Try ChartRedraw() after creating all the objects.

 
Keith Watford #:

Try ChartRedraw() after creating all the objects.

I have that code after creating all objects, but not working, should I have that line of code after each object creation?

 
Fatemeh Ameri:
Hello everyone, I created a dashboard with lot of objects, when it loads in MT4 it loads in just a blink, the same file when loads in MT5 takes about 10 to 20 sec (in different computer) to load on the chart, when I reduce number of objects it gets faster, but I need all the objects, Does anyone come to the same issue?  is there a solution for that? 
Thank for any response in advance.
(I don't know why Metaquote makes things harder in MT5, while it is upgraded version and things must be more easier.)

If you are tracking the creation of new objects , mouse move , clicks or chart change etc in Chart Events , gate the interactions until the deck is ready .

If you have hidden objects that act as screens (or tabs) waiting to popup once the user requests them , you don't need to .

If all else fails , switch to a bmp resource gui . It will look better as well.

That been said , it should not be so slow . Something is looking for an object that isn't there or you are stuck in a recursion loop with tracking new objects and chart changing.

 
Fatemeh Ameri #:

I have that code after creating all objects, but not working, should I have that line of code after each object creation?

You should only need to use ChartRedraw() once unless you are doing something else in your code between creating objects.

You really need to show your code if you want help.

 

I have removed a number of posts and replies to those posts.

The posts made absolutely no sense and were just confusing the issue.

I apologise to those people who had freely given their time and replied to the posts and now find that their replies have been deleted.

 
Lorentzos Roussos #:

If you are tracking the creation of new objects , mouse move , clicks or chart change etc in Chart Events , gate the interactions until the deck is ready .

If you have hidden objects that act as screens (or tabs) waiting to popup once the user requests them , you don't need to .

If all else fails , switch to a bmp resource gui . It will look better as well.

That been said , it should not be so slow . Something is looking for an object that isn't there or you are stuck in a recursion loop with tracking new objects and chart changing.

Thanks for your helpful response.

you said "it should not be so slow . Something is looking for an object that isn't there or you are stuck in a recursion loop with tracking new objects and chart changing."
But same code in MT4 take about seconds to load on chart, how can we interpret this?

 
Fatemeh Ameri #:

Thanks for your helpful response.

you said "it should not be so slow . Something is looking for an object that isn't there or you are stuck in a recursion loop with tracking new objects and chart changing."
But same code in MT4 take about seconds to load on chart, how can we interpret this?

Are you using the controls library ?

What types of objects are these ? and how many.

Try loading your panels (or objects) on timer , let init go through with initialization . Load up one timer and use it once .

Its an indicator ?

One type of recursion i had created by mistake was on mt5 , i had a script that detected screen resizing to refit the panels and i had not gated it if(SystemReady&&!SystemBusy) (these would be your variables) . So i was infinitely accessing that function 

 
Lorentzos Roussos #:

Are you using the controls library ?

What types of objects are these ? and how many.

Try loading your panels (or objects) on timer , let init go through with initialization . Load up one timer and use it once .

Its an indicator ?

One type of recursion i had created by mistake was on mt5 , i had a script that detected screen resizing to refit the panels and i had not gated it if(SystemReady&&!SystemBusy) (these would be your variables) . So i was infinitely accessing that function 

Yes I use control libraries. What about them?
I use almost all types, buttons, Bmps, Rectangles, Edits...
I try loading loading initialization both in OnTimer and OnTick, but same bad results.
It is not an indicator, it is a Trading Dashboard. I attached a file showing the out look of my panel.

I am not sure how can I can I gate the issue and fine it. But I know it works very well in MT4 but not MT5, There must have been a solution.

Files:
mydasbh.png  204 kb
 
One thing you could check that comes to mind is, are you creating objects and then accessing/reading some of their values with ObjectGet*() ?

If so, try checking if you could go without querying them. Reason is, an ObjectCreate will get queued in a queue for asynchronous processing. So the ObjectGet needs to wait for all abjects to be created first.

If that's not the issue, then try figuring out where the code is stalling by using GetMicrosecondcount() and print out the time every command needs.

This way you can find the bottlenecks and work your way around them.

Btw, I found out, sometimes ChartGet*() takes a long time to return, somewhat 200ms or more.

So also this could hinder your performance.
 
Fatemeh Ameri #:

Yes I use control libraries. What about them?
I use almost all types, buttons, Bmps, Rectangles, Edits...
I try loading loading initialization both in OnTimer and OnTick, but same bad results.
It is not an indicator, it is a Trading Dashboard. I attached a file showing the out look of my panel.

I am not sure how can I can I gate the issue and fine it. But I know it works very well in MT4 but not MT5, There must have been a solution.

Nice work .

What Dominik said , you might be checking their size , try alternatives like TextGetSize etc , usually you would querry for font fitting or positioning .

Or comment out all the read operations .

Does this controls library have a "render" function of some sort ?

Can you hide them upon creation ? and show them all at once at the end ?

How many objects are there , i will try to recreate the issue . 

Comment out the equivalent of this in your version 

void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   ExtDialog.ChartEvent(id,lparam,dparam,sparam);
  }
Reason: