backtrader.indicators.kst module

KST Indicator Module - Know Sure Thing indicator.

This module provides the KST (Know Sure Thing) momentum indicator developed by Martin Pring.

Classes:

KnowSureThing: KST indicator (alias: KST).

示例

class MyStrategy(bt.Strategy):
def __init__(self):

self.kst = bt.indicators.KST(self.data) self.kst_signal = bt.indicators.KST(self.data, rp1=10, rp2=15, rp3=20, rp4=30)

def next(self):
if self.kst.kst[0] > self.kst.signal[0]:

self.buy()

elif self.kst.kst[0] < self.kst.signal[0]:

self.sell()

class backtrader.indicators.kst.KnowSureThing[源代码]

基类:Indicator

It is a "summed" momentum indicator. Developed by Martin Pring and published in 1992 in Stocks & Commodities.

Formula:
  • rcma1 = MovAv(roc100(rp1), period)

  • rcma2 = MovAv(roc100(rp2), period)

  • rcma3 = MovAv(roc100(rp3), period)

  • rcma4 = MovAv(roc100(rp4), period)

  • Kst = 1.0 * rcma1 + 2.0 * rcma2 + 3.0 * rcma3 + 4.0 * rcma4

  • signal = MovAv(kst, speriod)

See:

Params

  • rma1, rma2, rma3, rma4: for the MovingAverages on ROCs

  • rp1, rp2, rp3, rp4: for the ROCs

  • rsig: for the MovingAverage for the signal line

  • rfactors: list of factors to apply to the different MovAv(ROCs)

  • _movav and _movavs, allows to change the Moving Average type applied for the calculation of kst and signal

alias = ('KST',)
plotinfo = <backtrader.metabase.plotinfo_obj object>
__init__(*args, **kwargs)
next()[源代码]

Calculate KST and signal for the current bar.

Formula: KST = w1*RCMA1 + w2*RCMA2 + w3*RCMA3 + w4*RCMA4 Signal = SMA(KST, rsignal)

once(start, end)[源代码]

Calculate KST and signal in runonce mode.

frompackages = ()
packages = ()