Should I use constant or value of the constant?

 
Hi, I am a novice as you can see.

If I want the EA to trade only on daily chart

should I use the constant as below

if (Period() == PERIOD_D1)

or should use the value as below

if (Period() == 1440)

Both seem to do the trick but don't know which is the proper way to do it. Thanks



 
 


Got it thanks a lot. I guess either one is fine....is it better to just put 1440 so the preprocessor does even need to get involved, or probably it really makes not difference?

 
wwwin:


Got it thanks a lot. I guess either one is fine....is it better to just put 1440 so the preprocessor does even need to get involved, or probably it really makes not difference?

The preprocessor will be 'involved' whether u like it or not. But it's involved only when u compile your program, not when u r running it.

It's good programming practice to use enumerations instead of the value (many reasons: makes code clearer, value can be changed centrally, etc.) and is recommended by most programmers.

 
Got it, many thanks, will use enumerations.
Reason: