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
-3.279
Tracking Error
0.107
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
class LogicalBrownManatee(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 11, 15)
        self.SetEndDate(2020, 12, 15)
        self.SetCash(100000) 
        self.dataByContract = {}
        self.fut_sp = self.AddFuture(Futures.Indices.SP500EMini)
        self.fut_sp.SetFilter(TimeSpan.Zero, TimeSpan.FromDays(60))
        self.fut_gold = self.AddFuture(Futures.Metals.Gold)
        self.fut_gold.SetFilter(TimeSpan.FromDays(30), TimeSpan.FromDays(60))
    def OnSecuritiesChanged(self,changes):
        for security in changes.RemovedSecurities:
            if security.Symbol  in self.dataByContract:
                self.Debug("removed contract: "+str(security.Symbol))
                symbol_data = self.dataByContract.pop(security.Symbol, None)
                if symbol_data:
                    symbol_data.dispose()
                    
        for security in changes.AddedSecurities:
            if security.Symbol not in self.dataByContract:
                self.dataByContract[security.Symbol] = SymbolData(self,security.Symbol)
                
    def OnData(self, data):
        for chain in data.FutureChains:
            for contract in chain.Value:
                if contract.Symbol in self.dataByContract:
                    self.Plot("STD", str(contract.Symbol), self.dataByContract[contract.Symbol].std.Current.Value)
                    
class SymbolData:
    def __init__(self,algo,symbol):
        self.symbol = symbol
        self.algo = algo
        self.std = StandardDeviation(50)
        self.consolidator = algo.ResolveConsolidator(self.symbol, Resolution.Minute)
        self.algo.RegisterIndicator(self.symbol, self.std, self.consolidator)
        algo.WarmUpIndicator(self.symbol, self.std, Resolution.Minute)
        
    def dispose(self):
        self.algo.SubscriptionManager.RemoveConsolidator(self.symbol, self.consolidator)