Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Fast Stochastic with low period

    General Code/Help
    1
    2
    63
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • oakenstream
      oakenstream last edited by

      Hey,

      I want to use the fast stochastic's K value and check when that one crosses under 10 from a strategy in a book. I'm doing this:

      self.inds[d]['faststoch'] = bt.indicators.Stochastic(d, period= 2)
      

      and I'm geting this:

      ZeroDivisionError: float division by zero
      

      the definition of the fast stochastic is I beleive:

      %K = (C – L) / (H – L) * 100
      %D = 3 days smoothing
      

      I would like only to use the %K value. Is this possible?

      1 Reply Last reply Reply Quote 0
      • oakenstream
        oakenstream last edited by

        Explanation here:
        https://community.backtrader.com/topic/98/float-division-by-zero/5

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
        $(document).ready(function () { app.coldLoad(); }); }