CDLTHRUSTING(open, high, low, close)
CDLTHRUSTING
integer = CDLTHRUSTING(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_CDLTHRUSTING(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.CDLTHRUSTING(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 = 'CDLTHRUSTING: ' + self.symbol
print ktgfunc.talib_table(symbol, 1, dict)
Console
GOOG: 2014-08-11 09:30:00.000000
CDLTHRUSTING: GOOG | |||||
---|---|---|---|---|---|
Input | Output | ||||
date | open | high | low | close | integer |
2014-03-19 | 284.00 | 284.00 | 276.46 | 279.23 | 0.00 |
2014-03-20 | 280.60 | 283.21 | 279.33 | 279.99 | 0.00 |
2014-03-21 | 283.45 | 283.50 | 278.46 | 278.48 | 0.00 |
2014-03-24 | 279.36 | 284.23 | 279.36 | 283.58 | 0.00 |
2014-03-25 | 362.98 | 362.98 | 281.10 | 283.50 | 0.00 |
2014-03-26 | 569.85 | 587.28 | 564.13 | 569.74 | 0.00 |
2014-03-27 | 574.65 | 577.77 | 543.00 | 543.14 | 0.00 |
2014-03-28 | 540.74 | 548.48 | 527.15 | 538.15 | 0.00 |
2014-03-31 | 542.60 | 555.00 | 541.61 | 554.90 | 0.00 |
2014-04-01 | 559.62 | 565.37 | 552.95 | 564.14 | 0.00 |
2014-04-02 | 565.00 | 565.00 | 539.90 | 540.95 | 0.00 |
2014-04-03 | 532.55 | 540.00 | 526.53 | 530.60 | 0.00 |
2014-04-04 | 538.25 | 544.10 | 529.56 | 532.52 | 0.00 |
2014-04-07 | 535.71 | 538.45 | 518.46 | 536.44 | 0.00 |
2014-04-08 | 543.00 | 557.00 | 540.00 | 556.54 | 0.00 |
2014-04-09 | 548.81 | 549.50 | 531.15 | 536.10 | 0.00 |
2014-04-10 | 536.10 | 536.70 | 525.60 | 528.62 | 0.00 |
2014-04-11 | 528.64 | 537.23 | 527.51 | 534.81 | 0.00 |
2014-04-14 | 533.79 | 533.87 | 526.25 | 526.94 | 0.00 |
2014-04-15 | 529.97 | 531.65 | 522.12 | 525.16 | 0.00 |
2014-04-16 | 522.51 | 524.70 | 515.42 | 516.18 | 0.00 |
2014-04-17 | 517.18 | 518.48 | 502.80 | 517.15 | 0.00 |
2014-04-21 | 516.90 | 529.46 | 516.32 | 527.70 | 0.00 |
2014-04-22 | 527.60 | 528.00 | 522.52 | 526.66 | 0.00 |
2014-04-23 | 527.11 | 532.93 | 523.88 | 531.35 | 0.00 |
2014-04-24 | 533.76 | 534.00 | 525.61 | 527.93 | 0.00 |
2014-04-25 | 524.82 | 528.90 | 521.32 | 527.81 | 0.00 |
2014-04-28 | 525.23 | 526.81 | 515.06 | 515.14 | 0.00 |
2014-04-29 | 515.79 | 516.68 | 503.30 | 509.96 | 0.00 |
2014-04-30 | 508.46 | 517.23 | 506.45 | 511.00 | 0.00 |
2014-05-01 | 510.75 | 519.90 | 504.20 | 519.03 | 0.00 |
2014-05-02 | 523.51 | 530.19 | 519.01 | 529.92 | 0.00 |
2014-05-05 | 530.89 | 536.07 | 529.51 | 533.09 | 0.00 |
2014-05-06 | 533.00 | 533.00 | 525.29 | 526.65 | 0.00 |
2014-05-07 | 525.70 | 525.87 | 517.42 | 519.98 | 0.00 |
2014-05-08 | 521.39 | 521.80 | 515.44 | 520.63 | 0.00 |
2014-05-09 | 519.70 | 529.78 | 517.58 | 528.86 | 0.00 |
2014-05-12 | 529.74 | 536.23 | 526.30 | 529.77 | 0.00 |
2014-05-13 | 532.90 | 539.18 | 531.91 | 538.94 | 0.00 |
2014-05-14 | 541.13 | 547.60 | 540.78 | 545.06 | 0.00 |
2014-05-15 | 547.26 | 553.64 | 543.70 | 552.70 | 0.00 |
2014-05-16 | 556.00 | 566.00 | 554.35 | 565.95 | 0.00 |
2014-05-19 | 564.57 | 567.84 | 561.00 | 561.68 | 0.00 |
2014-05-20 | 563.35 | 564.00 | 558.71 | 560.08 | 0.00 |
2014-05-21 | 560.80 | 561.35 | 555.91 | 560.98 | 0.00 |
2014-05-22 | 560.70 | 560.90 | 545.73 | 553.93 | 0.00 |
2014-05-23 | 550.65 | 552.34 | 542.55 | 544.94 | 0.00 |
2014-05-27 | 541.50 | 548.61 | 538.75 | 544.66 | 0.00 |
2014-05-28 | 546.40 | 554.95 | 544.45 | 553.90 | 0.00 |
2014-05-29 | 558.06 | 558.06 | 548.93 | 556.33 | 0.00 |
2014-05-30 | 557.15 | 562.90 | 556.04 | 562.12 | 0.00 |
2014-06-02 | 560.51 | 563.60 | 557.90 | 560.55 | 0.00 |
2014-06-03 | 558.00 | 559.88 | 555.02 | 558.58 | 0.00 |
2014-06-04 | 557.30 | 557.99 | 548.46 | 551.35 | 0.00 |
2014-06-05 | 552.26 | 552.30 | 545.56 | 551.76 | 0.00 |
2014-06-06 | 549.26 | 549.62 | 541.52 | 544.28 | 0.00 |
2014-06-09 | 544.20 | 545.32 | 539.33 | 543.01 | 0.00 |
2014-06-10 | 544.86 | 553.56 | 544.00 | 553.37 | 0.00 |
2014-06-11 | 554.24 | 555.00 | 548.51 | 554.90 | 0.00 |
2014-06-12 | 556.85 | 557.58 | 550.39 | 557.57 | 0.00 |
2014-06-13 | 555.15 | 565.00 | 554.25 | 564.95 | 0.00 |
2014-06-16 | 565.19 | 572.65 | 561.01 | 564.62 | 0.00 |
2014-06-17 | 565.26 | 579.96 | 565.22 | 578.65 | 0.00 |
2014-06-18 | 581.00 | 582.45 | 571.85 | 576.00 | 0.00 |
2014-06-19 | 577.18 | 579.87 | 573.80 | 576.60 | 0.00 |
2014-06-20 | 578.66 | 579.57 | 574.75 | 575.28 | 0.00 |
2014-06-23 | 578.32 | 584.40 | 576.65 | 582.67 | 0.00 |
2014-06-24 | 583.35 | 585.44 | 580.39 | 582.36 | 0.00 |
2014-06-25 | 583.35 | 585.01 | 580.92 | 584.73 | 0.00 |
2014-06-26 | 583.76 | 586.43 | 579.59 | 582.25 | 0.00 |
2014-06-27 | 577.66 | 579.53 | 566.14 | 570.71 | 0.00 |
2014-06-30 | 571.58 | 576.72 | 569.38 | 576.08 | 0.00 |
2014-07-01 | 565.91 | 576.59 | 565.01 | 571.10 | 0.00 |
2014-07-02 | 571.91 | 580.85 | 571.42 | 579.18 | 0.00 |
2014-07-03 | 582.60 | 585.21 | 578.03 | 584.87 | 0.00 |
2014-07-07 | 585.74 | 585.80 | 576.56 | 584.78 | 0.00 |
2014-07-08 | 588.00 | 588.40 | 582.20 | 582.66 | 0.00 |
2014-07-09 | 579.53 | 580.99 | 568.61 | 573.16 | 0.00 |
2014-07-10 | 593.00 | 596.80 | 582.00 | 595.08 | 0.00 |
2014-07-11 | 591.75 | 594.40 | 585.23 | 589.47 | 0.00 |
2014-07-14 | 590.72 | 599.65 | 590.60 | 594.74 | 0.00 |
2014-07-15 | 593.23 | 597.85 | 592.50 | 595.98 | 0.00 |
2014-07-16 | 596.45 | 599.50 | 591.77 | 593.35 | 0.00 |
2014-07-17 | 590.40 | 591.86 | 587.03 | 589.02 | 0.00 |
2014-07-18 | 588.07 | 592.50 | 584.75 | 590.60 | 0.00 |
2014-07-21 | 588.75 | 589.70 | 583.52 | 585.61 | 0.00 |
2014-07-22 | 586.55 | 589.50 | 584.00 | 587.42 | 0.00 |
2014-07-23 | 580.60 | 583.65 | 570.00 | 571.60 | 0.00 |
2014-07-24 | 570.40 | 575.96 | 562.85 | 566.07 | 0.00 |
2014-07-25 | 569.04 | 575.35 | 564.10 | 573.15 | 0.00 |
2014-07-28 | 570.05 | 571.98 | 562.61 | 565.07 | 0.00 |
2014-07-29 | 561.78 | 570.70 | 560.00 | 566.49 | -100.00 |
2014-07-30 | 568.00 | 569.89 | 561.10 | 563.36 | 0.00 |
2014-07-31 | 563.56 | 570.25 | 560.35 | 568.77 | 0.00 |