CDLSEPARATINGLINES
integer = CDLSEPARATINGLINES(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_CDLSEPARATINGLINES(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.CDLSEPARATINGLINES(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 = 'CDLSEPARATINGLINES: ' + self.symbol
print ktgfunc.talib_table(symbol, 1, dict)
Console
GOOG: 2014-05-02 09:30:00.000000
CDLSEPARATINGLINES: GOOG | |||||
---|---|---|---|---|---|
Input | Output | ||||
date | open | high | low | close | integer |
2013-12-06 | 284.00 | 284.00 | 276.46 | 279.23 | 0.00 |
2013-12-09 | 280.60 | 283.21 | 279.33 | 279.99 | 0.00 |
2013-12-10 | 283.45 | 283.50 | 278.46 | 278.48 | 0.00 |
2013-12-11 | 279.36 | 284.23 | 279.36 | 283.58 | 0.00 |
2013-12-12 | 362.98 | 362.98 | 281.10 | 283.50 | 0.00 |
2013-12-13 | 569.85 | 587.28 | 564.13 | 569.74 | 0.00 |
2013-12-16 | 574.65 | 577.77 | 543.00 | 543.14 | 0.00 |
2013-12-17 | 540.74 | 548.48 | 527.15 | 538.15 | 0.00 |
2013-12-18 | 542.60 | 555.00 | 541.61 | 554.90 | 0.00 |
2013-12-19 | 559.62 | 565.37 | 552.95 | 564.14 | 0.00 |
2013-12-20 | 565.00 | 565.00 | 539.90 | 540.95 | 0.00 |
2013-12-23 | 532.55 | 540.00 | 526.53 | 530.60 | 0.00 |
2013-12-24 | 538.25 | 544.10 | 529.56 | 532.52 | 0.00 |
2013-12-26 | 535.71 | 538.45 | 518.46 | 536.44 | 0.00 |
2013-12-27 | 543.00 | 557.00 | 540.00 | 556.54 | 0.00 |
2013-12-30 | 548.81 | 549.50 | 531.15 | 536.10 | 0.00 |
2013-12-31 | 536.10 | 536.70 | 525.60 | 528.62 | 0.00 |
2014-01-02 | 528.64 | 537.23 | 527.51 | 534.81 | 0.00 |
2014-01-03 | 533.79 | 533.87 | 526.25 | 526.94 | 0.00 |
2014-01-06 | 529.97 | 531.65 | 522.12 | 525.16 | 0.00 |
2014-01-07 | 522.51 | 524.70 | 515.42 | 516.18 | 0.00 |
2014-01-08 | 517.18 | 518.48 | 502.80 | 517.15 | 0.00 |
2014-01-09 | 516.90 | 529.46 | 516.32 | 527.70 | 100.00 |
2014-01-10 | 527.60 | 528.00 | 522.52 | 526.66 | 0.00 |
2014-01-13 | 527.11 | 532.93 | 523.88 | 531.35 | 0.00 |