For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Custom indicator Calculation

  • 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?

  • Isn't that working?

    stock_rev = 100 - stock

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

    Thank you

Log in to reply