I personally fail to see what's simple about an environment in which one has to even define what the
RSI does, account for the warm-up period and many other things which are in that notebook.
Furthermore if one has a
time.sleep(TIME) the speed is for sure going to be controlled by the time spent sleeping and not by any other less limiting factor like CPU capacity.
perhaps I'd like something that works like an RSI, but works differently
Isn't that what backtrader makes very easy by allowing the definition of custom indicators (with easy parameters and custom defined output lines), subclassing and extension of existing indicators?
I'd like to use threshold values with this strategy
Isn't that what parameters in a backtrader strategy are for? (You CANNOT define parameters in that bad clone)
seeing what the general shape of the output wave looks like
Isn't plotting a single line in backtrader? (Because I see several lines to do plotting there)
From here, a small Backtrader wrapper, or Backtesting.py wrapper, or QuantConnect wrapper might be able to interact with the script. I imported Backtesting, but I also have the other two libraries installed.
Sorry, but you have a very custom script. There is no possibility for other things to interact with the script, because the script is tightly integrated with one.
The same script with
import backtrader as bt goog = bt.PandasData(dataname=df) class Strategy(bt.Strategy): def __init__(self): bt.ind.RSI() cerebro = bt.Cerebro() cerebro.broker.setcash(1e6) cerebro.broker.setcommission(commission=0.05) bt.run() bt.plot()