backtesting.py icon indicating copy to clipboard operation
backtesting.py copied to clipboard

Need Intraday trading example

Open vigneshgig opened this issue 2 years ago • 1 comments

Hi,

I need to backtest 5minute dataset for intraday strategy, but library holding the trade, till exit order signal, but i need to exit within a day if any order is there.

And also unable to backtest minute or hour based dataset, because index contain date and time. backtest throwing error if i use minute based dataset.

screencapture-localhost-8889-notebooks-Untitled14-ipynb-1662726317055

Any suggestion

@kernc

vigneshgig avatar Sep 09 '22 12:09 vigneshgig

backtest throwing error if i use minute based dataset.

This is really not the least helpful. Minute based data works for me ...

Please see contributing guidelines for instructions for reporting issues! Thanks.

kernc avatar Sep 09 '22 21:09 kernc

Hi, You can create a time_signal boolian column, where if time is less than 9:30 AM, it wont take any entry, and if time is greater than 14:45 PM, exit signal can be defined.

And for minute based dataset, I dont see any error. check with indexing and signal logic condition. Sanju

image

sanjurajin avatar Nov 21 '22 02:11 sanjurajin