CDLINNECK
integer = CDLINNECK(open, high, low, close)
- 0 = No Signal
- -100 = Bearish Signal
- 100 = Bullish Signal
Candlestick Plot
Working Example
from cloudquant.interfaces import Strategy
from collections import OrderedDict
import ktgfunc
import talib
class WE_CDLINNECK(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.CDLINNECK(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 = 'CDLINNECK: ' + self.symbol
print ktgfunc.talib_table(symbol, 1, dict)
Console
GOOG: 2016-05-23 09:30:00.000000
CDLINNECK: GOOG | |||||
---|---|---|---|---|---|
Input | Output | ||||
date | open | high | low | close | integer |
2015-12-29 | 766.69 | 779.98 | 766.43 | 776.60 | 0.00 |
2015-12-30 | 776.60 | 777.60 | 766.90 | 771.00 | 0.00 |
2015-12-31 | 769.50 | 769.50 | 758.34 | 758.88 | 0.00 |
2016-01-04 | 743.00 | 744.06 | 731.26 | 741.84 | 0.00 |
2016-01-05 | 746.45 | 752.00 | 738.64 | 742.58 | 0.00 |
2016-01-06 | 730.00 | 747.18 | 728.92 | 743.62 | 0.00 |
2016-01-07 | 730.31 | 738.50 | 719.06 | 726.39 | 0.00 |
2016-01-08 | 731.45 | 733.23 | 713.00 | 714.47 | 0.00 |
2016-01-11 | 716.61 | 718.85 | 703.54 | 716.03 | 0.00 |
2016-01-12 | 721.68 | 728.75 | 717.32 | 726.07 | 0.00 |
2016-01-13 | 730.20 | 734.74 | 698.61 | 700.56 | 0.00 |
2016-01-14 | 705.38 | 721.92 | 689.10 | 714.72 | 0.00 |
2016-01-15 | 692.29 | 706.74 | 685.37 | 694.45 | 0.00 |
2016-01-19 | 703.30 | 709.98 | 693.41 | 701.79 | 0.00 |
2016-01-20 | 688.61 | 706.85 | 673.26 | 698.45 | 0.00 |
2016-01-21 | 702.18 | 719.19 | 694.46 | 706.59 | 0.00 |
2016-01-22 | 723.60 | 728.13 | 720.12 | 725.25 | 0.00 |
2016-01-25 | 723.58 | 729.68 | 710.01 | 711.67 | 0.00 |
2016-01-26 | 713.85 | 718.28 | 706.48 | 713.04 | 0.00 |
2016-01-27 | 713.67 | 718.23 | 694.39 | 699.99 | 0.00 |
2016-01-28 | 722.22 | 733.69 | 712.35 | 730.96 | 0.00 |
2016-01-29 | 731.53 | 744.99 | 726.80 | 742.95 | 0.00 |
2016-02-01 | 750.46 | 757.86 | 743.27 | 752.00 | 0.00 |
2016-02-02 | 784.50 | 789.87 | 764.65 | 764.65 | 0.00 |
2016-02-03 | 770.22 | 774.50 | 720.50 | 726.95 | 0.00 |
2016-02-04 | 722.81 | 727.00 | 701.86 | 708.01 | 0.00 |
2016-02-05 | 703.87 | 703.99 | 680.15 | 683.57 | 0.00 |
2016-02-08 | 667.85 | 684.03 | 663.06 | 682.74 | 0.00 |
2016-02-09 | 672.32 | 699.90 | 668.77 | 678.11 | 0.00 |
2016-02-10 | 686.86 | 701.31 | 682.13 | 684.12 | 0.00 |
2016-02-11 | 675.00 | 689.35 | 668.87 | 683.11 | 0.00 |
2016-02-12 | 690.26 | 693.75 | 678.60 | 682.40 | 0.00 |
2016-02-16 | 692.98 | 698.00 | 685.05 | 691.00 | 0.00 |
2016-02-17 | 699.00 | 709.75 | 691.38 | 708.40 | 0.00 |
2016-02-18 | 710.00 | 712.35 | 696.03 | 697.35 | 0.00 |
2016-02-19 | 695.03 | 703.08 | 694.05 | 700.91 | 0.00 |
2016-02-22 | 707.45 | 713.24 | 702.51 | 706.46 | 0.00 |
2016-02-23 | 701.45 | 708.40 | 693.58 | 695.85 | 0.00 |
2016-02-24 | 688.92 | 700.00 | 680.78 | 699.56 | 0.00 |
2016-02-25 | 700.01 | 705.98 | 690.59 | 705.75 | 0.00 |
2016-02-26 | 708.58 | 713.43 | 700.86 | 705.07 | 0.00 |
2016-02-29 | 700.32 | 710.89 | 697.68 | 697.77 | 0.00 |
2016-03-01 | 703.62 | 718.81 | 699.77 | 718.81 | 0.00 |
2016-03-02 | 719.00 | 720.00 | 712.00 | 718.85 | 0.00 |
2016-03-03 | 718.68 | 719.45 | 706.02 | 712.42 | 0.00 |
2016-03-04 | 714.99 | 716.49 | 706.02 | 710.89 | 0.00 |
2016-03-07 | 706.90 | 708.09 | 686.90 | 695.16 | 0.00 |
2016-03-08 | 688.59 | 703.79 | 685.34 | 693.97 | 0.00 |
2016-03-09 | 698.47 | 705.68 | 694.00 | 705.24 | 0.00 |
2016-03-10 | 708.12 | 716.44 | 703.36 | 712.82 | 0.00 |
2016-03-11 | 720.00 | 726.92 | 717.12 | 726.82 | 0.00 |
2016-03-14 | 726.81 | 735.50 | 725.15 | 730.49 | 0.00 |
2016-03-15 | 726.92 | 732.29 | 724.77 | 728.33 | 0.00 |
2016-03-16 | 726.37 | 737.47 | 724.51 | 736.09 | 0.00 |
2016-03-17 | 736.45 | 743.07 | 736.00 | 737.78 | 0.00 |
2016-03-18 | 741.86 | 742.00 | 731.83 | 737.60 | 0.00 |
2016-03-21 | 736.50 | 742.50 | 733.52 | 742.09 | 0.00 |
2016-03-22 | 737.46 | 745.00 | 737.46 | 740.75 | 0.00 |
2016-03-23 | 742.36 | 745.72 | 736.15 | 738.06 | 0.00 |
2016-03-24 | 732.01 | 737.75 | 731.00 | 735.30 | 0.00 |
2016-03-28 | 736.79 | 738.99 | 732.50 | 733.53 | 0.00 |
2016-03-29 | 734.59 | 747.25 | 728.76 | 744.77 | 0.00 |
2016-03-30 | 750.10 | 757.88 | 748.74 | 750.53 | 0.00 |
2016-03-31 | 749.25 | 750.85 | 740.94 | 744.95 | 0.00 |
2016-04-01 | 738.60 | 750.34 | 737.00 | 749.91 | 0.00 |
2016-04-04 | 750.06 | 752.80 | 742.43 | 745.29 | 0.00 |
2016-04-05 | 738.00 | 742.80 | 735.37 | 737.80 | 0.00 |
2016-04-06 | 735.77 | 746.24 | 735.56 | 745.69 | 0.00 |
2016-04-07 | 745.37 | 747.00 | 736.28 | 740.28 | 0.00 |
2016-04-08 | 743.97 | 745.45 | 735.55 | 739.15 | 0.00 |
2016-04-11 | 743.02 | 745.00 | 736.05 | 736.10 | 0.00 |
2016-04-12 | 738.00 | 743.83 | 731.01 | 743.09 | 0.00 |
2016-04-13 | 749.16 | 754.38 | 744.26 | 751.72 | 0.00 |
2016-04-14 | 754.01 | 757.31 | 752.71 | 753.20 | 0.00 |
2016-04-15 | 753.98 | 761.00 | 752.69 | 759.00 | 0.00 |
2016-04-18 | 760.46 | 768.05 | 757.30 | 766.61 | 0.00 |
2016-04-19 | 769.51 | 769.90 | 749.33 | 753.93 | 0.00 |
2016-04-20 | 758.00 | 758.13 | 750.01 | 752.67 | 0.00 |
2016-04-21 | 755.38 | 760.45 | 749.55 | 759.14 | 0.00 |
2016-04-22 | 726.30 | 736.12 | 713.61 | 718.77 | 0.00 |
2016-04-25 | 716.10 | 723.93 | 715.59 | 723.15 | 0.00 |
2016-04-26 | 725.42 | 725.77 | 703.03 | 708.14 | 0.00 |
2016-04-27 | 707.29 | 708.98 | 692.37 | 705.84 | 0.00 |
2016-04-28 | 708.26 | 714.17 | 689.55 | 691.02 | 0.00 |
2016-04-29 | 690.70 | 697.62 | 689.00 | 693.01 | 0.00 |
2016-05-02 | 697.63 | 700.64 | 691.00 | 698.21 | 0.00 |
2016-05-03 | 696.87 | 697.84 | 692.00 | 692.36 | 0.00 |
2016-05-04 | 690.49 | 699.75 | 689.01 | 695.70 | 0.00 |
2016-05-05 | 697.70 | 702.32 | 695.72 | 701.43 | 0.00 |
2016-05-06 | 698.38 | 711.86 | 698.11 | 711.12 | 0.00 |
2016-05-09 | 712.00 | 718.71 | 710.00 | 712.90 | 0.00 |
2016-05-10 | 716.75 | 723.50 | 715.72 | 723.18 | 0.00 |
2016-05-11 | 723.41 | 724.48 | 712.80 | 715.29 | 0.00 |
2016-05-12 | 717.06 | 719.25 | 709.00 | 713.31 | 0.00 |
2016-05-13 | 711.93 | 716.66 | 709.26 | 710.83 | 0.00 |
2016-05-16 | 709.13 | 718.48 | 705.65 | 716.49 | 0.00 |
2016-05-17 | 715.99 | 721.52 | 704.11 | 706.23 | 0.00 |
2016-05-18 | 703.67 | 711.60 | 700.63 | 706.63 | -100.00 |
2016-05-19 | 702.36 | 706.00 | 696.80 | 700.32 | 0.00 |
2016-05-20 | 701.62 | 714.58 | 700.52 | 709.74 | 0.00 |