class SlowSTC(Indicator):

    # Set the default initialization. The first one is executed.
    def initialize(self):
        self.options = [9, 3, 3]
        self.displays = ["SK", "SD"]

    # It generates indicators that is used internally. The first one is executed.
    def declare_using(self):
        self.ind1 = XAverage(self, self.options[1], "FK")
        self.ind2 = XAverage(self, self.options[2], "SK")

    # The computation is executed each time data is added or changed.
    def calculating(self):
        length = self.options[0]
        highest = self.highest("H", length)
        lowest = self.lowest("L", length)

        self.lines["FK"] = (self.lines["C"] - lowest) / (highest -
                                                         lowest) * 100.0

        self.ind1.calculate()
        self.lines["SK"] = self.ind1.lines["XAverage"]

        self.ind2.calculate()
        self.lines["SD"] = self.ind2.lines["XAverage"]
Ejemplo n.º 2
0
class ADX(Indicator):

    # Set the default initialization. The first one is executed.
    def initialize(self):
        self.options = [14]
        self.displays = ["DX", "ADX"]

    # It generates indicators that is used internally. The first one is executed.
    def declare_using(self):
        self.ind1 = DMI(self, self.options[0])
        self.ind2 = XAverage(self, self.options[0], "DX")

    # The computation is executed each time data is added or changed.
    def calculating(self):
        self.ind1.calculate()
        self.lines["DX"] = fabs(self.ind1.lines['PDMI'] - self.ind1.lines['MDMI']) * 100.0 / (self.ind1.lines['PDMI'] + self.ind1.lines['MDMI'])
        self.ind2.calculate()
        self.lines["ADX"] = self.ind2.lines['XAverage']
Ejemplo n.º 3
0
class PMAO(Indicator):

    # Set the default initialization. The first one is executed.
    def initialize(self):
        self.options = [12, 26]
        self.displays = ["PMAO"]

    # It generates indicators that is used internally. The first one is executed.
    def declare_using(self):
        self.ind1 = XAverage(self, self.options[0])
        self.ind2 = XAverage(self, self.options[1])

    # The computation is executed each time data is added or changed.
    def calculating(self):
        self.ind1.calculate()
        self.ind2.calculate()
        self.lines["PMAO"] = self.ind1.lines["XAverage"] - self.ind2.lines[
            "XAverage"] * 100 / self.ind1.lines["XAverage"]
Ejemplo n.º 4
0
class WilliamsR(Indicator):

    # Set the default initialization. The first one is executed.
    def initialize(self):
        self.options = [15, 5]
        self.displays = ["WR", "WD"]

    def declare_using(self):
        self.ind1 = XAverage(self, self.options[1], "WR")

    def calculating(self):
        length = self.options[0]
        highest = self.highest("H", length)
        lowest = self.lowest("L", length)

        self.lines["WR"] = (highest - self.lines["C"]) * (-100.0) / (highest -
                                                                     lowest)

        self.ind1.calculate()
        self.lines["WD"] = self.ind1.lines["XAverage"]
Ejemplo n.º 5
0
 def declare_using(self):
     self.ind1 = XAverage(self, self.options[0], None,
                          ("XAverage", "__TRIX_MA1"))
     self.ind2 = XAverage(self, self.options[0], "__TRIX_MA1",
                          ("XAverage", "__TRIX_MA2"))
     self.ind3 = XAverage(self, self.options[0], "__TRIX_MA2",
                          ("XAverage", "__TRIX_MA3"))
Ejemplo n.º 6
0
class TRIX(Indicator):

    # Set the default initialization. The first one is executed.
    def initialize(self):
        self.options = [12]
        self.displays = ["TRIX"]

    # It generates indicators that is used internally. The first one is executed.
    def declare_using(self):
        self.ind1 = XAverage(self, self.options[0], None,
                             ("XAverage", "__TRIX_MA1"))
        self.ind2 = XAverage(self, self.options[0], "__TRIX_MA1",
                             ("XAverage", "__TRIX_MA2"))
        self.ind3 = XAverage(self, self.options[0], "__TRIX_MA2",
                             ("XAverage", "__TRIX_MA3"))

    # The computation is executed each time data is added or changed.
    def calculating(self):
        self.ind1.calculate()
        self.ind2.calculate()
        self.ind3.calculate()
        value1 = self.lines["__TRIX_MA3", self.options[0]]
        value0 = self.lines["__TRIX_MA3"]

        val = (value0 - value1) * 100.0 / value1

        self.lines["TRIX"] = val
Ejemplo n.º 7
0
class SONAR(Indicator):

    # Set the default initialization. The first one is executed.
    def initialize(self):
        self.options = [12, 12, 12]
        self.inputs = ["C"]
        self.displays = ["SONAR", "SONAR_MA"]

    # It generates indicators that is used internally. The first one is executed.
    def declare_using(self):
        self.ind1 = XAverage(self, self.options[0], None,
                             ("XAverage", "__SONAR_MA"))
        self.ind2 = XAverage(self, self.options[2], "SONAR",
                             ("XAverage", "SONAR_MA"))

    # The computation is executed each time data is added or changed.
    def calculating(self):
        self.ind1.calculate()
        length = self.options[1]
        value0 = self.lines["__SONAR_MA"]
        value1 = self.lines["__SONAR_MA", length]
        value = (value0 - value1) * 100.0 / value0
        self.lines["SONAR"] = value
        self.ind2.calculate()
Ejemplo n.º 8
0
class MACD(Indicator):

    # Set the default initialization. The first one is executed.
    def initialize(self):
        self.options = [12, 26, 9]
        self.displays = ["MACD", "Signal"]

    # It generates indicators that is used internally. The first one is executed.
    def declare_using(self):
        self.indi1 = XAverage(self, self.options[0])
        self.indi2 = XAverage(self, self.options[1])
        self.indi3 = XAverage(self, self.options[2], "MACD")

    # The computation is executed each time data is added or changed.
    def calculating(self):
        self.indi1.calculate()
        self.indi2.calculate()
        self.lines["MACD"] = self.indi1.lines["XAverage"] - self.indi2.lines[
            "XAverage"]
        self.indi3.calculate()
        self.lines["Signal"] = self.indi3.lines["XAverage"]
Ejemplo n.º 9
0
 def declare_using(self):
     self.ind1 = DMI(self, self.options[0])
     self.ind2 = XAverage(self, self.options[0], "DX")
Ejemplo n.º 10
0
 def declare_using(self):
     self.ind1 = XAverage(self, self.options[0])
     self.ind2 = XAverage(self, self.options[1])
Ejemplo n.º 11
0
 def declare_using(self):
     self.ind1 = XAverage(self, self.options[0], None,
                          ("XAverage", "__SONAR_MA"))
     self.ind2 = XAverage(self, self.options[2], "SONAR",
                          ("XAverage", "SONAR_MA"))
Ejemplo n.º 12
0
 def declare_using(self):
     self.indi1 = XAverage(self, self.options[0])
     self.indi2 = XAverage(self, self.options[1])
     self.indi3 = XAverage(self, self.options[2], "MACD")
 def declare_using(self):
     self.ind1 = XAverage(self, self.options[1], "FK")
     self.ind2 = XAverage(self, self.options[2], "SK")
Ejemplo n.º 14
0
 def declare_using(self):
     self.indFD = XAverage(self, self.options[1], "FK")
Ejemplo n.º 15
0
 def declare_using(self):
     self.ind1 = XAverage(self, self.options[1], "WR")