How to use the hikyuu.indicator.PRICELIST function in hikyuu

To help you get started, we’ve selected a few hikyuu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fasiondog / hikyuu / tools / hikyuu / interactive / elder.py View on Github external
def _draw_ema_pipe(axes, kdata, ema, n=22, w=0.10):
    emas = [i for i in ema]
    p = _find_ema_coefficient(list(CLOSE(kdata)), emas, number=66, percent=0.95) if w=='auto' else w
    emas_high = [i+i*p for i in emas]
    emas_low = [i-i*p for i in emas]
    emas_len = len(emas)
    
    PRICELIST(emas).plot(axes=axes, color='b', linestyle='-', label='%s(%s)  %.2f'%(ema.name, n, emas[-1]))
    PRICELIST(emas_high).plot(axes=axes, color='b', linestyle=':', label='U%s(%.2f%%) %.2f'%(ema.name, p*100, emas_high[-1]))
    PRICELIST(emas_low).plot(axes=axes, color='b', linestyle=':', label='L%s(%.2f%%) %.2f'%(ema.name, p*100, emas_low[-1]))
    #axes.plot(emas, '-b', label='%s(%s)  %.2f'%(ema.name, n, emas[-1]))
    #axes.plot(emas_high, ':b', label='U%s(%.2f%%) %.2f'%(ema.name, p*100, emas_high[-1]))
    #axes.plot(emas_low, ':b', label='L%s(%.2f%%) %.2f'%(ema.name, p*100, emas_low[-1]))
    fy1 = [ i for i in emas_low]
    fy2 = [ i for i in emas_high]
    axes.fill_between(range(emas_len),fy1,fy2,alpha=0.2, color='y' )
github fasiondog / hikyuu / hikyuu / interactive / elder.py View on Github external
def _draw_ema_pipe(axes, kdata, ema, n=22, w=0.10):
    emas = [i for i in ema]
    p = _find_ema_coefficient(list(CLOSE(kdata)), emas, number=66, percent=0.95) if w=='auto' else w
    emas_high = [i+i*p for i in emas]
    emas_low = [i-i*p for i in emas]
    emas_len = len(emas)
    
    PRICELIST(emas).plot(axes=axes, color='b', linestyle='-', label='%s(%s)  %.2f'%(ema.name, n, emas[-1]))
    PRICELIST(emas_high).plot(axes=axes, color='b', linestyle=':', label='U%s(%.2f%%) %.2f'%(ema.name, p*100, emas_high[-1]))
    PRICELIST(emas_low).plot(axes=axes, color='b', linestyle=':', label='L%s(%.2f%%) %.2f'%(ema.name, p*100, emas_low[-1]))
    #axes.plot(emas, '-b', label='%s(%s)  %.2f'%(ema.name, n, emas[-1]))
    #axes.plot(emas_high, ':b', label='U%s(%.2f%%) %.2f'%(ema.name, p*100, emas_high[-1]))
    #axes.plot(emas_low, ':b', label='L%s(%.2f%%) %.2f'%(ema.name, p*100, emas_low[-1]))
    fy1 = [ i for i in emas_low]
    fy2 = [ i for i in emas_high]
    axes.fill_between(range(emas_len),fy1,fy2,alpha=0.2, color='y' )
github fasiondog / hikyuu / hikyuu / interactive / elder.py View on Github external
def _draw_ema_pipe(axes, kdata, ema, n=22, w=0.10):
    emas = [i for i in ema]
    p = _find_ema_coefficient(list(CLOSE(kdata)), emas, number=66, percent=0.95) if w=='auto' else w
    emas_high = [i+i*p for i in emas]
    emas_low = [i-i*p for i in emas]
    emas_len = len(emas)
    
    PRICELIST(emas).plot(axes=axes, color='b', linestyle='-', label='%s(%s)  %.2f'%(ema.name, n, emas[-1]))
    PRICELIST(emas_high).plot(axes=axes, color='b', linestyle=':', label='U%s(%.2f%%) %.2f'%(ema.name, p*100, emas_high[-1]))
    PRICELIST(emas_low).plot(axes=axes, color='b', linestyle=':', label='L%s(%.2f%%) %.2f'%(ema.name, p*100, emas_low[-1]))
    #axes.plot(emas, '-b', label='%s(%s)  %.2f'%(ema.name, n, emas[-1]))
    #axes.plot(emas_high, ':b', label='U%s(%.2f%%) %.2f'%(ema.name, p*100, emas_high[-1]))
    #axes.plot(emas_low, ':b', label='L%s(%.2f%%) %.2f'%(ema.name, p*100, emas_low[-1]))
    fy1 = [ i for i in emas_low]
    fy2 = [ i for i in emas_high]
    axes.fill_between(range(emas_len),fy1,fy2,alpha=0.2, color='y' )
