can we use Pointers like in C plus plus
Results 1 to 9 of 9

Thread: can we use Pointers like in C plus plus

  1. #1
    Hey everyone,

    Simple question for several of the developers here...

    are we able to use pointers in MQL4 like in C.. . You know like if we desired to pass a variable through to a egy so that we wouldn t have to alter the process everytime...

    If so ... whats the syntax cause * and ain t doin it for me

    Thank you

  2. #2
    Not allowed
    ps: pass the variable in the parm series
    iRtn - SomeFunction(parm1, two,etc)

    int SomeFunction(parm1, two,etc)


  3. #3
    Thank you kenz,

    not sure what your trying to say after but I'm convinced its an alternative... could you elaborate a bit... does anyone know another way to do this?

  4. #4
    Or use globals whose scope is the whole indior, or if you are passing from one indi.
    The parm method I showed is standard factor passing technique. I expect one of the developers here will make me wrong and show a way to utilize pointers but that is what I use and it works.

  5. #5
    Ken Thank you for the suggestion;

    I'm ashamed to say that I still do not understand that your parm method could you provide a brief example? Are you saying your pasing a series? Do I put it as the variable within the function?

    THanks again for your help

  6. #6
    Quote Originally Posted by ;
    Ken Thank you for the suggestion;

    I'm embarrassed to say that I don't understand that your parm method could you provide a brief example? Are you saying that your pasing a string? Can I set it as the variable within the work?
    What are you trying to perform? Your post was quite uncertain.

    Do you wish to pass variables by reference? This can be achieved:

    Inserted Code void foobar(int foo, double pub#91;#93;-RRB- foo = 42; pub#91;two #93; = 3; int start() int a; double sided#91;100#93;; foobar(a, b); // fill the variables Print(a); Print(b#91;two#93;-RRB-;
    Or are you attempting to get workouts?

    Do you wish to implement callbacks or even pass complete roles about like closures? This isn't feasible. MQL is a language missing most of the helpful characteristics.

  7. #7
    Hey 7 Little...

    I was trying to get function pointers but what you gave me is pretty much the same thing... Ken if this is what you meant, works great for what I am using it to Get...

    Thanks guys

  8. #8
    Thanks 7bit. I always have trouble with the call by reference, those little thingys. It's best to find samples and learn from them. There is sample code in the trading systems section, and on forex tsd, and code base.

  9. #9
    Quote Originally Posted by ;
    Thanks . I have difficulty with the call these thingys, by reference. Learn from them and it's best to come across samples.
    This syntax is not cited in the MQL4 reference, at least not in the functions section in which it might belong. I discovered it by accident while looking into the aid for a few of the array works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners more information