code: def hurst_exp(p, minLags, maxLags):
      tau = []
      lagvec = []
  
      #  Step through the different lags
      for lag in range(minLags, maxLags):
          #  produce price difference with lag
          pp = np.subtract(p[lag:], p[:-lag])
          #  Write the different lags into a vector
          lagvec.append(lag)
          #  Calculate the variance of the differnce vector
          tau.append(np.sqrt(np.std(pp)))
      # linear fit to double-log graph (gives power)
      m = np.polyfit(np.log10(lagvec), np.log10(tau), 1)
      # calculate hurst
      hurst = m[0] * 2
      return hurst
  
file_path: pyalgotrade/pyalgotrade/technical/hurst.py
imports: import numpy
  from pyalgotrade import technical
label_desc: Use image node_id 1 for calling a global function with example usage: hurst_exp(p, minLags, maxLags) and returns: hurst