Oh thank you so much! Obvious mistake haha
Posts made by tradingnoob
RE: Beginner Question: No trades executed with CSV data?
Beginner Question: No trades executed with CSV data?
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.
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:
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!