For some reason this lesson https://www.quantconnect.com/learning/task/158/Preparing-Indicators-with-History does not make real backtest, in fact there is no results.

I've tried to copy the code from the ‘solution' - the same, no results

serhii_3_1732699465.jpg

 

In video there are immediately results on backtest. What can be the reason?

 

Full code:

# region imports
from AlgorithmImports import *
# endregion
from AlgorithmImports import *

class EMAMomentumUniverse(QCAlgorithm):
    
    def Initialize(self):
        self.set_start_date(2019, 1, 7)
        self.set_end_date(2019, 4, 1)
        self.set_cash(100000)
        self.universe_settings.resolution = Resolution.DAILY
        self.add_universe(self.coarse_selection_function) 
        self.averages = { }
    
    def coarse_selection_function(self, universe):  
        selected = []
        universe = sorted(universe, key=lambda c: c.dollar_volume, reverse=True)  
        universe = [c for c in universe if c.price > 10][:100]

        for coarse in universe:  
            symbol = coarse.symbol
            
            if symbol not in self.averages:
                # 1. Call history to get an array of 200 days of history data
                history = self.history(symbol, 200, Resolution.DAILY)
                
                #2. Adjust SelectionData to pass in the history result
                self.averages[symbol] = SelectionData(history) 

            self.averages[symbol].update(self.time, coarse.adjusted_price)
            
            if  self.averages[symbol].is_ready() and self.averages[symbol].fast > self.averages[symbol].slow:
                selected.append(symbol)
        
        return selected[:10]
        
    def on_securities_changed(self, changes):
        for security in changes.removed_securities:
            self.liquidate(security.symbol)
       
        for security in changes.added_securities:
            self.set_holdings(security.symbol, 0.10)
            
class SelectionData():
    #3. Update the constructor to accept a history array
    def __init__(self, history):
        self.slow = ExponentialMovingAverage(200)
        self.fast = ExponentialMovingAverage(50)
    
        #4. Loop over the history data and update the indicators
        for bar in history.itertuples():
            self.update(bar.Index[1], bar.close)
    
    def is_ready(self):
        return self.slow.is_ready and self.fast.is_ready
    
    def update(self, time, price):
        self.fast.update(time, price)
        self.slow.update(time, price)