Mariner Backtesting - TA-LIB Inverted Hammer

CDLINVERTEDHAMMER

 

 integer = CDLINVERTEDHAMMER(open, high, low, close)

Candlestick Plot

Inverted Hammer

 

Working Example

from cloudquant.interfaces import Strategy
from collections import OrderedDict
import ktgfunc
import talib

class WE_CDLINVERTEDHAMMER(Strategy):

    def on_start(self, md, order, service, account):
        # symbol and timestamp
        print(self.symbol + ":  " + service.time_to_string(service.system_time))
        daily_bars = md.bar.daily(start=-100)
        close = daily_bars.close
        high = daily_bars.high
        low = daily_bars.low
        open = daily_bars.open
        integer = talib.CDLINVERTEDHAMMER(open, high, low, close)

        # get the date values
        dates = service._context.market._storage.market_hours.keys()
        dateList = []
        for date in dates:
           dateList.append(str(date.strftime('%Y-%m-%d')))
        dates = sorted(dateList, reverse=True)[1:101]
        dates.sort()

        dict = OrderedDict()
        dict['date'] = dates
        dict['open'] = open
        dict['high'] = high
        dict['low'] = low
        dict['close'] = close
        dict['integer'] = integer
        symbol = 'CDLINVERTEDHAMMER: ' + self.symbol
        print ktgfunc.talib_table(symbol, 1, dict)

Console

