Buy/sell signals not showing
calepat last edited by
Hi, I'm new to this platform and am running into problems with the plotting. The logic seems to work fine and the trades go through but on the chart itself I expect the green and red arrows to appear. I got the forex data from HistData. They're downloaded as xlsx files originally but I've converted it to a csv format.
I suspect the problem lies within the data because I got similar data that I downloaded from Yahoo and the arrows show up.
There are two differences between the data as far as I can tell. The first as that one (the one that doesn't work) is 1m and the second is 1d. The second is that there is no "Adj Close" column in the 1m csv. The columns are Date, Open, High, Low, Close, Vol. Where for the 1d csv there is Adj Close after Close. I've tried simply copying the Close column into a Adj Close column but that didn't fix anything.
Here is the code:
import backtrader as bt import pandas as pd from strategies import GoldenCross cerb = bt.Cerebro() cerb.broker.setcash(1000) fname = "data/GBPUSD_1d.csv" # fname = "data/testing.csv" data = pd.read_csv(fname, index_col=0, parse_dates=True) # data["Adj Close"] = data["Close"] feed = bt.feeds.PandasData(dataname=data) cerb.adddata(feed) cerb.addstrategy(GoldenCross) print(cerb.broker.getvalue()) cerb.run() cerb.plot(style='candlestick', plotlinelabels='True')
Any help would be greatly appreciated!
vladisld last edited by
Just a guess. It probably worth to specify the timeframe and the compression for the PandasData ( the default is 1 day if I'm not mistaken).