Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
-1.271
Tracking Error
0.154
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
# region imports
from AlgorithmImports import *
# endregion

class AlertRedOrangeGalago(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 4, 1)
        self.SetCash(100_000)
        self.UniverseSettings.Resolution = Resolution.Daily
        self.AddUniverse(self.CoarseSelection)
        self.OHL = {}

    def CoarseSelection(self, coarse):
        # Refining a bit to assets with fundamental data and price > 5$
        selected = [x for x in coarse if x.HasFundamentalData and (x.Price > 5.0)]
        # Priming self.OHL
        if len(self.OHL) == 0:
            return [x.Symbol for x in selected]
        # self.OHL is primed - using it
        # Using previous day's High to filter assets by selecting only those with High > 100$
        filtered = [x for x in selected if x.Symbol in self.OHL and (self.OHL[x.Symbol][1] > 100.0)]
        # Outputting length of returned Universe day after day - for minimal debugging
        self.Debug(len(filtered))
        
        # Use or save (for use in another part of the algo) "filtered" however or whereever (self.whatever) you want depending on what you want to do...

        # Return the selected Universe, not the filtered
        return [x.Symbol for x in selected]

    def OnData(self, data: Slice):
        for d in data:
            self.OHL[d.Key] = (data.Bars[d.Key].Open, data.Bars[d.Key].High, data.Bars[d.Key].Low)