MQL4 - automated forex trading   /  

Forum

Argument passimg in MQL4

Back to topics list To post a new topic, please log in or register

avatar
16
karan 2006.04.21 20:49 
I know C/C++ and find the syntax of MQL4 to be compatible with C, However there are annoying differences such as not being able to do a pre decrement operator (--pos), etc.

How do you pass arguments to functions that modify the arguments. In C you can use pointers and in C++ you can additionally use a ref type. Is there any equivalent in MQL4?

A Pattern Trailing Stop and Exit the Market

A Pattern Trailing Stop and Exit the Market

Developers of order modification/closing algorithms suffer from an imperishable woe - how to compare results obtained by different methods? The mechanism of checking is well known - it is Strategy Tester. But how to make an EA to work equally for opening/closing orders? The article describes a tool that provides strong repetition of order openings that allows us to maintain a mathematically correct platform to compare the results of different algorithms for trailing stops and for exiting the market.


avatar
30
CockeyedCowboy 2006.04.22 03:23 
karan:
I know C/C++ and find the syntax of MQL4 to be compatible with C, However there are annoying differences such as not being able to do a pre decrement operator (--pos), etc.

How do you pass arguments to functions that modify the arguments. In C you can use pointers and in C++ you can additionally use a ref type. Is there any equivalent in MQL4?
use the '&' symbol in your parameter descriptions at the function level. Example

void MyFunction( int& count )
{
count = count + 1;
return;
}

What ever argument you pass this function it will get incrimented by one.

avatar
16
karan 2006.04.22 05:17 

use the '&' symbol in your parameter descriptions at the function level. Example

void MyFunction( int& count )
{
count = count + 1;
return;
}

What ever argument you pass this function it will get incrimented by one.
Thanks. Looks like they use the C++ ref syntax.
Back to topics list  

To add comments, please log in or register