GOOG:  2015-12-23 09:30:00.000000
CDLINVERTEDHAMMER: GOOG
Input Output
date open high low close integer
2015-08-03 625.34 633.06 625.34 631.21 0.00
2015-08-04 628.42 634.81 627.16 629.25 0.00
2015-08-05 634.33 647.86 633.16 643.78 0.00
2015-08-06 645.00 645.38 632.25 642.68 0.00
2015-08-07 640.23 642.68 629.71 635.30 0.00
2015-08-10 639.48 643.44 631.25 633.73 0.00
2015-08-11 669.20 674.90 654.27 660.78 0.00
2015-08-12 663.08 665.00 652.29 659.56 0.00
2015-08-13 659.32 664.50 651.66 656.45 0.00
2015-08-14 655.01 659.85 652.66 657.12 0.00
2015-08-17 656.80 661.38 651.24 660.87 0.00
2015-08-18 661.90 664.00 653.46 656.13 0.00
2015-08-19 656.60 667.00 654.19 660.90 0.00
2015-08-20 655.46 662.99 642.90 646.83 0.00
2015-08-21 639.78 640.05 612.33 612.48 0.00
2015-08-24 573.00 614.00 565.05 589.61 0.00
2015-08-25 614.91 617.45 581.11 582.06 0.00
2015-08-26 610.35 631.71 599.05 628.62 0.00
2015-08-27 639.40 643.59 622.00 637.61 0.00
2015-08-28 632.82 636.88 624.56 630.38 0.00
2015-08-31 627.54 635.80 617.68 618.25 0.00
2015-09-01 602.36 612.86 594.10 597.79 0.00
2015-09-02 605.59 614.34 599.71 614.34 0.00
2015-09-03 617.00 619.71 602.82 606.25 0.00
2015-09-04 600.00 603.47 595.25 600.70 0.00
2015-09-08 612.49 616.31 604.12 614.66 0.00
2015-09-09 621.22 626.52 609.60 612.72 0.00
2015-09-10 613.10 624.16 611.43 621.35 0.00
2015-09-11 619.75 625.78 617.42 625.77 0.00
2015-09-14 625.70 625.86 619.43 623.24 0.00
2015-09-15 626.70 638.70 623.78 635.14 0.00
2015-09-16 635.47 637.95 632.32 635.98 0.00
2015-09-17 637.79 650.90 635.02 642.90 0.00
2015-09-18 636.79 640.00 627.02 629.25 0.00
2015-09-21 634.40 636.49 625.94 635.44 0.00
2015-09-22 627.00 627.55 615.43 622.69 0.00
2015-09-23 622.05 628.93 620.00 622.36 0.00
2015-09-24 616.64 627.32 612.40 625.80 0.00
2015-09-25 629.77 629.77 611.00 611.97 0.00
2015-09-28 610.34 614.60 589.38 594.89 0.00
2015-09-29 597.28 605.00 590.22 594.97 0.00
2015-09-30 603.28 608.76 600.73 608.42 0.00
2015-10-01 608.37 612.09 599.85 611.29 0.00
2015-10-02 607.20 627.34 603.13 626.91 0.00
2015-10-05 632.00 643.01 627.00 641.47 0.00
2015-10-06 638.84 649.25 636.53 645.44 0.00
2015-10-07 649.24 650.61 632.15 642.36 0.00
2015-10-08 641.36 644.45 625.56 639.16 0.00
2015-10-09 640.00 645.99 635.32 643.61 0.00
2015-10-12 642.09 648.50 639.01 646.67 0.00
2015-10-13 643.15 657.81 643.15 652.30 0.00
2015-10-14 653.21 659.39 648.85 651.16 0.00
2015-10-15 654.66 663.13 654.46 661.74 0.00
2015-10-16 664.11 664.97 657.20 662.20 0.00
2015-10-19 661.18 666.82 659.58 666.10 0.00
2015-10-20 664.04 664.72 644.20 650.28 0.00
2015-10-21 654.15 655.87 641.73 642.61 0.00
2015-10-22 646.70 657.80 644.01 651.79 0.00
2015-10-23 727.50 730.00 701.50 702.00 0.00
2015-10-26 701.55 719.15 701.26 712.78 0.00
2015-10-27 707.38 713.62 704.55 708.49 0.00
2015-10-28 707.33 712.98 703.08 712.95 0.00
2015-10-29 710.50 718.26 710.01 716.92 0.00
2015-10-30 715.73 718.00 710.05 710.81 0.00
2015-11-02 711.06 721.62 705.85 721.11 0.00
2015-11-03 718.86 724.65 714.72 722.16 0.00
2015-11-04 722.00 733.10 721.90 728.11 0.00
2015-11-05 729.47 739.48 729.47 731.25 0.00
2015-11-06 731.50 735.41 727.01 733.76 0.00
2015-11-09 730.20 734.71 719.43 724.89 0.00
2015-11-10 724.40 730.59 718.50 728.32 0.00
2015-11-11 732.46 741.00 730.23 735.40 0.00
2015-11-12 731.00 737.80 728.65 731.23 0.00
2015-11-13 729.17 731.15 716.73 717.00 0.00
2015-11-16 715.60 729.49 711.33 728.96 0.00
2015-11-17 729.29 731.84 723.03 725.30 0.00
2015-11-18 727.58 741.41 727.00 740.00 0.00
2015-11-19 738.74 742.00 737.43 738.41 0.00
2015-11-20 746.53 757.92 743.00 756.60 0.00
2015-11-23 757.45 762.71 751.82 755.98 0.00
2015-11-24 752.00 755.28 737.63 748.28 0.00
2015-11-25 748.14 752.00 746.06 748.15 0.00
2015-11-27 748.46 753.41 747.49 750.26 0.00
2015-11-30 748.81 754.93 741.27 742.60 0.00
2015-12-01 747.11 768.95 746.70 767.04 0.00
2015-12-02 768.90 775.96 758.96 762.38 0.00
2015-12-03 766.01 768.99 745.63 752.54 0.00
2015-12-04 753.10 768.49 750.00 766.81 0.00
2015-12-07 767.77 768.73 755.09 763.25 0.00
2015-12-08 757.89 764.80 754.20 762.37 0.00
2015-12-09 759.17 764.23 737.00 751.61 0.00
2015-12-10 752.85 755.85 743.83 749.46 0.00
2015-12-11 741.16 745.71 736.75 738.87 0.00
2015-12-14 741.79 748.73 724.17 747.77 0.00
2015-12-15 753.00 758.08 743.01 743.40 0.00
2015-12-16 750.00 760.59 739.43 758.09 0.00
2015-12-17 762.42 762.68 749.00 749.43 0.00
2015-12-18 746.51 754.13 738.15 739.31 100.00
2015-12-21 746.13 750.00 740.00 747.77 0.00
2015-12-22 751.65 754.85 745.53 750.00 0.00