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/

    How to reset the value of strategy parameter each day at the session start

    General Code/Help
    3
    4
    1419
    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.
    • I
      Ivan last edited by

      Hi,
      I use intraday data in my strategy (e.g. 1H) but for each day the logic in the strategy depends on whether the price hit some precalculated value. This value is calculated at the begin of the daily session (actually, I am using an indicator that works on daily data).

      What is the best way how to reset the boolean variable which indicates if the intraday price hit some level during daily session? Can I just reset the value of the variable in the next() method when I detect the first hourly bar in the particular day or there is some better approach?

      Thanks

      1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by ab_trader

        Check out this thread Submit order 30 minutes before market close

        @backtrader offered nice approach how to check time during the day inside the indicator class.

        1 Reply Last reply Reply Quote 0
        • I
          Ivan last edited by

          Thank you @ab_trader, I will check it out.

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

            In any case it seems that a "call a function at a given time", be it related to the session starting/ending times or totally unrelated (for example around midnight) is something people actually do. Seems like a proper add-on.

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