CDLUPSIDEGAP2CROWS(open, high, low, close)
CDLUPSIDEGAP2CROWS
integer = CDLUPSIDEGAP2CROWS(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_CDLUPSIDEGAP2CROWS(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.CDLUPSIDEGAP2CROWS(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 = 'CDLUPSIDEGAP2CROWS: ' + self.symbol
print ktgfunc.talib_table(symbol, 1, dict)
Console
YHOO: 2015-04-15 09:30:00.000000
CDLUPSIDEGAP2CROWS: YHOO | |||||
---|---|---|---|---|---|
Input | Output | ||||
date | open | high | low | close | integer |
2014-11-18 | 52.28 | 52.62 | 51.34 | 51.75 | 0.00 |
2014-11-19 | 51.24 | 51.37 | 50.00 | 50.58 | 0.00 |
2014-11-20 | 50.60 | 52.23 | 50.27 | 51.25 | 0.00 |
2014-11-21 | 51.99 | 52.25 | 50.99 | 51.04 | 0.00 |
2014-11-24 | 51.25 | 51.83 | 51.07 | 51.83 | 0.00 |
2014-11-25 | 52.00 | 52.19 | 51.60 | 51.72 | 0.00 |
2014-11-26 | 51.56 | 52.26 | 51.52 | 51.93 | 0.00 |
2014-11-28 | 51.87 | 52.00 | 51.64 | 51.74 | 0.00 |
2014-12-01 | 51.51 | 51.51 | 49.66 | 50.10 | 0.00 |
2014-12-02 | 50.27 | 51.12 | 50.01 | 50.67 | 0.00 |
2014-12-03 | 50.71 | 50.97 | 50.20 | 50.28 | 0.00 |
2014-12-04 | 50.19 | 50.67 | 49.90 | 50.41 | 0.00 |
2014-12-05 | 51.03 | 51.25 | 50.51 | 50.99 | 0.00 |
2014-12-08 | 50.52 | 50.90 | 49.22 | 49.62 | 0.00 |
2014-12-09 | 48.75 | 50.53 | 48.29 | 50.51 | 0.00 |
2014-12-10 | 50.33 | 50.69 | 49.19 | 49.21 | 0.00 |
2014-12-11 | 49.54 | 50.58 | 49.43 | 49.94 | 0.00 |
2014-12-12 | 49.54 | 51.17 | 49.48 | 50.24 | 0.00 |
2014-12-15 | 50.42 | 50.92 | 49.50 | 49.82 | 0.00 |
2014-12-16 | 49.50 | 50.08 | 48.81 | 48.85 | 0.00 |
2014-12-17 | 49.02 | 50.25 | 48.90 | 50.12 | 0.00 |
2014-12-18 | 50.93 | 51.15 | 50.44 | 50.91 | 0.00 |
2014-12-19 | 51.06 | 51.47 | 50.83 | 50.88 | -100.00 |
2014-12-22 | 50.99 | 51.60 | 50.95 | 51.15 | 0.00 |
2014-12-23 | 51.46 | 51.46 | 49.93 | 50.02 | 0.00 |
2014-12-24 | 50.19 | 50.92 | 50.19 | 50.65 | 0.00 |
2014-12-26 | 50.65 | 51.06 | 50.61 | 50.86 | 0.00 |
2014-12-29 | 50.67 | 51.01 | 50.51 | 50.53 | 0.00 |
2014-12-30 | 50.35 | 51.27 | 50.35 | 51.22 | 0.00 |
2014-12-31 | 51.54 | 51.68 | 50.46 | 50.51 | 0.00 |
2015-01-02 | 50.66 | 50.78 | 49.47 | 50.17 | 0.00 |
2015-01-05 | 49.71 | 49.88 | 48.91 | 49.13 | 0.00 |
2015-01-06 | 49.20 | 49.73 | 48.33 | 49.21 | 0.00 |
2015-01-07 | 49.62 | 49.64 | 48.51 | 48.59 | 0.00 |
2015-01-08 | 48.99 | 50.23 | 48.72 | 50.23 | 0.00 |
2015-01-09 | 50.28 | 50.41 | 49.62 | 49.72 | 0.00 |
2015-01-12 | 49.92 | 49.93 | 48.56 | 48.80 | 0.00 |
2015-01-13 | 49.15 | 49.48 | 47.40 | 48.30 | 0.00 |
2015-01-14 | 48.40 | 48.40 | 47.07 | 47.51 | 0.00 |
2015-01-15 | 47.54 | 47.75 | 46.20 | 46.23 | 0.00 |
2015-01-16 | 46.06 | 46.59 | 45.85 | 46.47 | 0.00 |
2015-01-20 | 46.79 | 47.89 | 46.77 | 47.63 | 0.00 |
2015-01-21 | 47.71 | 48.38 | 47.32 | 48.18 | 0.00 |
2015-01-22 | 48.43 | 49.08 | 48.01 | 48.89 | 0.00 |
2015-01-23 | 48.74 | 49.23 | 48.63 | 48.95 | 0.00 |
2015-01-26 | 49.57 | 49.79 | 49.07 | 49.44 | 0.00 |
2015-01-27 | 49.14 | 49.28 | 47.66 | 47.99 | 0.00 |
2015-01-28 | 49.80 | 50.32 | 46.30 | 46.46 | 0.00 |
2015-01-29 | 43.56 | 43.80 | 41.80 | 43.73 | 0.00 |
2015-01-30 | 43.73 | 44.85 | 43.51 | 43.99 | 0.00 |
2015-02-02 | 44.43 | 44.76 | 43.88 | 44.69 | 0.00 |
2015-02-03 | 45.10 | 45.25 | 44.38 | 44.70 | 0.00 |
2015-02-04 | 44.80 | 44.97 | 43.88 | 44.04 | 0.00 |
2015-02-05 | 44.08 | 44.26 | 43.03 | 43.54 | 0.00 |
2015-02-06 | 43.57 | 43.66 | 42.67 | 42.94 | 0.00 |
2015-02-09 | 42.61 | 43.15 | 42.54 | 42.57 | 0.00 |
2015-02-10 | 42.90 | 43.17 | 42.66 | 43.07 | 0.00 |
2015-02-11 | 43.18 | 43.26 | 42.76 | 42.96 | 0.00 |
2015-02-12 | 43.07 | 44.16 | 42.86 | 43.92 | 0.00 |
2015-02-13 | 44.12 | 44.59 | 44.00 | 44.42 | 0.00 |
2015-02-17 | 44.37 | 44.54 | 43.35 | 43.53 | 0.00 |
2015-02-18 | 43.56 | 43.82 | 43.30 | 43.65 | 0.00 |
2015-02-19 | 43.65 | 44.42 | 43.50 | 44.37 | 0.00 |
2015-02-20 | 44.30 | 44.36 | 43.76 | 44.11 | 0.00 |
2015-02-23 | 43.99 | 43.99 | 43.42 | 43.53 | 0.00 |
2015-02-24 | 43.45 | 43.52 | 42.91 | 43.38 | 0.00 |
2015-02-25 | 43.21 | 44.72 | 43.21 | 44.43 | 0.00 |
2015-02-26 | 44.60 | 44.76 | 44.26 | 44.45 | 0.00 |
2015-02-27 | 44.38 | 44.57 | 44.04 | 44.28 | 0.00 |
2015-03-02 | 44.06 | 44.43 | 43.70 | 44.11 | 0.00 |
2015-03-03 | 43.70 | 43.95 | 42.42 | 42.62 | 0.00 |
2015-03-04 | 42.08 | 44.38 | 41.97 | 43.99 | 0.00 |
2015-03-05 | 44.18 | 44.31 | 43.50 | 44.16 | 0.00 |
2015-03-06 | 43.98 | 44.24 | 43.40 | 43.44 | 0.00 |
2015-03-09 | 43.60 | 43.93 | 42.67 | 42.98 | 0.00 |
2015-03-10 | 42.57 | 42.92 | 42.18 | 42.67 | 0.00 |
2015-03-11 | 42.77 | 42.99 | 42.36 | 42.50 | 0.00 |
2015-03-12 | 42.70 | 43.36 | 42.58 | 42.95 | 0.00 |
2015-03-13 | 42.84 | 42.98 | 42.44 | 42.87 | 0.00 |
2015-03-16 | 42.93 | 43.88 | 42.75 | 43.51 | 0.00 |
2015-03-17 | 43.69 | 44.16 | 43.46 | 43.78 | 0.00 |
2015-03-18 | 43.58 | 44.71 | 43.43 | 44.67 | 0.00 |
2015-03-19 | 44.90 | 45.45 | 44.81 | 44.98 | 0.00 |
2015-03-20 | 45.37 | 45.58 | 44.91 | 45.03 | 0.00 |
2015-03-23 | 48.75 | 48.75 | 44.71 | 44.72 | 0.00 |
2015-03-24 | 44.64 | 44.78 | 44.28 | 44.42 | 0.00 |
2015-03-25 | 44.59 | 44.93 | 44.13 | 44.20 | 0.00 |
2015-03-26 | 43.78 | 44.67 | 43.68 | 44.47 | 0.00 |
2015-03-27 | 45.20 | 45.67 | 45.01 | 45.10 | 0.00 |
2015-03-30 | 45.36 | 45.42 | 44.81 | 44.95 | 0.00 |
2015-03-31 | 44.82 | 45.20 | 44.42 | 44.44 | 0.00 |
2015-04-01 | 44.45 | 44.60 | 43.95 | 44.13 | 0.00 |
2015-04-02 | 44.24 | 44.36 | 43.68 | 44.15 | 0.00 |
2015-04-06 | 43.82 | 44.03 | 43.61 | 43.67 | 0.00 |
2015-04-07 | 43.79 | 44.22 | 43.56 | 43.61 | 0.00 |
2015-04-08 | 43.86 | 45.19 | 43.80 | 45.17 | 0.00 |
2015-04-09 | 45.70 | 46.17 | 45.16 | 45.63 | 0.00 |
2015-04-10 | 45.79 | 45.79 | 45.00 | 45.18 | -100.00 |
2015-04-13 | 45.25 | 45.59 | 44.72 | 44.77 | 0.00 |
2015-04-14 | 44.82 | 45.64 | 44.79 | 45.53 | 0.00 |