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
-2.621
Tracking Error
0.096
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
from datetime import datetime, timedelta

class QuantumHorizontalChamber(QCAlgorithm):
    def Initialize(self):
        # dictionary to save checking for each symbol if their first bar is passed
        self.begun = {}
        # dictionary to hold consolidator for each symbol
        self.consolidator = {}
        
        self.SetStartDate(2021, 6, 15)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        
        self.symbols = ["EURUSD", "GBPUSD"]
        
        for symbol in self.symbols:
            self.AddForex(symbol, Resolution.Minute)
            
            # Custom consolidator
            self.consolidator[symbol] = QuoteBarConsolidator(self.CustomDaily)
            self.consolidator[symbol].DataConsolidated += self.CustomDailyHandler
            self.SubscriptionManager.AddConsolidator(symbol, self.consolidator[symbol])
            
            # haven't pass first bar
            self.begun[symbol] = False
    
        # we set a warmup period for the first bar
        self.SetWarmUp(timedelta(hours=17))
        
    def CustomDaily(self, dt):
        '''Custom Monthly Func'''
        # after the first bar of all, we concolidate every 4 hours
        if all([value for value in self.begun.values()]):
            return CalendarInfo(dt, timedelta(hours=4))
        else:
            # first bar will consolidate at current day's 1700
            return CalendarInfo(dt, dt.replace(hour=17) - dt)
        
    def CustomDailyHandler(self, sender, consolidated):
        '''This is our event handler Custom Daily function'''
        self.Log(f"{consolidated.Time} >> {consolidated.EndTime} >> {consolidated.Symbol} >> {consolidated.Close}")
        
        # marked we've passed the first bar of this symbol
        self.begun[consolidated.Symbol.Value] = True