Indicators: Kirshenbaum bands

 

Kirshenbaum bands:

Short description.

Kirshenbaum bands

Author: Mladen Rakic

Kirshenbaum bands
Kirshenbaum bands
  • www.mql5.com
The Kirshenbaum Bands were authored by Paul Kirshenbaum. Their range is based on standard error as calculated from a hypothetical linear regression line. This range is added to and subtracted from an exponential...
 

Hi Mladen,

I very much respect your work and this is not in any way a criticism, but at line 112 (in the iStdError() function) you have...

      double avgx  = period * (period-1) * 0.5 / period;

Isn't the code below equivalent to it?

     double avgx  =  (period-1) * 0.5;

Which if the original line is correct, should be more concise and faster, especially if it's done

before entering the for() loop, because it doesn't rely on any changes inside the loop. 

I suspect it could be a typo

 
Sorry, meant to write moving the statement out of the function, especially as the period is a global constant...
 

Oh, I see your logic now, how could I have doubted it???

SumX = period * (period-1)/2;

and then to get average X for each idx you divide it by the period.

So, leaving it as you have coded it makes it clearer that avgx is actually the average of SumX.

Sorry to bother you unduly, it's a great indicator.

Best regards, Paul Kelly.

 
please make a file for mt4 too!
Reason: