Mariner Backtesting - TA-LIB Long Legged Doji

CDLLONGLEGGEDDOJI

 

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

Candlestick Plot

Long Legged Doji

 

Working Example

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

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

Console

GOOG:  2014-01-27 09:30:00.000000
CDLLONGLEGGEDDOJI: GOOG
Input Output
date open high low close integer
2013-09-03 854.36 866.19 853.95 860.38 0.00
2013-09-04 860.35 873.50 855.17 871.85 0.00
2013-09-05 873.50 879.88 871.61 879.56 0.00
2013-09-06 882.44 883.78 873.74 879.58 0.00
2013-09-09 883.73 889.75 882.42 887.88 0.00
2013-09-10 890.00 892.00 884.00 888.67 0.00
2013-09-11 888.54 896.97 886.08 896.19 0.00
2013-09-12 897.40 897.90 890.01 893.30 0.00
2013-09-13 894.50 895.68 884.84 888.24 0.00
2013-09-16 896.20 897.00 884.87 887.76 0.00
2013-09-17 887.41 888.40 881.00 886.11 0.00
2013-09-18 886.35 903.97 883.07 903.32 0.00
2013-09-19 905.99 905.99 895.40 898.39 0.00
2013-09-20 898.39 904.13 895.62 903.31 0.00
2013-09-23 896.15 901.59 885.20 886.50 0.00
2013-09-24 886.50 890.10 881.40 886.84 100.00
2013-09-25 886.55 886.55 875.60 877.23 0.00
2013-09-26 878.30 882.75 875.00 878.17 100.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 100.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 100.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 100.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 100.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 0.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 100.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 0.00
2013-11-14 1033.92 1039.75 1030.35 1035.23 100.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 100.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 100.00
2013-12-06 1069.79 1070.00 1060.08 1069.87 100.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 0.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 0.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 100.00
2014-01-23 1160.00 1162.49 1154.37 1160.10 100.00
2014-01-24 1151.01 1153.55 1123.00 1123.21 0.00