Backtrader Community

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

    adrtod

    @adrtod

    4
    Reputation
    197
    Profile views
    7
    Posts
    0
    Followers
    1
    Following
    Joined Last Online

    adrtod Unfollow Follow

    Best posts made by adrtod

    • RE: Must be real number, not LinesOperation

      Consider declaring indicators once in __init__:

      self.HighestC = bt.indicators.Highest(self.data, period=9)
      self.LowestC = bt.indicators.Lowest(self.data, period=9)
      

      and then use

      self.l.Stoc[0] = (self.data[0]-self.LowestC[0])/(self.HighestC[0]-self.LowestC[0])
      
      posted in General Code/Help
      adrtod
      adrtod
    • RE: Must be real number, not LinesOperation

      Alternatively in __init__ only:

      HighestC = bt.indicators.Highest(self.data, period=9)
      LowestC = bt.indicators.Lowest(self.data, period=9)
      self.l.Stoc = (self.data-LowestC)/(HighestC-LowestC)
      
      posted in General Code/Help
      adrtod
      adrtod
    • RE: Must be real number, not LinesOperation

      __init__ is called only once and only declares the indicators as objects, no computation is done during __init__ but they are handled automatically.
      The same applies when using operators to combine indicators, see https://www.backtrader.com/docu/concepts.html#operators-using-natural-constructs
      See also https://www.backtrader.com/docu/induse.html and https://www.backtrader.com/docu/inddev.html

      posted in General Code/Help
      adrtod
      adrtod

    Latest posts made by adrtod

    • RE: Problem with automargin / margin and expected PnL

      Hi,

      It seems to be a bug.

      See this Pull Request for a fix:
      https://github.com/backtrader/backtrader/pull/387

      @backtrader could you check please?

      posted in General Code/Help
      adrtod
      adrtod
    • RE: Problem with Transactions analyzer

      I see. Thanks @backtrader for the answer and for the amazing work!

      posted in Indicators/Strategies/Analyzers
      adrtod
      adrtod
    • RE: Problem with Transactions analyzer

      I was expecting that two opposite size transactions during the same bar would be reported in the analysis (instead of nothing).

      posted in Indicators/Strategies/Analyzers
      adrtod
      adrtod
    • Problem with Transactions analyzer

      The Transactions analyzer does not allow to fully reproduce the cash, value series.
      It stores only non-zeros accumulated positions at the end of each bar.
      See analyzers/transactions.py lines 97-98
      It can be a problem when e.g. there are two opposite transactions (size s and -s) during the same bar at two different prices.
      In this case, the resulting position is null but there are commisions and PnL generated, which are not reported in the transactions analysis.

      posted in Indicators/Strategies/Analyzers analyzer incorrect
      adrtod
      adrtod
    • RE: Must be real number, not LinesOperation

      __init__ is called only once and only declares the indicators as objects, no computation is done during __init__ but they are handled automatically.
      The same applies when using operators to combine indicators, see https://www.backtrader.com/docu/concepts.html#operators-using-natural-constructs
      See also https://www.backtrader.com/docu/induse.html and https://www.backtrader.com/docu/inddev.html

      posted in General Code/Help
      adrtod
      adrtod
    • RE: Must be real number, not LinesOperation

      Alternatively in __init__ only:

      HighestC = bt.indicators.Highest(self.data, period=9)
      LowestC = bt.indicators.Lowest(self.data, period=9)
      self.l.Stoc = (self.data-LowestC)/(HighestC-LowestC)
      
      posted in General Code/Help
      adrtod
      adrtod
    • RE: Must be real number, not LinesOperation

      Consider declaring indicators once in __init__:

      self.HighestC = bt.indicators.Highest(self.data, period=9)
      self.LowestC = bt.indicators.Lowest(self.data, period=9)
      

      and then use

      self.l.Stoc[0] = (self.data[0]-self.LowestC[0])/(self.HighestC[0]-self.LowestC[0])
      
      posted in General Code/Help
      adrtod
      adrtod