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/

    typo found in indicators documentation.

    General Code/Help
    2
    2
    33
    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.
    • Tom Porter
      Tom Porter last edited by

      If a user was to copy and paste the example found midway down this page for indicators. They'll get an error that buy_sig is not defined. Inside

      def init (self):
      and
      def next (self):

      buy_sig needs to be self.buy_sig to function properly.

      1 Reply Last reply Reply Quote 0
      • Soham Jain
        Soham Jain last edited by

        @Tom-Porter said in typo found in indicators documentation.:

        class MyStrategy(bt.Strategy):
        
            def __init__(self):
        
                sma1 = btind.SimpleMovingAverage(self.data)
                ema1 = btind.ExponentialMovingAverage()
        
                close_over_sma = self.data.close > sma1
                close_over_ema = self.data.close > ema1
                sma_ema_diff = sma1 - ema1
        
                self.buy_sig = bt.And(...)
        
            def next(self):
        
                if self.buy_sig:
                    self.buy()
        

        Absolutely. Thanks for pointing it out Tom.

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