github fasiondog / hikyuu / hikyuu / interactive / kaufman.py View on Github external
fast_op = AMA(n = n)
        slow_op = EMA(n = 2*n)(fast_op)
        sg = SG_Cross(fast_op, slow_op)
        sg.plot(axes = ax1, kdata = kdata)
        ind = slow_op(kdata)
        ind.name = "EMA(CAMA)"
        ind.plot(axes = ax1, color = 'm', legend_on = True)
                 
    elif sg_type == 'SINGLE':
        sg = SG_Single(cama, filter_n = filter_n, filter_p = filter_p)
        sg.plot(axes = ax1, kdata = kdata)

    else:
        print("sg_type only in ('CORSS', 'SINGLE')")
 
    cer = PRICELIST(cama, 1)
    label = "ER(%s)" % cer[-1]
    cer.plot(axes=ax2, color='b', marker='o', label=label, 
             legend_on=False, text_on=True)
    
    total = len(kdata)
    CVAL(0.8, total).plot(axes=ax2,color='r',linestyle='--')
    CVAL(-0.6, total).plot(axes=ax2,color='r',linestyle='--')
    CVAL(-0.8, total).plot(axes=ax2,color='r',linestyle='--')
    CVAL(0, total).plot(axes=ax2,color='k',linestyle='-')
    #ax2.hlines(0.8,0,len(kdata),color='r',linestyle='--')    
    #ax2.hlines(-0.6,0,len(kdata),color='r',linestyle='--')
    #ax2.hlines(-0.8,0,len(kdata),color='r',linestyle='--')
    #ax2.hlines(0,0,len(kdata))
    
    ax1.set_xlim((0, len(kdata)))
    ax_set_locator_formatter(ax1, kdata.getDatetimeList(), query.kType)
github fasiondog / hikyuu / tools / hikyuu / interactive / elder.py View on Github external
def _draw_ema_pipe(axes, kdata, ema, n=22, w=0.10):
    emas = [i for i in ema]
    p = _find_ema_coefficient(list(CLOSE(kdata)), emas, number=66, percent=0.95) if w=='auto' else w
    emas_high = [i+i*p for i in emas]
    emas_low = [i-i*p for i in emas]
    emas_len = len(emas)
    
    PRICELIST(emas).plot(axes=axes, color='b', linestyle='-', label='%s(%s)  %.2f'%(ema.name, n, emas[-1]))
    PRICELIST(emas_high).plot(axes=axes, color='b', linestyle=':', label='U%s(%.2f%%) %.2f'%(ema.name, p*100, emas_high[-1]))
    PRICELIST(emas_low).plot(axes=axes, color='b', linestyle=':', label='L%s(%.2f%%) %.2f'%(ema.name, p*100, emas_low[-1]))
    #axes.plot(emas, '-b', label='%s(%s)  %.2f'%(ema.name, n, emas[-1]))
    #axes.plot(emas_high, ':b', label='U%s(%.2f%%) %.2f'%(ema.name, p*100, emas_high[-1]))
    #axes.plot(emas_low, ':b', label='L%s(%.2f%%) %.2f'%(ema.name, p*100, emas_low[-1]))
    fy1 = [ i for i in emas_low]
    fy2 = [ i for i in emas_high]
    axes.fill_between(range(emas_len),fy1,fy2,alpha=0.2, color='y' )
