can I write time() function

 

I'm new to MT4.

Is there any reason I should not write a "time()" function (lower case "t")? I'm tired of writing "NULL", all the time.

datetime time(int iBar, int pTimeFrame = 0)
   {
      if (pTimeFrame == 0)
         return Time[iBar];
      else
         return iTime(NULL, pTimeFrame, iBar);
   }
 
FoxGuy:

I'm new to MT4.

Is there any reason I should not write a "time()" function (lower case "t")?

As far as I can see, two reasons that may well not matter to you . . .

  1. code readability for other people
  2. if you code gets to be time critical it will be a little slower

. . you did say "any" reason ;-)
 

I can only suggest to use a better readable function name like:

getTimeOfBar(int iBar,int pTimeFrame=0, string symbol=NULL){

 //

}
You keep the possiblity of using different timeframes/symbols, but you don't have to if not needed
An no, generally you could name your function time. 
Reason: