Backtrader Community

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

    tradingnoob

    @tradingnoob

    0
    Reputation
    193
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    tradingnoob Unfollow Follow

    Latest posts made by tradingnoob

    • RE: Beginner Question: No trades executed with CSV data?

      Oh thank you so much! Obvious mistake haha

      posted in General Code/Help
      T
      tradingnoob
    • Beginner Question: No trades executed with CSV data?

      Hey all
      I'm new to backtrader and I'm really excited about it! But I have a problem:

      Im trying to work with my csv Data wich I have fetched from a crypto exchange. When I plot it evrything looks fine, but it executes no trades. I think the problem is somewhere in my Data.

      The Candlesticks are daily.

      0_1526405242896_backtestpicture.png

      So this is how I'm trying to set de data:

      def data():
          data = btfeeds.GenericCSVData(
              dataname="data.csv",
              nullvalue=0.0,
              dtformat=('%Y-%m-%d'),
              tmformat=('%H:%M:%S'),
              timeframe = bt.TimeFrame.Days,
              compression=1,
              datetime=1,
              time = 12,
              open=2,
              high=3,
              low=4,
              close=5,
              volume=6,
              openinterest = -1)
          return data
      

      and this is my strategy:

      class firstStrategy(bt.Strategy):

      def __init__(self):
          self.rsi = bt.indicators.RSI_SMA(self.data.close, period=21)
      
      def next(self):
          if not self.position:
              if self.rsi < 30:
                  self.buy(size=100)
          else:
              if self.rsi > 70:
                  self.sell(size=100)
      

      Has anyone an idea what I need to fix? Thank you so much in advance!

      posted in General Code/Help csv crypto data data feed data feeds
      T
      tradingnoob