github fasiondog / hikyuu / tools / hikyuu / interactive / elder.py View on Github external
def _draw_ema_pipe(axes, kdata, ema, n=22, w=0.10):
    emas = [i for i in ema]
    p = _find_ema_coefficient(list(CLOSE(kdata)), emas, number=66, percent=0.95) if w=='auto' else w
    emas_high = [i+i*p for i in emas]
    emas_low = [i-i*p for i in emas]
    emas_len = len(emas)
    
    PRICELIST(emas).plot(axes=axes, color='b', linestyle='-', label='%s(%s)  %.2f'%(ema.name, n, emas[-1]))
    PRICELIST(emas_high).plot(axes=axes, color='b', linestyle=':', label='U%s(%.2f%%) %.2f'%(ema.name, p*100, emas_high[-1]))
    PRICELIST(emas_low).plot(axes=axes, color='b', linestyle=':', label='L%s(%.2f%%) %.2f'%(ema.name, p*100, emas_low[-1]))
    #axes.plot(emas, '-b', label='%s(%s)  %.2f'%(ema.name, n, emas[-1]))
    #axes.plot(emas_high, ':b', label='U%s(%.2f%%) %.2f'%(ema.name, p*100, emas_high[-1]))
    #axes.plot(emas_low, ':b', label='L%s(%.2f%%) %.2f'%(ema.name, p*100, emas_low[-1]))
    fy1 = [ i for i in emas_low]
    fy2 = [ i for i in emas_high]
    axes.fill_between(range(emas_len),fy1,fy2,alpha=0.2, color='y' )
github fasiondog / hikyuu / hikyuu / interactive / elder.py View on Github external
def _draw_ema_pipe(axes, kdata, ema, n=22, w=0.10):
    emas = [i for i in ema]
    p = _find_ema_coefficient(list(CLOSE(kdata)), emas, number=66, percent=0.95) if w=='auto' else w
    emas_high = [i+i*p for i in emas]
    emas_low = [i-i*p for i in emas]
    emas_len = len(emas)
    
    PRICELIST(emas).plot(axes=axes, color='b', linestyle='-', label='%s(%s)  %.2f'%(ema.name, n, emas[-1]))
    PRICELIST(emas_high).plot(axes=axes, color='b', linestyle=':', label='U%s(%.2f%%) %.2f'%(ema.name, p*100, emas_high[-1]))
    PRICELIST(emas_low).plot(axes=axes, color='b', linestyle=':', label='L%s(%.2f%%) %.2f'%(ema.name, p*100, emas_low[-1]))
    #axes.plot(emas, '-b', label='%s(%s)  %.2f'%(ema.name, n, emas[-1]))
    #axes.plot(emas_high, ':b', label='U%s(%.2f%%) %.2f'%(ema.name, p*100, emas_high[-1]))
    #axes.plot(emas_low, ':b', label='L%s(%.2f%%) %.2f'%(ema.name, p*100, emas_low[-1]))
    fy1 = [ i for i in emas_low]
    fy2 = [ i for i in emas_high]
    axes.fill_between(range(emas_len),fy1,fy2,alpha=0.2, color='y' )
github fasiondog / hikyuu / hikyuu / interactive / kaufman.py View on Github external
a = POS(block, query, SG_Flex(AMA(n = 3), 6))
    a.name = "POS(3)"
    a.plot(axes=ax2, color='b', marker='.', legend_on=True)
    a = POS(block, query, SG_Flex(AMA(n = 30), 60))
    a.name = "POS(30)"
    a.plot(axes=ax2, color='g', marker='.', legend_on=True)
    
    total = len(kdata)
    CVAL(0.8, total).plot(axes=ax2,color='r',linestyle='--')
    CVAL(0.2, total).plot(axes=ax2,color='r',linestyle='--')
    #ax2.hlines(0.8,0,len(kdata),color='r',linestyle='--')    
    #ax2.hlines(0.2,0,len(kdata),color='r',linestyle='--')
    
    if ama1.name == "AMA":
        cer = PRICELIST(cama, 1)
        label = "ER(%s)" % cer[-1]
        cer.plot(axes=ax3, color='b', marker='.', label=label, 
                 legend_on=False, text_on=True)
        CVAL(0.8, total).plot(axes=ax2,color='r',linestyle='--')
        CVAL(-0.6, total).plot(axes=ax2,color='r',linestyle='--')
        CVAL(-0.8, total).plot(axes=ax2,color='r',linestyle='--')
        CVAL(0, total).plot(axes=ax2,color='k',linestyle='-')
        #ax3.hlines(0.8,0,len(kdata),color='r',linestyle='--')    
        #ax3.hlines(-0.6,0,len(kdata),color='r',linestyle='--')
        #ax3.hlines(-0.8,0,len(kdata),color='r',linestyle='--')
        #ax3.hlines(0,0,len(kdata))
    else:
        ax_draw_macd(ax2, kdata)
    #ax2.set_ylim(-1, 1)
    
    ax1.set_xlim((0, len(kdata)))