Hi all!

Actually trying to get the algos' programming logic, so I decided to build a very basic one but unfortunately, no trades are generated which is very frustrating:

Algo's Trading rule: Enter Long on TSLA if RSI > 51 and if RSI < 60. I'm pretty sure to miss something that might be an evidence for you, but I'm totally stuck with this. 

I first thought that the RSI indicator wasn't "updated" but even when I write an algo that should trade if the stock's price is > X, it won't place any trades.

Also, if I can get this to work properly, I'll be able to understand who to manage orders, data and indicators, In other words, I would be able to build any strategies so your help would be really appreciated.

Cheers!

import numpy as np class RSIalgo(QCAlgorithm): def Initialize(self): # Define a date range and strating capital for backtest self.SetStartDate(2018, 6, 24) # Backtest starting date self.SetEndDate(2018, 8, 24) # Last date = Today self.SetCash(10000) # Define the initial capital # Select the stock to trade self.tesla = self.AddEquity("TSLA", Resolution.Daily) def OnData(self, data): # Make the algo work every days self.Schedule.On(self.DateRules.EveryDay("SPY")) # Calling the RSI Indicator self.rsi = self.RSI("TSLA", 14, MovingAverageType.Simple, Resolution.Daily) # If we are not invest in TSLA and RSI crosses above 30 go long if not self.Portfolio["TSLA"].Invested: if self.rsi > 51 and self.rsi < 60: self.MarketOrder("TSLA", 22)