The error is as follows:
Traceback (most recent call last):
File "/home/runner/stock/test.py", line 160, in <module>
strategy = MyStrategy(data=df_1h, params={})
File "/home/runner/stock/test.py", line 108, in __init__
super().__init__(data, params)
TypeError: Strategy.__init__() missing 1 required positional argument: 'params'
The Class :
class MyStrategy(Strategy):
def __init__(self, data, params):
super().__init__(data, params)
def init(self):
pass
def next(self):
supertrend_1h = self.data['Supertrend']
adx_1h = self.data['adx']
supertrend_1d = self.data['Supertrend'].resample('1D').last().ffill()
adx_1d = self.data['adx'].resample('1D').last().ffill()
if crossover(supertrend_1h, adx_1h, crossover_above=True) and adx_1h[-1] > 21 and adx_1h[-1] > adx_1h[-2]:
self.buy()
elif crossover(supertrend_1d, adx_1d, crossover_above=False) and adx_1d[-1] > 21 and adx_1d[-1] > adx_1d[-2]:
self.sell()
strategy = MyStrategy(data=df_1h, params={})
this class was generated by gpt so i have no idea how the library works,
i have tried doing some changes myself, but all were invain.