Mariner Backtesting - TA-LIB Morning Star

CDLMORNINGSTAR

 integer = CDLMORNINGSTAR(open, high, low, close, penetration=0)
  • 0 = No Signal
  • -100 = Bearish Signal
  • 100 = Bullish Signal

Candlestick Plot

Morning Star

 

Working Example

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

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

Console

GOOG:  2014-06-10 09:30:00.000000
CDLMORNINGSTAR: GOOG
Input Output
date open high low close integer
2014-01-15 284.00 284.00 276.46 279.23 0.00
2014-01-16 280.60 283.21 279.33 279.99 0.00
2014-01-17 283.45 283.50 278.46 278.48 0.00
2014-01-21 279.36 284.23 279.36 283.58 0.00
2014-01-22 362.98 362.98 281.10 283.50 0.00
2014-01-23 569.85 587.28 564.13 569.74 0.00
2014-01-24 574.65 577.77 543.00 543.14 0.00
2014-01-27 540.74 548.48 527.15 538.15 0.00
2014-01-28 542.60 555.00 541.61 554.90 0.00
2014-01-29 559.62 565.37 552.95 564.14 0.00
2014-01-30 565.00 565.00 539.90 540.95 0.00
2014-01-31 532.55 540.00 526.53 530.60 0.00
2014-02-03 538.25 544.10 529.56 532.52 0.00
2014-02-04 535.71 538.45 518.46 536.44 0.00
2014-02-05 543.00 557.00 540.00 556.54 0.00
2014-02-06 548.81 549.50 531.15 536.10 0.00
2014-02-07 536.10 536.70 525.60 528.62 0.00
2014-02-10 528.64 537.23 527.51 534.81 0.00
2014-02-11 533.79 533.87 526.25 526.94 0.00
2014-02-12 529.97 531.65 522.12 525.16 0.00
2014-02-13 522.51 524.70 515.42 516.18 0.00
2014-02-14 517.18 518.48 502.80 517.15 0.00
2014-02-18 516.90 529.46 516.32 527.70 0.00
2014-02-19 527.60 528.00 522.52 526.66 0.00
2014-02-20 527.11 532.93 523.88 531.35 0.00
2014-02-21 533.76 534.00 525.61 527.93 0.00
2014-02-24 524.82 528.90 521.32 527.81 0.00
2014-02-25 525.23 526.81 515.06 515.14 0.00
2014-02-26 515.79 516.68 503.30 509.96 0.00
2014-02-27 508.46 517.23 506.45 511.00 0.00
2014-02-28 510.75 519.90 504.20 519.03 0.00
2014-03-03 523.51 530.19 519.01 529.92 0.00
2014-03-04 530.89 536.07 529.51 533.09 0.00
2014-03-05 533.00 533.00 525.29 526.65 0.00
2014-03-06 525.70 525.87 517.42 519.98 0.00
2014-03-07 521.39 521.80 515.44 520.63 0.00
2014-03-10 519.70 529.78 517.58 528.86 0.00
2014-03-11 529.74 536.23 526.30 529.77 0.00
2014-03-12 532.90 539.18 531.91 538.94 0.00
2014-03-13 541.13 547.60 540.78 545.06 0.00
2014-03-14 547.26 553.64 543.70 552.70 0.00
2014-03-17 556.00 566.00 554.35 565.95 0.00
2014-03-18 564.57 567.84 561.00 561.68 0.00
2014-03-19 563.35 564.00 558.71 560.08 0.00
2014-03-20 560.80 561.35 555.91 560.98 0.00
2014-03-21 560.70 560.90 545.73 553.93 0.00
2014-03-24 550.65 552.34 542.55 544.94 0.00
2014-03-25 541.50 548.61 538.75 544.66 0.00
2014-03-26 546.40 554.95 544.45 553.90 100.00
2014-03-27 558.06 558.06 548.93 556.33 0.00
2014-03-28 557.15 562.90 556.04 562.12 0.00