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.673
Tracking Error
0.146
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
# Forex any minutes bar size resolution chart

# ---------------------------------------------
FOREX = "AUDUSD"; MA_F = 5; MA_S = 30; N = 30;
# ---------------------------------------------

class TestAlgorithm(QCAlgorithm):
    
    def Initialize(self):
        self.SetTimeZone("Australia/Brisbane")
        self.SetStartDate(2022, 4, 1)  
        self.SetEndDate(2022, 4, 14)
        self.SetCash(50000)  
        self.forex = self.AddForex(FOREX, Resolution.Minute).Symbol
        self.Consolidate(self.forex, timedelta(minutes = N), self.N_MinuteBarHandler)
        self.SetWarmUp(MA_S*24*60, Resolution.Minute)
        self.smafast = SimpleMovingAverage(MA_F*24*60//N) 
        self.smaslow = SimpleMovingAverage(MA_S*24*60//N) 
        
        N_MinuteConsolidator = QuoteBarConsolidator(timedelta(minutes = N))
        self.SubscriptionManager.AddConsolidator(self.forex, N_MinuteConsolidator)
        self.RegisterIndicator(self.forex, self.smafast, N_MinuteConsolidator)
        self.RegisterIndicator(self.forex, self.smaslow, N_MinuteConsolidator)
        
    
    def N_MinuteBarHandler(self, consolidated):
        if self.IsWarmingUp: return
        if not self.smafast.IsReady or not self.smaslow.IsReady: return    

        self.Plot(FOREX, "Price", self.Securities[self.forex].Price)
        self.Plot(FOREX, "smafast", self.smafast.Current.Value)
        self.Plot(FOREX, "smaslow", self.smaslow.Current.Value)