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/

    Custom indicator Calculation

    Indicators/Strategies/Analyzers
    2
    3
    72
    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.
    • E
      evo last edited by

      Hello,
      I'm trying to build a custom indicator and I need to reverse the stochastich line.

      For Example, if the value of the stochastic is 40 I need to have 60. ( 100 - stochValue)

      For now I have the Stochastic Line

      stoch = bt.indicators.StochasticSlow(d).lines.percK
      # something like -> stoch = 100 - stoch
      

      Any help or code snippet examples?

      1 Reply Last reply Reply Quote 0
      • run-out
        run-out last edited by

        Isn't that working?

        stock_rev = 100 - stock
        

        RunBacktest.com

        1 Reply Last reply Reply Quote 0
        • E
          evo last edited by

          I double checked and log the values and lines and I can confirm that works.

          Thank you

          1 Reply Last reply Reply Quote 1
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors