Heiken Ashi Using pandas python

前端 未结 7 2085
南方客
南方客 2021-01-31 23:23

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

7条回答
  •  面向向阳花
    2021-01-31 23:42

    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
    

提交回复
热议问题