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 get the date of date in indicator?

    Indicators/Strategies/Analyzers
    2
    5
    50
    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.
    • Yacc Don
      Yacc Don last edited by

      It would be convenient if I could get the date of the date, could anybody tell me how to do it?

      For example:

      class _DwtBase(bt.Indicator):
      
          def once(self, start, end):
                print( self.dates[0][j].date )
      
      

      @backtrader

      Regards.

      Yacc Don 1 Reply Last reply Reply Quote 0
      • Yacc Don
        Yacc Don @Yacc Don last edited by

        @yacc-don It would be convenient if could get the date of the date during debug.

        Yacc Don 1 Reply Last reply Reply Quote 0
        • Yacc Don
          Yacc Don @Yacc Don last edited by

          @yacc-don Sorry, It would be convenient if I could get the date of the "data", could anybody tell me how to do it?

          class _DwtBase(bt.Indicator):
          
              def once(self, start, end):
                    print( self.datas[0][j].date )
          
          

          Thansk

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

            https://www.backtrader.com/docu/quickstart/quickstart/

            Log method

            Yacc Don 1 Reply Last reply Reply Quote 1
            • Yacc Don
              Yacc Don @ab_trader last edited by

              @ab_trader Thank you.

              What I mean is get datetime in indicator once function.

              I figure out a solution, which is pass strategy.datas[0].datetime as a data, so I can access the date by bt.num2date(self.datas[1][i])

              I don't know if it is a good one, but it works

              Regards

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