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/

    Try plotting indicators sample but only candles charting display

    Indicators/Strategies/Analyzers
    1
    2
    83
    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.
    • Quỳnh H Nguyễn
      Quỳnh H Nguyễn last edited by

      Hello,

      I'm very rookie on BackTrader, and hope to understand it first before take a dive into. And I do not find the error I got (or misunderstanding) here.

      1. I downloaded data in file, under csv format: {Index,Open,High,Low,Close,Volume}. The index is timestamp format, at timeframe 5 minutes.
      Index,Open,High,Low,Close,Volume
      1525226400,1033.0,1034.0,1032.5,1032.0,277
      1525226700,1032.1,1032.9,1031.0,1032.0,548
      1525227000,1032.0,1032.5,1031.3,1031.0,246
      1525227300,1032.4,1032.5,1030.3,1030.0,666
      1525227600,1030.6,1030.6,1026.4,1027.0,1058
      1525227900,1027.3,1027.3,1025.2,1025.0,1189
      1525228200,1026.1,1029.6,1026.1,1028.0,614
      1525228500,1028.4,1028.9,1026.8,1027.0,584
      1525228800,1028.0,1031.1,1027.7,1031.0,861
      ...
      
      1. I used the sample code from ta-lib integration: https://www.backtrader.com/blog/posts/2016-07-26-talib-integration/talib-integration/ to check the indicators and plotting. But I load pandas from csv and resample data into 60 minutes or 1 day.
          # Get a pandas dataframe
          datapath = ('Index-2018.csv')
      
          dataframe = pandas.read_csv(datapath,
                                      skiprows=0,
                                      header=0,
                                      parse_dates=True,
                                      index_col=0)
      
          dataframe.index = pandas.to_datetime(dataframe.index, unit='s')
      
          # Set timeframe of original history data
          data = btfeeds.PandasData(dataname=dataframe, timeframe=bt.TimeFrame.Minutes, compression=5)
      
          # Resample desired timeframe
          # cerebro.resampledata(data, timeframe=bt.TimeFrame.Minutes, compression=60)
          cerebro.resampledata(data, timeframe=bt.TimeFrame.Days, compression=1)
      
      
      1. Then run the test likes:
      ./talibtest.py --plot --ind sma
      or 
      ./talibtest.py --plot --ind stoc
      ...
      

      But the results display only candles charting. There is no indicator plotting on.

      Figure_0.png

      So where is my error, wrong logic here? Thanks so much!

      1 Reply Last reply Reply Quote 0
      • Quỳnh H Nguyễn
        Quỳnh H Nguyễn last edited by

        Oh, mainly cerebro missed the adding strategy. So sorry when annoy everyone!

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors