Hi all, 

special thanks to Louis Szeto and this is a continuation from 

https://www.quantconnect.com/forum/discussion/11829/how-to-use-indicator-computed-in-a-dataframe-to-enter-trade/p1

I tried to develop a strategy and here are the rules:

Entry:
1. Stocks ≥ 85 decile rank
2. close > 200 simple moving average
3. stochastics (5) ≤ 30

Exit:
1. Stocks < 85 decile rank

I've modified the code but I've faced 3 issues:
1. If I set my universe resolution to daily, I receive “Warning: fill at stale price”. However, when I change the resolution to hour (in order to schedule a function), I get the following error:

KeyNotFoundException : 'HUM R735QTJ8XC9X' wasn't found in the TradeBars object, likely because there was no-data at this moment in time and it wasn't possible to fillforward historical data. Please check the data exists before accessing it with data.ContainsKey("HUM R735QTJ8XC9X")
at QuantConnect.Data.Market.DataDictionary`1.get_Item(Symbol symbol) in /LeanCloud/CI.Builder/bin/Debug/src/QuantConnect/Lean/Common/Data/Market/DataDictionary.cs:line 228
at OnData
symbolTradeBar = tradeBars[symbol]
===
at Python.Runtime.PyObject.Invoke(PyTuple args in main.py:line 83
 

2. There seems to be too many trade for a short period of time. The objective is to liquidate symbols not in the short list (self.potential) but the algo seems to liquidate and cancel the order. I'm not sure why.

3. The back test take a long time to run. Maybe there is a better way to improve the code?

Open to suggestions and I hope somebody can help me understand the error that is happening

Thanks a lot!! 😊