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/

    Calculating average beforehand

    General Code/Help
    1
    1
    15
    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.
    • Vivan Maitreya
      Vivan Maitreya last edited by

      I am trying to implement a Pairs trading strategy wherein i calculate the ratio of stock prices, find their zscore and use that zscore to create an upper and lower bound for it. I wanted to know if there was a way to calculate the average of all zscores in the init function. I tried using the Average class of Indicators, but it calculates the average at every bar, whereas i want a way to have precalculated average. Is there any way to do it using backtrader rather than doing it manually? Thanks for the help!

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