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/

    Store not only int values in Line object

    Indicators/Strategies/Analyzers
    2
    2
    425
    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.
    • A
      AlexRozhnov last edited by

      I have an Indicator which is computed for a set of instruments. This set can contain from 1 to 10 instruments, so I want to assign Line object as a dict, where keys are names of these instruments and values are weights of each instrument in portfolio. At first I tried to dynamically create lines in Indicator, but found that it is impossible (https://community.backtrader.com/topic/294/add-lines-to-indicator). Now I do not know how to solve this problem, give me any hint please.

      B 1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators @AlexRozhnov last edited by

        Store not only int values in Line object

        "lines" do actually storefloat values and won't store anything else.

        @alexrozhnov said in Store not only int values in Line object:

        At first I tried to dynamically create lines in Indicator,but found that it is impossible (https://community.backtrader.com/topic/294/add-lines-to-indicator)

        You have probably misunderstood the discussion. See here:

        • https://community.backtrader.com/topic/837/programmatically-extending-a-datafeed/3

        @alexrozhnov said in Store not only int values in Line object:

        Now I do not know how to solve this problem, give me any hint please

        You don't provide much information to work with. But in any case it doesn't seem an Indicator may help you since from the brief description it doesn't seem like the Indicator will align to the timestamps of the data feed. But this is only an assumption.

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