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/

    Feeding previously calculated indicator to backtrader

    Indicators/Strategies/Analyzers
    2
    2
    39
    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.
    • M
      MHK last edited by

      Hi. I am fairly new to backtrader but I am planning to test lot of strategies on it. Here is an example of what I am doing:

      I use 3 SMAs (fast, medium and slow). Use the crossover between the fast and the slow as a buying signal and the crossover between the medium and fast as a selling signal. Of course I need to optimize the period for these SMAs, resulting in hundreds of calculations.

      My question is the following: Is there any way to calculate the SMAs only ONCE and then upload the already calculated values to backtrader? As my code stands I feed the raw stock market prices on every run and backtrader has to calculate the SMAs every time...

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

        @mhk Here's an example here

        Just search for backtrader pandas extend lines and you can find lots of example in the community. Let us know how it goes.

        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(); }); }