For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Custom Indicator Arnaud Legoux Moving Average (Vectorised or Nan-Vec): Help Needed



  • Have anyone done an indicator on this that they would be willing to share? I'm interested in both Normal and Vectorised approaches.
    (https://stackoverflow.com/questions/46990098/arnaud-legoux-moving-average-and-numpy)
    I am not experienced in sub-classing/inheritance in Python
    Any help would be highly appreciated. Thx in advance!



  • Anybody has any custom indicator examples which includes numpy calculations? I would be appretiated if you share so i can figure out how to convert the code below.

    def NPALMA(pnp_array, a) :
    
        length = a
        # just some number (6.0 is useful)
        sigma = 6
        # sensisitivity (close to 1) or smoothness (close to 0)
        offset = 0.85
    
        asize = length - 1
        m = offset * asize
        s = length  / sigma
        dss = 2 * s * s
    
        alma = np.zeros(pnp_array.shape)
        wtd_sum = np.zeros(pnp_array.shape)
    
        for l in range(len(pnp_array)):
            if l >= asize:
                for i in range(length):
                    im = i - m
                    wtd = np.exp( -(im * im) / dss)
                    alma[l] += pnp_array[l - length + i] * wtd
                    wtd_sum[l] += wtd
                alma[l] = alma[l] / wtd_sum[l]
    
        return alma
    

Log in to reply
 

});