Artificial Intelligence, Finance, Reinforcement Learning, Data Science, Innovation.
strategy if short_ma > long_ma and env.position == 0: # Golden cross - Buy signal action = 1 elif short_ma < long_ma and env.position == 1: # Death cross - Sell signal action = 2 else: action = 0 # Hold obs, reward, done, info = env.step(action) env.render() You may have spotted a flaw with this