Is spacing important in Indicators?

 

I'm just learning MT4 and modifying an Indicator from someone else.

I notice that the original author eliminated an awful lot of spaces. Specifically he used

if (Counted_Bars<100)

instead of

if (Counted_Bars < 100)

I think that putting the spaces in makes it easier to read and debug.

I recognize that maybe the compiled file might be smaller with all the spaces removed, but I can't imagine that it makes a difference in the speed when it runs.

Is there any advantage to removing all the spaces?

I also prefer to put a test and action on 2 lines instead of 1 for readability. Is there any advantage to putting them on 1 line?

if (Something==SomethingElse) SomeAction;

instead of


if (Something == SomethingElse)
   SomeAction;

 
It's down to personal preference and what is more readable for you . . . I'm pretty sure that most spaces and all comments are removed during compilation.
 
RaptorUK:
It's down to personal preference and what is more readable for you . . . I'm pretty sure that most spaces and all comments are removed during compilation.
That's what I thought, but I like getting confirmation before I have too much code that might be inefficient.
 
FoxGuy:
That's what I thought, but I like getting confirmation before I have too much code that might be inefficient.

Of course . . . one other thing that helps readability is using variable names that make logical sense . . if often means you can reduce, not eliminate, comments. Try not to use negatives in your variable names . .

For example, DontTradeNow = false; means trade now ! TradeNow = false; and TradeNow = true; seem to be more readable to me.

 
RaptorUK:

Of course . . . one other thing that helps readability is using variable names that make logical sense . . if often means you can reduce, not eliminate, comments. Try not to use negatives in your variable names . .

For example, DontTradeNow = false; means trade now ! TradeNow = false; and TradeNow = true; seem to be more readable to me.

Works for me.
Reason: