Mariner Backtesting - TA-LIB Breakaway

CDLBREAKAWAY

 

 integer = CDLBREAKAWAY(open, high, low, close)
Return Codes
  • 0 = No Signal
  • -100 = Bearish Signal
  • 100 = Bullish Signal

Candlestick Plot

Breakaway

Working Example

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

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

Console

YHOO:  2016-07-28 09:30:00.000000
CDLBREAKAWAY: YHOO
Input Output
date open high low close integer
2016-03-07 33.68 34.38 33.59 33.96 0.00
2016-03-08 33.66 33.82 32.84 32.93 0.00
2016-03-09 33.09 33.52 32.78 33.51 0.00
2016-03-10 33.59 33.60 32.09 32.82 0.00
2016-03-11 33.29 33.86 32.83 33.81 0.00
2016-03-14 33.75 34.08 33.51 33.58 0.00
2016-03-15 33.32 33.46 33.11 33.26 0.00
2016-03-16 33.03 34.08 33.00 34.01 0.00
2016-03-17 33.88 34.55 33.87 34.28 0.00
2016-03-18 34.54 35.21 34.38 35.17 0.00
2016-03-21 35.00 36.10 35.00 35.47 0.00
2016-03-22 34.68 35.61 34.68 35.41 0.00
2016-03-23 35.43 35.69 34.71 34.80 0.00
2016-03-24 34.45 34.87 33.93 34.86 0.00
2016-03-28 35.39 35.45 34.62 35.23 0.00
2016-03-29 35.05 36.43 35.01 36.32 0.00
2016-03-30 36.61 37.28 36.44 36.56 0.00
2016-03-31 36.51 37.02 36.50 36.81 0.00
2016-04-01 36.54 36.88 36.31 36.48 0.00
2016-04-04 36.55 37.50 36.54 37.02 0.00
2016-04-05 36.70 36.92 36.22 36.41 0.00
2016-04-06 36.40 37.00 36.31 36.66 0.00
2016-04-07 35.86 37.25 35.72 36.17 0.00
2016-04-08 36.85 36.92 35.62 36.07 0.00
2016-04-11 36.38 36.85 36.32 36.48 0.00
2016-04-12 36.65 36.83 36.28 36.66 0.00
2016-04-13 36.94 37.35 36.90 37.31 0.00
2016-04-14 37.47 37.50 36.85 37.17 0.00
2016-04-15 37.13 37.15 36.42 36.51 0.00
2016-04-18 36.24 37.00 35.88 36.52 0.00
2016-04-19 36.46 36.73 36.11 36.33 0.00
2016-04-20 37.10 38.19 37.00 37.84 0.00
2016-04-21 37.92 38.12 37.35 37.67 0.00
2016-04-22 37.50 38.09 37.16 37.48 0.00
2016-04-25 37.47 37.54 37.18 37.23 0.00
2016-04-26 37.32 37.54 36.91 37.11 0.00
2016-04-27 37.52 37.59 36.63 36.95 0.00
2016-04-28 36.84 37.44 36.51 36.59 0.00
2016-04-29 36.51 36.98 36.15 36.60 0.00
2016-05-02 36.65 36.74 36.32 36.53 0.00
2016-05-03 36.25 36.41 35.91 36.01 0.00
2016-05-04 35.81 36.09 35.74 36.00 0.00
2016-05-05 37.06 37.45 36.86 36.94 0.00
2016-05-06 36.55 37.31 36.49 37.23 0.00
2016-05-09 36.97 37.35 36.92 37.18 0.00
2016-05-10 37.17 37.58 37.14 37.44 0.00
2016-05-11 37.28 37.63 37.20 37.37 0.00
2016-05-12 37.39 37.51 36.79 37.03 0.00
2016-05-13 36.91 37.07 36.38 36.48 0.00
2016-05-16 37.03 37.79 36.88 37.48 0.00
2016-05-17 37.44 37.70 37.25 37.27 0.00
2016-05-18 37.09 37.50 36.89 37.24 0.00
2016-05-19 36.94 37.23 36.67 37.02 0.00
2016-05-20 36.05 36.72 35.35 36.50 0.00
2016-05-23 36.46 36.94 36.43 36.66 0.00
2016-05-24 36.85 37.63 36.77 37.53 0.00
2016-05-25 36.63 36.96 35.47 35.59 0.00
2016-05-26 36.13 36.85 36.07 36.76 0.00
2016-05-27 36.88 37.88 36.84 37.82 0.00
2016-05-31 37.73 38.08 37.50 37.94 0.00
2016-06-01 37.25 37.74 36.56 36.65 0.00
2016-06-02 36.66 37.22 36.58 37.15 0.00
2016-06-03 37.11 37.11 36.50 36.60 0.00
2016-06-06 36.67 37.20 36.52 37.07 0.00
2016-06-07 36.90 36.99 36.62 36.73 0.00
2016-06-08 36.84 37.29 36.84 36.97 0.00
2016-06-09 36.82 37.73 36.71 37.35 0.00
2016-06-10 36.97 37.14 36.59 36.83 0.00
2016-06-13 36.70 36.91 36.42 36.47 0.00
2016-06-14 36.63 37.44 36.63 37.40 0.00
2016-06-15 37.43 37.60 37.10 37.32 0.00
2016-06-16 37.39 37.45 36.54 37.39 0.00
2016-06-17 37.43 37.44 36.81 36.94 0.00
2016-06-20 37.27 37.68 37.24 37.29 0.00
2016-06-21 37.37 37.55 37.20 37.40 0.00
2016-06-22 37.37 37.52 37.17 37.36 0.00
2016-06-23 37.64 37.78 37.41 37.78 0.00
2016-06-24 36.40 36.95 36.08 36.24 0.00
2016-06-27 35.87 36.01 35.05 35.22 0.00
2016-06-28 35.58 36.14 35.50 36.04 0.00
2016-06-29 36.25 37.08 36.25 36.86 0.00
2016-06-30 36.89 37.58 36.89 37.56 0.00
2016-07-01 37.56 38.08 37.43 37.99 0.00
2016-07-05 37.68 37.77 37.17 37.50 0.00
2016-07-06 37.43 37.56 37.13 37.51 0.00
2016-07-07 37.57 37.76 37.29 37.52 0.00
2016-07-08 37.53 37.84 37.06 37.74 0.00
2016-07-11 37.44 38.15 37.37 37.96 0.00
2016-07-12 38.00 38.33 37.87 37.89 0.00
2016-07-13 37.99 38.00 37.10 37.64 0.00
2016-07-14 37.85 38.35 37.85 37.96 0.00
2016-07-15 38.16 38.19 37.68 37.72 0.00
2016-07-18 37.68 37.97 37.50 37.95 0.00
2016-07-19 37.77 38.49 37.65 38.17 0.00
2016-07-20 38.36 38.93 38.26 38.90 0.00
2016-07-21 39.01 39.25 38.72 38.85 0.00
2016-07-22 38.90 39.42 38.78 39.38 0.00
2016-07-25 39.10 39.21 38.22 38.32 -100.00
2016-07-26 38.07 38.83 37.90 38.76 0.00
2016-07-27 38.66 38.77 38.43 38.66 0.00