for(int i=Bars-1; i>=0; i--)
Are you trying to avoid 0 divide?
Is v3 a line buffer ?
At the beginning of the indicator there might not be a value for iMA(), in which case iMA() would return zero. You would not usually want to assign that zero to an indicator line because it would be an erroneous value that would cause the line to dip thousands of pips down to zero. To avoid that you would leave that buffer index unassigned because its default value is the special constant EMPTY_VALUE at which no line will be drawn.
The zero comparison is probably more of a boots and braces error prevention than an absolute neccessity. The key is to understand what happens if any zeros do get assigned to a line buffer that is following prices, such as a MA. The result is very undesireable.
To add comments, please log in or register