def add_STOCHF(self, fastk_period=5, fastd_period=3, fastd_matype=0,
types=['line', 'line'],
colors=['primary', 'tertiary'],
**kwargs):
"""Fast Stochastic Oscillator.
Note that the first argument of types and colors refers to Fast Stoch %K,
while second argument refers to Fast Stoch %D
(signal line of %K obtained by MA).
"""
if not (self.has_high and self.has_low and self.has_close):
raise Exception()
utils.kwargs_check(kwargs, VALID_TA_KWARGS)
if 'kind' in kwargs:
kwargs['type'] = kwargs['kind']
if 'kinds' in kwargs:
types = kwargs['type']
if 'type' in kwargs:
types = [kwargs['type']] * 2
if 'color' in kwargs:
colors = [kwargs['color']] * 2
name = 'STOCHF({},{})'.format(str(fastk_period),
str(fastd_period))
fastk = name + r'[%k]'
fastd = name + r'[%d]'
self.sec[fastk] = dict(type=types[0], color=colors[0])
self.sec[fastd] = dict(type=types[1], color=colors[1], on=fastk)
self.ind[fastk], self.ind[fastd] = talib.STOCHF(self.df[self.hi].values,
self.df[self.lo].values,
self.df[self.cl].values,
fastk_period, fastd_period,
fastd_matype)
评论列表
文章目录