Download MetaTrader 5

How important is the use of pointers?

To add comments, please log in or register
Icarus
205
Icarus  

Fellow traders,

I just started to learn about pointers in C++ and memory management. My question is: how important is the use of pointers in MQL5? Did anyone experienced any significant difference, for exemple, in testing an EA?  Was the test performed faster by the use of pointers? Or there was any memory trouble caused by not using pointers?

thanks! 

Alain Verleyen
Moderator
32482
Alain Verleyen  

I can't say nothing about performance, but here are some useful information about pointers : Using the Object Pointers in MQL5 and The Order of Object Creation and Destruction in MQL5

Anyway, mql5 pointers aren't similar to C++ pointers, you can mainly use them with oop and polymorphism.

Icarus
205
Icarus  
angevoyageur:

I can't say nothing about performance, but here are some useful information about pointers : Using the Object Pointers in MQL5 and The Order of Object Creation and Destruction in MQL5

Anyway, mql5 pointers aren't similar to C++ pointers, you can mainly use them with oop and polymorphism.

Thank you, angevoyageur! Great references...

I dont use pointer in MQL5, I just dont see the point of using pointers, because the gain in performance due memory management is not clear to me. Besides, by using pointers I have more potencial troubles, because I am not an experienced programmer, so it is very easy for me to make a mistake.

Alain Verleyen
Moderator
32482
Alain Verleyen  
Icarus:

Thank you, angevoyageur! Great references...

I dont use pointer in MQL5, I just dont see the point of using pointers, because the gain in performance due memory management is not clear to me. Besides, by using pointers I have more potencial troubles, because I am not an experienced programmer, so it is very easy for me to make a mistake.

If you are not an experienced programmer, my advice is "don't worry about pointer". Work without pointer and one day you probably see for yourself when they are needed.
Pasi Hakamaki
5743
Pasi Hakamaki  
angevoyageur:
If you are not an experienced programmer, my advice is "don't worry about pointer". Work without pointer and one day you probably see for yourself when they are needed.
Yes, it is a good advice. I think about it too.
To add comments, please log in or register