Indicators: Kirshenbaum bands

To add comments, please log in or register
Automated-Trading
148243
Automated-Trading  

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...
Paul Kelly
13
Paul Kelly  

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

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

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.

Revo Trades
99
Revo Trades  
please make a file for mt4 too!
To add comments, please log in or register