Why is my backtest order not being executed on the next candle?
-
When I use a CSV file with daily data like this:
Date,Open,High,Low,Close,Adj Close,Volume 1995-01-03,45.703125,45.84375,45.6875,45.78125,28.202983856201200,324300 1995-01-04,45.984375,46.0,45.75,46.0,28.337736129760700,351800
When I use
self.order = self.buy()
the order is executed on the open the next day.What is I'm using 1 min data like this:
Date,Open,High,Low,Adj Close,volume,trade_count,vwap 2022-05-25 08:00:00+00:00,141.19,141.19,140.7,140.7,2236,66,140.883658 2022-05-25 08:01:00+00:00,140.78,140.78,140.66,140.66,1938,49,140.705335
... The order is never executed.
I would like to have the order executed on the next candle.How can I have the backtest order executed on a 1 min chart?
Do I have to use a certain parameter for that?
-
I'm using this for the daily thing:
data = btfeeds.GenericCSVData(dataname='intraday-data.csv',dtformat='%Y-%m-%d')
And I'm using this for the 1 min candle, which seems to be problematic:
data = btfeeds.GenericCSVData(dataname='intraday-data.csv',dtformat='%Y-%m-%d %H:%M:%S+00:00')
-
Hey Alex,
I encounter the similar problem before (just different in timeframe which I am using 1 hour)
Please check out my post here: