Backtesting 1 minute data
Hello - I've been able to successfully backtest 1 day and 1 hour data and for some reason when I try to backtest on 1 minute data no trades get executed when the backtest completes. I'm loading the appropriate CSV file with GenericCSVData for each test and not using the resampling feature provided by BackTrader. I'm assuming this should theoretically work for 1 min or 5 min.. The data looks like the following:
and the dtformat is set as:
The platform executes trades even with isolated ticks. Unfortunately the information provided above is insufficient to say why you may not be executing.
Long shot: you should always tell the platform which
compressionthe data feed has by specifying both during data feed creation.
Thanks, it working now on 1 min data - BackTrader is simply awesome!
@Z03 can you please post one example how use intraday timeframes? thx
Without knowing what you may be looking for, using intraday timeframes is not different from daily timeframes. In the question above, the problem is that the creation of the data feed was not specifying the
compressionparameters. As such the platform uses the defaults (
See this Blog - Timers post. The intraday script uses de
5-minutesdata sample available in the sources.
An excerpt where the parameters are specified
# Data feed kwargs kwargs = dict( timeframe=bt.TimeFrame.Minutes, compression=5, sessionstart=datetime.time(9, 0), sessionend=datetime.time(17, 30), )