Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. soultrader
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    S
    • Profile
    • Following 1
    • Followers 0
    • Topics 2
    • Posts 3
    • Best 1
    • Controversial 0
    • Groups 0

    soultrader

    @soultrader

    2
    Reputation
    86
    Profile views
    3
    Posts
    0
    Followers
    1
    Following
    Joined Last Online

    soultrader Unfollow Follow

    Best posts made by soultrader

    • RE: bta-lib and bt.indicators deliver different values when using indicator on indicator

      Found the culprit.

      When examing the ATR dataframe returned from the bta-lib ATR function it contains NaN.
      After removing the NaN values from the dataframe I got the same results.

      RSI(atr_df.dropna(), period=7)

      posted in bta-lib
      S
      soultrader

    Latest posts made by soultrader

    • RE: bta-lib and bt.indicators deliver different values when using indicator on indicator

      Found the culprit.

      When examing the ATR dataframe returned from the bta-lib ATR function it contains NaN.
      After removing the NaN values from the dataframe I got the same results.

      RSI(atr_df.dropna(), period=7)

      posted in bta-lib
      S
      soultrader
    • bta-lib and bt.indicators deliver different values when using indicator on indicator

      I am thankfully using bta-lib in computing indicators the right way and to make sure they are equivalent to what is being used in Backtrader. When using single indicators like RSI, ATR, MACD, the values are exactly the same in bta-lib and Backtrader, as expected.

      However, when I use an indicator on indicator approach, like a RSI on ATR, there is a rather large discrepancy between values. The source values, in this case ATR, are similar.

      The Backtrader indicator (RSI on ATR) seems to deliver the correct value in my opinion.

      Any suggestions?

      posted in bta-lib
      S
      soultrader
    • Code snippet incomplete in documentation

      I was going through the documentation and think I might have stumbled upon some incomplete code on the following link:

      https://www.backtrader.com/docu/observers-and-statistics/observers-and-statistics.html#observer-implementation

      from __future__ import (absolute_import, division, print_function,
                              unicode_literals)
      
      import argparse
      import datetime
      import os.path
      import time
      import sys
      
      
      import backtrader as bt
      import backtrader.feeds as btfeeds
      import backtrader.indicators as btind
      
      
      class MyStrategy(bt.Strategy):
          params = (('smaperiod', 15),)
      
          def log(self, txt, dt=None):
              ''' Logging function fot this strategy'''
              dt = dt or self.data.datetime[0]
              if isinstance(dt, float):
                  dt = bt.num2date(dt)
              print('%s, %s' % (dt.isoformat(), txt))
      
          def __init__(self):
      
      
      posted in General Code/Help documentation observers
      S
      soultrader