Mariner Backtesting - TA-LIB Marubozu

CDLMARUBOZU

CDLMARUBOZU

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

Candlestick Plot

Marubozu

 

Working Example

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

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

Console

GOOG:  2014-02-19 09:30:00.000000
CDLMARUBOZU: GOOG
Input Output
date open high low close integer
2013-09-25 886.55 886.55 875.60 877.23 0.00
2013-09-26 878.30 882.75 875.00 878.17 0.00
2013-09-27 874.82 877.52 871.31 876.39 0.00
2013-09-30 869.08 880.84 868.31 875.91 0.00
2013-10-01 880.25 887.67 880.05 887.63 0.00
2013-10-02 882.73 889.35 877.82 887.38 0.00
2013-10-03 888.00 894.10 872.10 876.09 0.00
2013-10-04 875.00 877.51 870.00 872.35 0.00
2013-10-07 867.45 873.99 864.11 865.74 0.00
2013-10-08 865.32 865.98 851.63 853.67 0.00
2013-10-09 856.28 862.65 842.98 855.86 0.00
2013-10-10 863.84 868.83 860.21 868.24 0.00
2013-10-11 866.03 873.48 865.30 871.99 0.00
2013-10-14 866.66 876.25 865.39 875.94 0.00
2013-10-15 875.76 885.63 874.00 882.01 0.00
2013-10-16 885.87 898.33 884.01 897.81 0.00
2013-10-17 892.99 896.90 885.73 889.21 0.00
2013-10-18 976.58 1015.46 974.00 1011.65 0.00
2013-10-21 1011.46 1019.00 999.55 1003.27 0.00
2013-10-22 1005.00 1013.00 995.79 1007.00 0.00
2013-10-23 1001.00 1034.75 1000.63 1031.45 0.00
2013-10-24 1031.87 1040.57 1024.80 1025.55 0.00
2013-10-25 1028.82 1028.82 1010.74 1015.19 0.00
2013-10-28 1015.20 1023.43 1012.98 1015.00 0.00
2013-10-29 1019.10 1036.94 1013.50 1036.24 0.00
2013-10-30 1037.43 1037.51 1026.00 1030.42 0.00
2013-10-31 1028.93 1041.52 1023.97 1030.58 0.00
2013-11-01 1031.79 1036.00 1025.10 1027.04 0.00
2013-11-04 1031.50 1032.37 1022.03 1026.00 0.00
2013-11-05 1020.35 1031.65 1017.42 1021.52 0.00
2013-11-06 1025.60 1027.00 1015.37 1022.75 0.00
2013-11-07 1022.61 1023.93 1007.64 1007.95 -100.00
2013-11-08 1008.75 1018.50 1008.50 1016.03 0.00
2013-11-11 1009.51 1015.93 1008.00 1010.59 0.00
2013-11-12 1007.70 1017.56 1005.00 1011.78 0.00
2013-11-13 1006.75 1032.85 1006.50 1032.47 100.00
2013-11-14 1033.92 1039.75 1030.35 1035.23 0.00
2013-11-15 1034.87 1038.00 1030.31 1033.56 0.00
2013-11-18 1035.75 1048.74 1029.24 1031.55 0.00
2013-11-19 1031.72 1034.75 1023.05 1025.13 0.00
2013-11-20 1029.95 1033.36 1020.36 1022.31 0.00
2013-11-21 1027.00 1038.31 1026.00 1034.07 0.00
2013-11-22 1033.42 1036.17 1029.22 1031.89 0.00
2013-11-25 1037.16 1053.19 1035.02 1045.93 0.00
2013-11-26 1048.60 1061.50 1042.94 1058.41 0.00
2013-11-27 1062.03 1068.00 1060.00 1063.11 0.00
2013-11-29 1062.16 1066.62 1059.45 1059.59 0.00
2013-12-02 1063.51 1066.35 1050.76 1054.48 0.00
2013-12-03 1050.95 1063.44 1049.02 1053.26 0.00
2013-12-04 1051.37 1063.98 1050.00 1058.18 0.00
2013-12-05 1057.20 1059.66 1051.09 1057.34 0.00
2013-12-06 1069.79 1070.00 1060.08 1069.87 0.00
2013-12-09 1070.99 1082.31 1068.02 1078.14 0.00
2013-12-10 1076.15 1092.31 1075.65 1084.66 0.00
2013-12-11 1087.40 1091.32 1075.17 1077.29 0.00
2013-12-12 1079.57 1082.94 1069.00 1069.96 0.00
2013-12-13 1075.40 1076.29 1057.89 1060.79 0.00
2013-12-16 1064.00 1074.69 1062.01 1072.98 0.00
2013-12-17 1072.82 1080.76 1068.38 1069.86 0.00
2013-12-18 1071.85 1084.95 1059.04 1084.75 0.00
2013-12-19 1080.77 1091.99 1079.08 1086.22 0.00
2013-12-20 1088.30 1101.17 1088.00 1100.64 100.00
2013-12-23 1107.84 1115.80 1105.12 1115.10 0.00
2013-12-24 1114.97 1115.24 1108.10 1111.84 0.00
2013-12-26 1114.01 1119.00 1108.69 1117.46 0.00
2013-12-27 1120.00 1120.28 1112.94 1118.40 0.00
2013-12-30 1120.34 1120.50 1109.02 1109.46 -100.00
2013-12-31 1112.24 1121.00 1106.26 1120.71 0.00
2014-01-02 1115.46 1117.75 1108.26 1113.12 0.00
2014-01-03 1115.00 1116.93 1104.93 1105.00 0.00
2014-01-06 1113.01 1118.86 1106.44 1117.32 0.00
2014-01-07 1125.00 1139.69 1121.16 1138.56 0.00
2014-01-08 1146.00 1147.32 1133.29 1141.23 0.00
2014-01-09 1143.44 1144.22 1125.56 1130.24 0.00
2014-01-10 1139.08 1139.08 1122.25 1130.18 0.00
2014-01-13 1126.47 1146.91 1117.17 1122.98 0.00
2014-01-14 1137.95 1151.00 1128.09 1149.40 0.00
2014-01-15 1152.99 1155.00 1143.79 1148.62 0.00
2014-01-16 1149.10 1157.93 1148.00 1156.22 0.00
2014-01-17 1156.85 1160.63 1144.20 1150.53 0.00
2014-01-21 1160.93 1164.00 1151.30 1163.70 0.00
2014-01-22 1166.61 1167.89 1158.86 1165.02 0.00
2014-01-23 1160.00 1162.49 1154.37 1160.10 0.00
2014-01-24 1151.01 1153.55 1123.00 1123.21 0.00
2014-01-27 1126.10 1126.50 1082.27 1101.23 0.00
2014-01-28 1110.32 1125.75 1109.94 1123.01 0.00
2014-01-29 1119.12 1121.75 1099.42 1106.92 0.00
2014-01-30 1145.00 1152.49 1127.25 1133.51 0.00
2014-01-31 1171.35 1186.54 1151.13 1180.97 0.00
2014-02-03 1179.20 1181.72 1132.01 1133.43 0.00
2014-02-04 1137.99 1155.00 1137.01 1138.16 0.00
2014-02-05 1143.38 1150.77 1128.02 1143.20 0.00
2014-02-06 1151.13 1160.16 1147.55 1159.96 0.00
2014-02-07 1167.63 1177.90 1160.56 1177.44 0.00
2014-02-10 1171.80 1182.40 1169.02 1172.93 0.00
2014-02-11 1180.17 1191.87 1172.21 1190.18 0.00
2014-02-12 1189.00 1190.00 1181.38 1186.69 0.00
2014-02-13 1180.75 1199.90 1179.66 1199.90 100.00
2014-02-14 1195.61 1204.39 1192.80 1202.80 0.00
2014-02-18 1201.41 1212.87 1200.00 1210.88 0.00