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.308
Tracking Error
0.159
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
class DancingAsparagusBarracuda(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020, 9, 1)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        
        tickers = ["USDCAD", "EURUSD", "AUDUSD"]   # XAUUSD", "USOIL"
        self.symbols = [self.AddForex(ticker).Symbol for ticker in tickers]
        self.symbol_data_by_symbol = {}


    def OnData(self, data):
        pass
    

    def OnSecuritiesChanged(self, changes):
        for security in changes.AddedSecurities:
            self.symbol_data_by_symbol[security.Symbol] = SymbolData(self, security.Symbol)


class SymbolData:
    previous_highs = RollingWindow[float](2)
    
    def __init__(self, algorithm, symbol):
        self.algorithm = algorithm
        self.symbol = symbol
        
        # Setup daily consolidator
        algorithm.Consolidate(symbol, timedelta(days=1), self.consolidation_handler)
        
        # Warm up previous_highs
        history = algorithm.History(symbol, 2, Resolution.Daily)
        if history.empty or 'high' not in history.columns:
            return
        for _, high in history.high.iteritems():
            self.previous_highs.Add(high)
        
    
    
    def consolidation_handler(self, consolidated):
        self.previous_highs.Add(consolidated.High)
        self.algorithm.Plot("Highs", str(self.symbol), consolidated.High)