Replies: 1 comment
-
The backtest learns about declared indicators in this way: backtesting.py/backtesting/backtesting.py Lines 1191 to 1194 in 0ce24d8 Obviously, isinstance(self.ind, _Indicator) check fails when self.ind is a ndarray ...
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi im currently working on a project in which I want to integrate the backtesting module so that the user is able to define the indicators via a GUI. For this reason, indicators cannot be created beforehand, but must be created when receiving the user input. My first idea was declaring the indicators using a for loop and indexing them as lists, this didnt work.
As the self.I() function returns a ndarray i tryed indexing multiple ndarrays that contain the calculatios of the indicator using TA-lib.
However when i run the backtest i dont get any errors but it fails to follow the strategy.
i used the example given in the main page and modified it as follow:
`
class SmaCross(Strategy):
bt = Backtest(GOOG, SmaCross, cash=100_000, commission=.002)
stats = bt.run()
stats
`
even thou im calculating exactly the same indicators as in the example, it seems like saving them into an array and then calling them generates this behaviour in which the strategy doesnt execute at all
The results i get are the following.
Any help on how to fix this would be greatly appreciated.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions