Is it possible to overwrite predefined variables with my own functions?

 

Hi,


in MQL4, is it possible to overwrite standard predefined variables like Open/Close etc. by my own functions like in this example?


double Bid()
{
    return MarketInfo(symbol, MODE_BID);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Ask()
{
    return MarketInfo(symbol, MODE_ASK);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
datetime Time(int bar)
{
    return iTime(symbol, period, bar);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Open(int bar)
{
    return iOpen(symbol, period, bar);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double High(int bar)
{
    return iHigh(symbol, period, bar);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Low(int bar)
{
    return iLow(symbol, period, bar);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Close(int bar)
{
    return iClose(symbol, period, bar);
}

The MQL4 compiler doesn´t complain when doing this, I am just not sure if it works. I wanted to do it this way for a multi-pair-trading EA.


Thanks.

 
You are not “overwrite standard predefined variables” You are creating functions. Bid and Bid() are two different things, as will be High[i] and High(i).
 
Thanks, I´ve noticed that it works, great.