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

Multiple timeframes not with the same start point / possible?



  • Hi,

    I have tried to find if that question has already been raised in the forum, but couldn't find corresponding thread.
    I am interested in using multiple timeframes for which data is available in different data sources (different csv files).

    Will backtrader be able to handle data coming from different csv files that do not share the same start time?

    For instance, I have 2 CSV files that contain:

    • file "1H_data.csv": a period 1H (1hour), & 1st bar is for a period that starts at 2019/05/06 14:00:00
    • file "1D_data.csv": a period 1D (1 day), & 1st bar if for a period that starts at 2019/05/05 00:00:00

    Will backtrader be able to work wit this data, meaning for instance that when calling "next()" for the 1st time, the current data

    • coming from "1H_data.csv" is the one indeed from the 1st bar
    • coming from "1D_data.csv" is the one from the 2nd bar (and not the 1st)
      ?

    If not, is there a workaround to be able to have this logic? (thing is that I don't have the hourly data far in the past, nor do I have the use, but I do have the corresponding daily data, and do have the use of it)

    I thank you in advance for your help.
    Have a good day.
    Best regards,
    Pierre



  • Try it, print data on each next() and prenext(), and check out how bt processes the data feeds. You need to try each iteration by yourself, otherwise you will not move far in development.


  • administrators

    @pierrot said in Multiple timeframes not with the same start point / possible?:

    Will backtrader be able to handle data coming from different csv files that do not share the same start time?

    Yes. Even if they start in different millenia, centuries, eons ...

    @pierrot said in Multiple timeframes not with the same start point / possible?:

    coming from "1H_data.csv" is the one indeed from the 1st bar

    Without seeing the data the answer seems to be yes.
    @pierrot said in Multiple timeframes not with the same start point / possible?:

    coming from "1D_data.csv" is the one from the 2nd bar (and not the 1st)
    ?

    What is the 2nd bar? In any case it would seem strange to have a daily bar with a session closing time of 00:00:00. If your second bar is 2019-05-06 00:00:00, you will get this 2nd bar, but that doesn't make it right, because a daily bar does always complete after intraday bars.

    @pierrot said in Multiple timeframes not with the same start point / possible?:

    If not, is there a workaround to be able to have this logic?

    You haven't specified any logic, rather a half-cooked example. The logic is for sure very clear to you, but not for those reading your message.


Log in to reply
 

});