Problem with ChartRedraw() in MQL5

 

Sorry for my bad English.

I built an expert in mql4 that creates more than 200 objects on chart and in 'onchartevent' event and 'ontimer' event change the objects properties like width, height, color and...

it works like a charm in mt4 without using of ChartRedraw() or WindowRedraw() functions.


after migrating to mt5, everything is ok, just updating objects properties works with a long delay.

by adding ChartRedraw() function at the end of 'onchartevent' and end of 'ontimer' event and set the timer in milliseconds for increasing chart redraw rate, it becomes very better. but not completely solved. everything is more faster in mt4.

by using ChartRedraw() function more, the expert becomes slower. what is wrong with mt5? why it can works faster in mt4? how can i solve it?

 
any idea?
 
Mohammad Nikdan:
any idea?

Idea about what ?

All I can say is : fix your code. There is nothing wrong with MT5, it's just not MT4.

 
Alain Verleyen:

Idea about what ?

All I can say is : fix your code. There is nothing wrong with MT5, it's just not MT4.

it is meaning MT4 is faster than MT5? 
 
m.nik:
it is meaning MT4 is faster than MT5? 

No. Just that the code has to be written "the mt5 way" - no simple copy-paste of what is floating for mt4 on the net for ages any more

 
Alain Verleyen #:

Idea about what ?

All I can say is : fix your code. There is nothing wrong with MT5, it's just not MT4.

ChartRedrow works very slow at MT5 . You can test it in profiling. At my indicator there are 2 parts UI and data calculation. Profiling at mt4 shows that calculation of data takes 90% of CPU and 10% UI. It's normal work. But profiling at MT5 shows that drawing primitives UI takes 90% of CPU and interface is blinking. It's needed to fix drawing processor at MT5.

 
Alain Verleyen #:

Idea about what ?

All I can say is : fix your code. There is nothing wrong with MT5, it's just not MT4.

There is a problem with mt5 Chartredraw is actually slow and you can test this for yourself. I'm calling for example one chartredraw everytime a drag custom event occurs(if an object is selected and mouse leftclick clicked and event is mouse_move) basically calling Chartredraw as rarely as possible and its still lagging. In Mt4 the exact same program without using chartredraw is running smoothly and you can not see any lagging. I checked the task manager and mt4 actually uses a higher percentage of CPU power than mt5, so this may be the problem, for which I did not find the solution yet.

 
Peter Mueller #:

There is a problem with mt5 Chartredraw is actually slow and you can test this for yourself. I'm calling for example one chartredraw everytime a drag custom event occurs(if an object is selected and mouse leftclick clicked and event is mouse_move) basically calling Chartredraw as rarely as possible and its still lagging. In Mt4 the exact same program without using chartredraw is running smoothly and you can not see any lagging. I checked the task manager and mt4 actually uses a higher percentage of CPU power than mt5, so this may be the problem, for which I did not find the solution yet.

I can only repeat my previous answer, you can be sure I test all myself.

Forum on trading, automated trading systems and testing trading strategies

Problem with ChartRedraw() in MQL5

Alain Verleyen, 2019.09.20 15:53

Idea about what ?

All I can say is : fix your code. There is nothing wrong with MT5, it's just not MT4.

MT5 is NOT working as MT4. Show your code if you need coding help.
Reason: