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/

    Strategy using timer takes different actions when feed with PandasData and GenericCSVData

    General Code/Help
    2
    2
    47
    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.
    • W
      Wang Guosong last edited by

      As i tested monthly automatic investment by using timer, I found that my strategy takes different actions when feed with PandasData and GenericCSVData, setting param 'when' with 'SESSION_END'.

      • Result from PandasData feed with SESSION_END:

      06aa7e39-0a07-435f-a4c7-80036905bb2e-image.png

      • Result from GenericCSVData feed with SESSION_END:

      6095a418-bd36-4439-b636-cb8529da2ab5-image.png

      Try to find the difference source, i change 'when' to 'SESSION_START'. Getting result for these two scenarios:

      • Result from PandasData feed with SESSION_START:

      fc7d189a-6d4b-45f6-a8d0-1d7b86eb437b-image.png

      • Result from GenericCSVData feed with SESSION_START:

      dac016ee-e9b9-45fd-9bb2-16486c3504d3-image.png

      I found that these two data feed get the same result with SESSION_START, but the time stamps are different. And i found the default time value in GenericCSVData is 23:59:59:999990 though we know that we get datetime.time(0,0) when we read a file with no time setting, which leads to the default time in PandasData is 00:00:00.

      Found out the real value of SESSION_START and SESSION_END, i get this:

      cc872a8c-ba57-4b07-bcb7-4f47462bd069-image.png

      So we know that:

      • If we use SESSION_END: the bar from PandasData time is earlier than SESSION_END(default: 23:59:59:999990), but bar GenericCSVData can fit the requirement and execute the command.
      • If we use SESSION_START: the bar from PandasData time is the same with SESSION_START(default: 00:00:00), and bar GenericCSVData is later than SESSION_START, so it can also be executed.
      1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by

        I think for daily an higher time frame, use of the session_start and session_end parameters meaningless and they can be skipped.

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