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/

    Update plotline for talib indicator

    Indicators/Strategies/Analyzers
    1
    2
    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.
    • John M
      John M last edited by

      I have defined the a psar indicator using the talib library. I am using talib as I want to use the value of an indicator for my feed instead of the default close price.

      lines = ('psar',)
      plotlines = dict(
                  psar=dict(
                      _name='psar', marker='.', markersize=4.0, color='black', fillstyle='full', ls=''
                  ),
              )
      
       self.psar = bt.talib.SAR(
                  self.rl, 
                  self.rl, 
                  acceleration=0.02, maximum=0.12,
                  plotname='PSAR',
              )
      

      but when I view the chart the values defined in the plotlines dict don't assign to the indicator. I get the default values from the talib module.

      I also tried to use: self.psar.plotlines = plotlines but this also did not take. I have been through the plotting docs but could not work this out.

      John M 1 Reply Last reply Reply Quote 0
      • John M
        John M @John M last edited by

        I also add the psar value to the line:

         self.lines.PSAR = self.psar
        
        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors