CDLSTALLEDPATTERN(open, high, low, close)
CDLSTALLEDPATTERN
integer = CDLSTALLEDPATTERN(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_CDLSTALLEDPATTERN(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.CDLSTALLEDPATTERN(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 = 'CDLSTALLEDPATTERN: ' + self.symbol
print ktgfunc.talib_table(symbol, 1, dict)
Console
GOOG: 2015-03-04 09:30:00.000000
CDLSTALLEDPATTERN: GOOG | |||||
---|---|---|---|---|---|
Input | Output | ||||
date | open | high | low | close | integer |
2014-10-08 | 564.99 | 573.90 | 557.43 | 572.50 | 0.00 |
2014-10-09 | 570.88 | 571.49 | 559.06 | 560.88 | 0.00 |
2014-10-10 | 557.72 | 565.13 | 544.05 | 544.49 | 0.00 |
2014-10-13 | 544.99 | 549.50 | 533.10 | 533.21 | 0.00 |
2014-10-14 | 538.90 | 547.19 | 533.00 | 537.94 | 0.00 |
2014-10-15 | 531.10 | 532.89 | 518.30 | 530.03 | 0.00 |
2014-10-16 | 519.00 | 529.43 | 515.00 | 524.51 | 0.00 |
2014-10-17 | 527.25 | 531.00 | 508.42 | 511.17 | 0.00 |
2014-10-20 | 509.45 | 521.76 | 508.01 | 520.84 | 0.00 |
2014-10-21 | 525.22 | 526.79 | 519.11 | 526.54 | 0.00 |
2014-10-22 | 529.64 | 539.80 | 528.80 | 532.71 | 0.00 |
2014-10-23 | 539.32 | 547.22 | 535.85 | 543.98 | 0.00 |
2014-10-24 | 544.36 | 544.88 | 535.79 | 539.78 | 0.00 |
2014-10-27 | 537.03 | 544.41 | 537.03 | 540.77 | 0.00 |
2014-10-28 | 543.00 | 548.98 | 541.52 | 548.90 | 0.00 |
2014-10-29 | 550.00 | 554.19 | 546.98 | 549.33 | 0.00 |
2014-10-30 | 548.95 | 552.87 | 543.51 | 550.31 | 0.00 |
2014-10-31 | 559.35 | 559.57 | 554.75 | 559.08 | 0.00 |
2014-11-03 | 555.50 | 557.90 | 553.23 | 555.22 | 0.00 |
2014-11-04 | 553.00 | 555.50 | 549.30 | 554.11 | 0.00 |
2014-11-05 | 556.98 | 556.98 | 544.05 | 545.92 | 0.00 |
2014-11-06 | 545.50 | 546.89 | 540.97 | 542.04 | 0.00 |
2014-11-07 | 546.21 | 546.22 | 538.67 | 541.01 | 0.00 |
2014-11-10 | 541.46 | 549.59 | 541.02 | 547.49 | 0.00 |
2014-11-11 | 548.83 | 551.94 | 546.30 | 550.29 | 0.00 |
2014-11-12 | 550.16 | 551.01 | 545.15 | 547.31 | 0.00 |
2014-11-13 | 549.80 | 549.80 | 543.48 | 545.38 | 0.00 |
2014-11-14 | 546.68 | 546.68 | 542.06 | 544.40 | 0.00 |
2014-11-17 | 543.58 | 543.94 | 534.06 | 536.51 | 0.00 |
2014-11-18 | 537.50 | 541.96 | 534.17 | 535.03 | 0.00 |
2014-11-19 | 535.00 | 538.24 | 530.06 | 536.99 | 0.00 |
2014-11-20 | 531.25 | 535.11 | 531.06 | 534.83 | 0.00 |
2014-11-21 | 541.61 | 542.14 | 536.56 | 537.50 | 0.00 |
2014-11-24 | 537.65 | 542.71 | 535.61 | 539.27 | 0.00 |
2014-11-25 | 539.00 | 543.98 | 538.58 | 541.08 | 0.00 |
2014-11-26 | 540.88 | 541.56 | 537.01 | 540.37 | 0.00 |
2014-11-28 | 540.81 | 542.00 | 536.52 | 541.83 | 0.00 |
2014-12-01 | 541.79 | 541.79 | 531.86 | 533.80 | 0.00 |
2014-12-02 | 533.51 | 535.50 | 529.80 | 533.75 | 0.00 |
2014-12-03 | 531.44 | 536.00 | 529.26 | 531.32 | 0.00 |
2014-12-04 | 531.16 | 537.34 | 528.59 | 537.31 | 0.00 |
2014-12-05 | 531.00 | 532.89 | 524.28 | 525.26 | 0.00 |
2014-12-08 | 527.13 | 531.00 | 523.79 | 526.98 | 0.00 |
2014-12-09 | 522.14 | 534.19 | 520.50 | 533.37 | 0.00 |
2014-12-10 | 533.08 | 536.33 | 525.56 | 526.06 | 0.00 |
2014-12-11 | 527.80 | 533.92 | 527.10 | 528.34 | 0.00 |
2014-12-12 | 523.51 | 528.50 | 518.66 | 518.66 | 0.00 |
2014-12-15 | 522.74 | 523.10 | 513.27 | 513.80 | 0.00 |
2014-12-16 | 511.56 | 513.05 | 489.00 | 495.39 | 0.00 |
2014-12-17 | 497.00 | 507.00 | 496.81 | 504.89 | 0.00 |
2014-12-18 | 512.95 | 513.87 | 504.70 | 511.10 | 0.00 |
2014-12-19 | 511.51 | 517.72 | 506.91 | 516.35 | 0.00 |
2014-12-22 | 516.08 | 526.46 | 516.08 | 524.87 | 0.00 |
2014-12-23 | 527.00 | 534.56 | 526.29 | 530.59 | 0.00 |
2014-12-24 | 530.51 | 531.76 | 527.02 | 528.77 | 0.00 |
2014-12-26 | 528.77 | 534.25 | 527.31 | 534.03 | 0.00 |
2014-12-29 | 532.19 | 535.48 | 530.01 | 530.33 | 0.00 |
2014-12-30 | 528.09 | 531.15 | 527.13 | 530.42 | 0.00 |
2014-12-31 | 531.25 | 532.60 | 525.80 | 526.40 | 0.00 |
2015-01-02 | 529.01 | 531.27 | 524.10 | 524.81 | 0.00 |
2015-01-05 | 523.26 | 524.33 | 513.06 | 513.87 | 0.00 |
2015-01-06 | 515.00 | 516.17 | 501.05 | 501.96 | 0.00 |
2015-01-07 | 507.00 | 507.24 | 499.65 | 501.10 | 0.00 |
2015-01-08 | 497.99 | 503.48 | 491.00 | 502.68 | 0.00 |
2015-01-09 | 506.00 | 506.00 | 494.79 | 496.17 | 0.00 |
2015-01-12 | 494.94 | 495.98 | 487.56 | 492.55 | 0.00 |
2015-01-13 | 498.84 | 502.98 | 492.39 | 496.18 | 0.00 |
2015-01-14 | 494.65 | 503.23 | 493.00 | 500.87 | 0.00 |
2015-01-15 | 505.57 | 505.68 | 497.76 | 501.79 | 0.00 |
2015-01-16 | 500.01 | 508.19 | 500.00 | 508.08 | 0.00 |
2015-01-20 | 511.00 | 512.50 | 506.02 | 506.90 | 0.00 |
2015-01-21 | 507.25 | 519.28 | 506.20 | 518.04 | 0.00 |
2015-01-22 | 518.04 | 536.33 | 518.04 | 534.39 | 0.00 |
2015-01-23 | 535.59 | 542.17 | 533.00 | 539.95 | 0.00 |
2015-01-26 | 538.53 | 539.00 | 529.66 | 535.21 | 0.00 |
2015-01-27 | 529.25 | 530.71 | 518.19 | 518.63 | 0.00 |
2015-01-28 | 522.78 | 523.00 | 509.86 | 510.00 | 0.00 |
2015-01-29 | 511.00 | 511.09 | 501.20 | 510.66 | 0.00 |
2015-01-30 | 515.86 | 539.87 | 515.52 | 534.52 | 0.00 |
2015-02-02 | 531.73 | 533.00 | 518.55 | 528.48 | 0.00 |
2015-02-03 | 528.00 | 533.40 | 523.25 | 529.24 | 0.00 |
2015-02-04 | 529.24 | 532.67 | 521.23 | 522.76 | 0.00 |
2015-02-05 | 523.79 | 528.50 | 522.07 | 527.58 | 0.00 |
2015-02-06 | 528.30 | 537.21 | 526.41 | 531.00 | 0.00 |
2015-02-09 | 528.00 | 532.00 | 526.01 | 527.83 | 0.00 |
2015-02-10 | 529.30 | 537.70 | 526.92 | 536.94 | 0.00 |
2015-02-11 | 535.30 | 538.45 | 533.34 | 535.97 | 0.00 |
2015-02-12 | 537.10 | 544.84 | 534.67 | 542.93 | 0.00 |
2015-02-13 | 543.88 | 549.91 | 543.13 | 549.01 | 0.00 |
2015-02-17 | 546.83 | 550.00 | 541.09 | 542.84 | 0.00 |
2015-02-18 | 542.10 | 545.50 | 537.50 | 539.70 | 0.00 |
2015-02-19 | 538.04 | 543.11 | 538.01 | 542.87 | 0.00 |
2015-02-20 | 543.13 | 544.00 | 535.80 | 538.95 | 0.00 |
2015-02-23 | 536.05 | 536.44 | 529.41 | 531.91 | 0.00 |
2015-02-24 | 530.00 | 536.79 | 528.25 | 536.09 | 0.00 |
2015-02-25 | 535.90 | 546.22 | 535.45 | 543.87 | 0.00 |
2015-02-26 | 543.21 | 556.14 | 541.50 | 555.48 | 0.00 |
2015-02-27 | 554.24 | 564.71 | 552.90 | 558.40 | -100.00 |
2015-03-02 | 558.50 | 572.15 | 558.50 | 571.34 | 0.00 |
2015-03-03 | 570.45 | 575.39 | 566.52 | 573.64 | 0.00 |