Replies: 2 comments
-
You can also use |
Beta Was this translation helpful? Give feedback.
-
@kernc |
Beta Was this translation helpful? Give feedback.
-
You can also use |
Beta Was this translation helpful? Give feedback.
-
@kernc |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to backtest a breakout strategy, but is it that backtesting.py is unable to implement intra-bar backtesting?
For example, when using day-level data, I expect to execute a buy immediately when the price rises above the previous day's closing price plus 1. However, I've found that the current code can only execute trades at the earliest in the next trading day.
breakout = self.data.Close[-1] + 1
If I want to implement a similar strategy, I can only use lower time frame data—for instance, switching to hour-level data. But there are still similar issues: even if the price breaks through the preset level at 9:45 after the market opens at 9:30, the earliest trade can only be executed at 10:30. To optimize this, I would need to use even lower time frames, but it becomes relatively more difficult to obtain a large amount of relevant data (e.g., half-hourly or minute-level data).
Beta Was this translation helpful? Give feedback.
All reactions