joshuaulrich / TTR

Technical analysis and other functions to construct technical trading rules with R
GNU General Public License v2.0
326 stars 102 forks source link

stoch: lower bound incorrect with bounded=FALSE #74

Closed rfinfun closed 3 years ago

rfinfun commented 5 years ago

Hi Joshua, In: https://github.com/joshuaulrich/TTR/blob/master/R/stochastics.R

Line 152ff:

  if(bounded) {
    hmax <- runMax(high, nFastK)
    lmin <- runMin( low, nFastK)
  } else {
    hmax <- runMax(c(high[1],high[-NROW(HLC)]), nFastK)
    lmin <- runMax(c( low[1], low[-NROW(HLC)]), nFastK)  #  this is the line!!!
  }

It should be

    lmin <- runMin(c( low[1], low[-NROW(HLC)]), nFastK)  #  this is the line!!!

I stumbled over this just by looking at the code. No testing was performed. Thanks for the great package. I just started studying it.

Regards, A.

joshuaulrich commented 3 years ago

Yep, this is certainly a bug. Ugh. Sorry it took me so long to address it!