Download MetaTrader 5

Vairable variables

To add comments, please log in or register
I am creating a function to 'push' a value in to an array so that when I call the function like:

ArrayPush(Double <VALUE>,  Double <ARRAY>)

This function will move all of the values in the array along one entering <VALUE> at [0].

The question is this: Is it possible in MQL4 to NOT declare data types in the function declaration so that this function will work the same with arrays of type datetime, double, int....etc.... or is it necessary to have a near duplicate function for each data type?

So instead of:
void function ArrayPushDbl(Double <VALUE>,  Double <ARRAY>[]){}
void function ArrayPushDT(datetime <VALUE>,  datetime <ARRAY>[]){}
void function ArrayPushInt(int <VALUE>,  int <ARRAY>[]){}

I could just have something like:
void function ArrayPush(mixed <VALUE>,  mixed <ARRAY>[]){}

(void because array are passed by reference so there is nothing to return....)
To add comments, please log in or register