CDLTRISTAR(open, high, low, close)
CDLTRISTAR
integer = CDLTRISTAR(open, high, low, close)
- 0 = No Signal
- -100 = Bearish Signal
- 100 = Bullish Signal
Candlestick Plot
![Tristar Pattern](https://app.cloudquant.com/docstatic/talib/pattern-recognition/cdltristar_3600.png)
Working Example
from cloudquant.interfaces import Strategy
from collections import OrderedDict
import ktgfunc
import talib
class WE_CDLTRISTAR(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.CDLTRISTAR(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 = 'CDLTRISTAR: ' + self.symbol
print ktgfunc.talib_table(symbol, 1, dict)
Console
GOOG: 2016-09-07 09:30:00.000000
CDLTRISTAR: GOOG | |||||
---|---|---|---|---|---|
Input | Output | ||||
date | open | high | low | close | integer |
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 | 0.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 |
2016-05-23 | 706.53 | 711.48 | 704.18 | 704.24 | 0.00 |
2016-05-24 | 706.86 | 720.97 | 706.86 | 720.09 | 0.00 |
2016-05-25 | 720.76 | 727.51 | 719.70 | 725.27 | 0.00 |
2016-05-26 | 722.87 | 728.33 | 720.28 | 724.12 | 0.00 |
2016-05-27 | 724.01 | 733.94 | 724.00 | 732.66 | 0.00 |
2016-05-31 | 731.74 | 739.73 | 731.26 | 735.72 | 0.00 |
2016-06-01 | 734.53 | 737.21 | 730.66 | 734.15 | 0.00 |
2016-06-02 | 732.50 | 733.02 | 724.17 | 730.40 | 0.00 |
2016-06-03 | 729.27 | 729.49 | 720.56 | 722.34 | 0.00 |
2016-06-06 | 724.91 | 724.91 | 714.61 | 716.55 | 0.00 |
2016-06-07 | 719.84 | 721.98 | 716.55 | 716.65 | 0.00 |
2016-06-08 | 723.96 | 728.57 | 720.58 | 728.28 | 0.00 |
2016-06-09 | 722.87 | 729.54 | 722.34 | 728.58 | 0.00 |
2016-06-10 | 719.47 | 725.89 | 716.43 | 719.41 | 0.00 |
2016-06-13 | 716.51 | 725.44 | 716.51 | 718.36 | 0.00 |
2016-06-14 | 716.48 | 722.47 | 713.12 | 718.27 | 0.00 |
2016-06-15 | 719.00 | 722.98 | 717.31 | 718.92 | 0.00 |
2016-06-16 | 714.91 | 716.65 | 703.26 | 710.36 | 0.00 |
2016-06-17 | 708.65 | 708.82 | 688.45 | 691.72 | 0.00 |
2016-06-20 | 698.77 | 702.48 | 693.41 | 693.71 | 0.00 |
2016-06-21 | 698.40 | 702.77 | 692.01 | 695.94 | 0.00 |
2016-06-22 | 699.06 | 700.86 | 693.08 | 697.46 | 0.00 |
2016-06-23 | 697.45 | 701.95 | 687.00 | 701.87 | 0.00 |
2016-06-24 | 675.17 | 689.40 | 673.45 | 675.22 | 0.00 |
2016-06-27 | 671.00 | 672.30 | 663.28 | 668.26 | 0.00 |
2016-06-28 | 678.97 | 680.33 | 673.00 | 680.04 | 0.00 |
2016-06-29 | 683.00 | 687.43 | 681.41 | 684.11 | 0.00 |
2016-06-30 | 685.47 | 692.32 | 683.65 | 692.10 | 0.00 |
2016-07-01 | 692.20 | 700.65 | 692.13 | 699.21 | 0.00 |
2016-07-05 | 696.06 | 696.94 | 688.88 | 694.49 | 0.00 |
2016-07-06 | 689.98 | 701.68 | 689.09 | 697.77 | 0.00 |
2016-07-07 | 698.08 | 698.20 | 688.22 | 695.36 | 0.00 |
2016-07-08 | 699.50 | 705.71 | 696.43 | 705.63 | 0.00 |
2016-07-11 | 708.05 | 716.51 | 707.24 | 715.09 | 0.00 |
2016-07-12 | 719.12 | 722.94 | 715.91 | 720.64 | 0.00 |
2016-07-13 | 723.62 | 724.00 | 716.85 | 716.98 | 0.00 |
2016-07-14 | 721.58 | 722.21 | 718.03 | 720.95 | 0.00 |
2016-07-15 | 725.73 | 725.74 | 719.05 | 719.85 | 0.00 |
2016-07-18 | 722.71 | 736.13 | 721.19 | 733.78 | 0.00 |
2016-07-19 | 729.89 | 736.99 | 729.00 | 736.96 | 0.00 |
2016-07-20 | 737.33 | 742.13 | 737.10 | 741.19 | 0.00 |
2016-07-21 | 740.36 | 741.69 | 735.83 | 738.63 | 0.00 |
2016-07-22 | 741.86 | 743.24 | 736.56 | 742.74 | 0.00 |
2016-07-25 | 740.67 | 742.61 | 737.50 | 739.77 | 0.00 |
2016-07-26 | 739.04 | 741.69 | 734.27 | 738.42 | 0.00 |
2016-07-27 | 738.28 | 744.46 | 737.00 | 741.77 | 0.00 |
2016-07-28 | 747.04 | 748.65 | 739.30 | 745.91 | 0.00 |
2016-07-29 | 772.71 | 778.55 | 766.77 | 768.79 | 0.00 |
2016-08-01 | 761.09 | 780.43 | 761.09 | 772.88 | 0.00 |
2016-08-02 | 768.69 | 775.84 | 767.85 | 771.07 | 0.00 |
2016-08-03 | 767.18 | 773.21 | 766.82 | 773.18 | 0.00 |
2016-08-04 | 772.22 | 774.07 | 768.79 | 771.61 | 0.00 |
2016-08-05 | 773.78 | 783.04 | 772.34 | 782.22 | 0.00 |
2016-08-08 | 782.00 | 782.63 | 778.09 | 781.76 | 0.00 |
2016-08-09 | 781.10 | 788.94 | 780.57 | 784.26 | 0.00 |
2016-08-10 | 783.75 | 786.81 | 782.78 | 784.68 | 0.00 |
2016-08-11 | 785.00 | 789.75 | 782.97 | 784.85 | 0.00 |
2016-08-12 | 781.50 | 783.40 | 780.40 | 783.22 | 0.00 |
2016-08-15 | 783.75 | 787.49 | 780.11 | 782.44 | 0.00 |
2016-08-16 | 780.30 | 780.98 | 773.44 | 777.14 | 0.00 |
2016-08-17 | 777.32 | 780.81 | 773.53 | 779.91 | 0.00 |
2016-08-18 | 780.01 | 782.86 | 777.00 | 777.50 | 0.00 |
2016-08-19 | 775.00 | 777.10 | 773.13 | 775.42 | 0.00 |
2016-08-22 | 773.27 | 774.54 | 770.05 | 772.15 | 0.00 |
2016-08-23 | 775.48 | 776.44 | 771.78 | 772.08 | 0.00 |
2016-08-24 | 770.58 | 774.50 | 767.07 | 769.64 | 0.00 |
2016-08-25 | 767.00 | 771.89 | 763.18 | 769.41 | 0.00 |
2016-08-26 | 769.00 | 776.08 | 765.85 | 769.54 | 0.00 |
2016-08-29 | 768.74 | 774.99 | 766.61 | 772.15 | 0.00 |
2016-08-30 | 769.33 | 774.47 | 766.84 | 769.09 | 0.00 |
2016-08-31 | 767.01 | 769.09 | 765.38 | 767.05 | 0.00 |
2016-09-01 | 769.25 | 771.02 | 764.30 | 768.78 | 100.00 |
2016-09-02 | 773.01 | 773.92 | 768.41 | 771.46 | 0.00 |
2016-09-06 | 773.45 | 782.00 | 771.00 | 780.08 | 0.00 |