Mariner Backtesting - TA-LIB Evening Star

CDLEVENINGSTAR

 integer = CDLEVENINGSTAR(open, high, low, close, penetration=0)

Candlestick Plot

Evening Star

 

Working Example

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

class WE_CDLEVENINGSTAR(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.CDLEVENINGSTAR(open, high, low, close, penetration=0)

        # 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 = 'CDLEVENINGSTAR: ' + self.symbol
        print ktgfunc.talib_table(symbol, 1, dict)

Console

GOOG:  2014-05-19 09:30:00.000000
CDLEVENINGSTAR: GOOG
Input Output
date open high low close integer
2013-12-23 284.00 284.00 276.46 279.23 0.00
2013-12-24 280.60 283.21 279.33 279.99 0.00
2013-12-26 283.45 283.50 278.46 278.48 0.00
2013-12-27 279.36 284.23 279.36 283.58 0.00
2013-12-30 362.98 362.98 281.10 283.50 0.00
2013-12-31 569.85 587.28 564.13 569.74 0.00
2014-01-02 574.65 577.77 543.00 543.14 0.00
2014-01-03 540.74 548.48 527.15 538.15 0.00
2014-01-06 542.60 555.00 541.61 554.90 0.00
2014-01-07 559.62 565.37 552.95 564.14 0.00
2014-01-08 565.00 565.00 539.90 540.95 0.00
2014-01-09 532.55 540.00 526.53 530.60 0.00
2014-01-10 538.25 544.10 529.56 532.52 0.00
2014-01-13 535.71 538.45 518.46 536.44 0.00
2014-01-14 543.00 557.00 540.00 556.54 0.00
2014-01-15 548.81 549.50 531.15 536.10 0.00
2014-01-16 536.10 536.70 525.60 528.62 0.00
2014-01-17 528.64 537.23 527.51 534.81 0.00
2014-01-21 533.79 533.87 526.25 526.94 0.00
2014-01-22 529.97 531.65 522.12 525.16 0.00
2014-01-23 522.51 524.70 515.42 516.18 0.00
2014-01-24 517.18 518.48 502.80 517.15 0.00
2014-01-27 516.90 529.46 516.32 527.70 0.00
2014-01-28 527.60 528.00 522.52 526.66 0.00
2014-01-29 527.11 532.93 523.88 531.35 0.00
2014-01-30 533.76 534.00 525.61 527.93 0.00
2014-01-31 524.82 528.90 521.32 527.81 0.00
2014-02-03 525.23 526.81 515.06 515.14 0.00
2014-02-04 515.79 516.68 503.30 509.96 0.00
2014-02-05 508.46 517.23 506.45 511.00 0.00
2014-02-06 510.75 519.90 504.20 519.03 0.00
2014-02-07 523.51 530.19 519.01 529.92 0.00
2014-02-10 530.89 536.07 529.51 533.09 0.00
2014-02-11 533.00 533.00 525.29 526.65 -100.00
2014-02-12 525.70 525.87 517.42 519.98 0.00
2014-02-13 521.39 521.80 515.44 520.63 0.00