Backtrader Community

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

    ronnyBravo

    @ronnyBravo

    -1
    Reputation
    1
    Profile views
    6
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    ronnyBravo Unfollow Follow

    Best posts made by ronnyBravo

    • RE: How to indicate that data feed is live data

      @sp I'm looking into same thing right now and would like to see if you guys figured it out.

      Can you drop me a line if you had any progress with this.

      Thanks!

      posted in General Code/Help
      R
      ronnyBravo

    Latest posts made by ronnyBravo

    • How to add multiple timeframes in CCXTStore?

      Re: Example code for live trading using binance

      I'm trying to use the CCXTStore library to create a Strategy that uses multiple timeframes (1h and 5m). For that I need to figure out how to add additional datafeeds into Cerebro.

      With CSV data it is easy, I can simply create two data objects and add them to Cerebro one-by-one with adddata method. However, this does not work with CCXTStore.

      Is it possible to add multiple timeframes using CCXTStore and how?

      posted in General Code/Help
      R
      ronnyBravo
    • RE: How to get a list of all indicators inside the observer

      Okay, so I figured out getting the name part as well. Instead of using iterator directly, we can get a tuple of lines defined inside the indicator with _getlines() method. Then we can loop over that tuple and each time call _getline() method with line name to return the actual lines object from which we can get the data sample.

      Example code:

      for ind in self._owner.getindicators():
          line_names=ind._getlines()
          ind_name=type(ind).__name__
          for line_name in line_names:
              line=ind._getline(line_name)
              print("Indicator "+ind_name+" line "+str(line_name)+" value is "+str(line[0]))
      

      Still working on the other issue with LinePlotterIndicator() method as mentioned above so if anybody can help then that would be greatly appreciated!

      posted in Indicators/Strategies/Analyzers
      R
      ronnyBravo
    • RE: How to get a list of all indicators inside the observer

      I figured out part of this on my own.

      So, when inside observers next() method we have reference to strategy object (via self._owner). Strategy object has a method getindicators() which returns an iterator, so we can plug this straight into for-loop and loop over all indicators one-by-one. To access data (lines) inside those indicator objects we can access lines attribute which again returns an iterator so when plugged into for-loop we can loop over all defined lines one-by-one.

      Example code:

      for ind in self._owner.getindicators():
           for line in ind.lines:
                print(line[0])
      

      Right now I'm trying to figure out how can I get the indicator lines name so I know which data I'm dealing with.

      Also, if indicators are not defined as a separate class, but are calculated inside the strategy and then plotted using LinePlotterIndicator() method then I'm not sure yet how to access those samples. This is next thing that I hope to figure out

      posted in Indicators/Strategies/Analyzers
      R
      ronnyBravo
    • How to get a list of all indicators inside the observer

      Hey,

      Is it possible to somehow get a list of all indicators that are added to the strategy when inside the observer next() method. I know that we can access datas, broker, trades and orders data via
      self._owner attribute. The indicator objects are listed there as well, so we can access them.

      However, is there an attribute which holds a list of all indicators that are added to this strategy? So we could actually loop over indicators and would not need to have a prior knowledge of what indicators are added.

      posted in Indicators/Strategies/Analyzers
      R
      ronnyBravo
    • RE: How to indicate that data feed is live data

      @sp I'm looking into same thing right now and would like to see if you guys figured it out.

      Can you drop me a line if you had any progress with this.

      Thanks!

      posted in General Code/Help
      R
      ronnyBravo
    • Appending data to data feed while running test

      Hi,

      I want to implement forward/paper trading using the backtrader. I have already more-or-less figured out how I will get the latest data. I will write a custom module which will monitor ticker-time pairs that user specifies on tradingView and if any of those has a new candle released then it will retrieve that and append to data set.

      I was thinking that in my strategies Next method I will check if the current sample is the last one and if it is then it will just block until there is a new sample in the data feed. Before that it will run as normal so we can start with historic data and then transit into forward testing (good because then all the SMA and other such indicators are already up and running).

      However, the difficult part is how to append those new candles into backtrader data feed while the test is running. Is there a way to append data into data feed while the test is running or would that break the test?

      posted in General Code/Help
      R
      ronnyBravo