kernc

Results 397 comments of kernc

True, the `.bfill()` call here introduces a brief look-ahead bias. https://github.com/kernc/backtesting.py/blob/0ce24d80b1bcb8120d95d31dc3bb351b1052a27d/backtesting/lib.py#L466 The assumption was that the ATR for a trailing strategy would be fairly stable. PR fix welcome!

Sorry for the late turnaround. I'm not yet decided, but certainly not strongly opposed to this change. However, in the style of the rest of this library, I'd prefer `Strategy.cash`...

> When I plot, it says that I can solve the problem with resample=interval(time unit), but no matter what I do, it doesn't work. Saying simply "it doesn't work" is...

No bug-reproducing test case ...

When SL and TP are hit within the same bar, backtesting.py acts pessimistically, that is considering SL as hit first. https://github.com/kernc/backtesting.py/blob/0ce24d80b1bcb8120d95d31dc3bb351b1052a27d/backtesting/backtesting.py#L843-L848 Have to double check if this code works correctly...

Maybe `Strategy.I` should try to coerce the returned values to floats (or fail). https://github.com/kernc/backtesting.py/blob/0ce24d80b1bcb8120d95d31dc3bb351b1052a27d/backtesting/backtesting.py#L135

@datatalking Sorry for the late reply (awfully busy these days), and thanks for showing interest. As you can see in the original issue report above, the error happens during plotting,...

Can you share some [minimal example code to reproduce the issue](https://github.com/kernc/backtesting.py/blob/master/CONTRIBUTING.md)?

~~[`Strategy.next()`](https://kernc.github.io/backtesting.py/doc/backtesting/backtesting.html#backtesting.backtesting.Strategy.next) is assumed to be called _between_ bars. `Strategy.buy()` just places the buying order, but orders are executed and turned into trades, as mentioned in the [quick start manual](https://kernc.github.io/backtesting.py/doc/examples/Quick%20Start%20User%20Guide.html#Strategy), the...