Hi, just new to QC and had some questions.
When I set the daily resolution for my indicators, I got different indicator value with minute/daily security resolutions. following is my code:
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, 2)
# add currency pair
self.fx = self.baseFX + self.quoteFX
self.AddForex(self.fx, Resolution.Daily, market=Market.Oanda)
self.fxClose = None
# 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.fx,
self.atrPeriod,
resolution=Resolution.Daily
)
self.fastEMA = self.EMA(
self.fx,
self.fastPeriod,
resolution=Resolution.Daily
)
self.SetWarmUp(
max(
self.atrPeriod,
self.fastPeriod,
),
resolution=Resolution.Daily
)
def OnData(self, data):
pass
def EveryDayAfterMarketOpen(self):
if self.IsWarmingUp:
return
atr = self.atr.Current.Value
fastEMA = self.fastEMA.Current.Value
self.Debug(f"{self.Time} atr {self.atr.Current.Value:,.4f}")
self.Debug(f"{self.Time} fast ema {self.fastEMA.Current.Value:,.4f}")
when adding security with daily resolution, I got the following values
2020-07-01 05:00:00 atr 0.0060
2020-07-01 05:00:00 fast ema 0.8958
then I changed the security resolution to minute
self.AddForex(self.fx, Resolution.Minute, market=Market.Oanda)
2020-07-02 05:00:00 atr 0.0000
2020-07-02 05:00:00 fast ema 0.9017
just wondering that why I got quite different results even I did not change the resolution of any indicators?