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
-6.403
Tracking Error
0.118
Treynor Ratio
0
Total Fees
$0.00
class MyAlgor(QCAlgorithm):

        def Initialize(self):
            
            # configurable params
            self.baseFX = 'EUR'
            self.quoteFX = 'GBP'
            self.atrPeriod = 14
            self.fastPeriod = 50
            
            # set brokerage model / account type / cash
            self.SetBrokerageModel(BrokerageName.OandaBrokerage)
            self.SetCash(10000)
            
            # start and end dates for the backtest
            #self.SetTimeZone("UTC")
            self.SetStartDate(2020, 7, 1)
            self.SetEndDate(2020, 7, 10)

            # add currency pair
            self.fx = self.baseFX + self.quoteFX
            self.symbol = self.AddForex(self.fx, Resolution.Minute, market=Market.Oanda).Symbol

            #self.fx = "SPY"
            #self.symbol = self.AddEquity("SPY", Resolution.Minute, Market.USA).Symbol

            # schedule event 60 mins after market open
            self.Schedule.On(
                self.DateRules.EveryDay(self.fx),
                self.TimeRules.AfterMarketOpen(self.fx, 60),
                self.EveryDayAfterMarketOpen
                )
                             
            # add indicators and warmup period
            self.atr = self.ATR(
                self.symbol,
                self.atrPeriod,
                Resolution.Daily
            )
            
            self.fastEMA = self.EMA(
                self.symbol,
                self.fastPeriod,
                Resolution.Daily
            )
        
            self.SetWarmUp(
                max(
                    self.atrPeriod,
                    self.fastPeriod,
                ), 
                Resolution.Daily
            )
            
            self.called = 0

        def OnData(self, data):
            pass
                
        def EveryDayAfterMarketOpen(self):
            if self.IsWarmingUp:
                return
    
            self.Log(f"{self.Time} atr {self.atr.Current.Value:,.4f}   fast ema {self.fastEMA.Current.Value:,.4f}")
        
        def OnEndOfDay(self):
            self.Log(f"Price: {self.Securities[self.fx].Price}")