How to pass a callBack function as parameter for another function? and pointers? (correct syntax plz)
ivanez: Someone knows how to do it?
- You posted Data Types - Language Basics - MQL4 Reference. Why didn't you click on the sub-page
User-defined Types?
-
Added support for pointers to functions to simplify the arrangement of event models.
List of changes in MetaTrader 5 Client Terminal builds - MetaTrader 4 - General - MQL5 programming forum - Page 17 ? 20 2016.04.20 - Pointers to Functions - Fiscal Policy - MQL4 and MetaTrader 4 - MQL4 programming forum
- Language Basics /
Data Types / User-defined Types - Reference on algorithmic/automated
trading language for MetaTrader 5
User-defined Types - Data Types - Language Basics - MQL4 Reference
-
-
Why did you post your MT4 question in the
Root /
MT5 Indicators
section
instead of the MQL4 section,
(bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon.
William Roeder:
- You posted Data Types - Language Basics - MQL4 Reference. Why didn't you click on the sub-page User-defined Types?
-
Why did you post your MT4 question in the
Root /
MT5 Indicators
section
instead of the MQL4 section,
(bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon.
Thank you very much for your help, Mr. William. That's just what I was looking for.
I am sorry about my post in the wrong place. I'm new here and I'm a little lost. I've only been programming for two weeks at MQL and I still can not see the differences between the two versions.
I am programming in MQL4 because Metatrader 5 does not work on my computer (Windows 8.1).
I have tried to install the program from several sources always with the same result (Crash). And I've been reading that a lot of people can not make the program run properly either.
Thank you so much !!
typedef int (*TFunc)(int, int); int add(int x, int y) { return x + y; } int multiply(int x, int y) { return x * y; } int doWork(TFunc callback) { return callback(3, 3); } void OnStart(){ Print(doWork(add)); Print(doWork(multiply)); }
nicholi shen:
Thank you so much!!

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I want to do this
and this too
But it doesn't works in MQL.
I was reading the Data Types Reference but i found nothing about it.
Data Types - Language Basics - MQL4 Reference Data Types - Language Basics - MQL4 Reference
https://docs.mql4.com/basis/types
Someone knows how to do it?