Mariner Backtesting - TA-LIB Tasuki Gap

CDLTASUKIGAP(open, high, low, close)

CDLTASUKIGAP

 integer = CDLTASUKIGAP(open, high, low, close)
  • 0 = No Signal
  • -100 = Bearish Signal
  • 100 = Bullish Signal

Candlestick Plot

Tasuki Gap

 

Working Example

from cloudquant.interfaces import Strategy
from collections import OrderedDict
import ktgfunc
import talib

class WE_CDLTASUKIGAP(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.CDLTASUKIGAP(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 = 'CDLTASUKIGAP: ' + self.symbol
        print ktgfunc.talib_table(symbol, 1, dict)

Console

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