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 set the indicator data point value as nan

    Indicators/Strategies/Analyzers
    1
    3
    44
    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.
    • C
      cicidad last edited by

      I want set the data point per 10 days, and connect the points, need set other data point value as NAN, hot to set it

      class DummyInd(bt.Indicator):
         lines = ('dummyline',)
         plotinfo = dict(subplot=False,_skipnan=False)
         params = (('value', 0),('period', 1),)
         count =0
         def __init__(self):
                 self.lines.dummyline = numpy.nan #error here, do not know how to set.
         def next(self):
             DummyInd.count +=1
             if DummyInd.count % 10==0:
                 self.lines.dummyline[0] = self.data.close[0]
      
      1 Reply Last reply Reply Quote 0
      • C
        cicidad last edited by

        how to initial a line object as NaN, only set some points had value

        1 Reply Last reply Reply Quote 0
        • C
          cicidad last edited by

          I use this code implement it.

          self.lines.dummyline[0] = max(float('NaN'), float('NaN'))
          

          thanks.

          1 Reply Last reply Reply Quote 1
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
          $(document).ready(function () { app.coldLoad(); }); }