PINE LIBRARY

rate_of_change

125
Library "rate_of_change"

// description: Applies ROC algorithm to any pair of values.
// This library function is used to scale change of value (price, volume) to a percentage value, just as the ROC indicator would do. It is good practice to scale arbitrary ranges to set boundaries when you try to train statistical model.

rateOfChange(value, base, hardlimit)
  This function is a helper to scale a value change to its percentage value.
  Parameters:
    value (float)
    base (float)
    hardlimit (int)
  Returns: per: A float comprised between 0 and 100

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.