I was defining a function Heiken Ashi which is one of the popular chart type in Technical Analysis. I was writing a function on it using Pandas but finding little difficulty. T
Will be faster with numpy.
def HEIKIN(O, H, L, C, oldO, oldC): HA_Close = (O + H + L + C)/4 HA_Open = (oldO + oldC)/2 elements = numpy.array([H, L, HA_Open, HA_Close]) HA_High = elements.max(0) HA_Low = elements.min(0) out = numpy.array([HA_Close, HA_Open, HA_High, HA_Low]) return out