You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
History warmup of indicators shows incorrect values when compared to the same indicators that have been active for a month already. This happens both when the indicator has a different resolution to the underlying symbol and when it has the same resolution.
Unable to compare this test with the warm_up_indicator() method for Stochastic indicator due to #8405
Expected Behavior
Warming up the indicator produces the correct values from the first day that it is warmed up.
With SPY set to Resolution.Hour and indicators using Daily resolution:
Indicator values for algorithm starting on 3rd June:
RSI: 67.08
STO K: 47.00
STO D: 57.95
Compare the values on the 3rd June for the same algorithm that starts 1 month earlier:
RSI: 56.02
STO K: 51.52
STO D: 62.86
The expectation is that the indicators should represent the same value in both cases, but they do not.
Additionally, changing symbol resolution to the same as the indicator resolution ie. Resolution.Daily also gives different values:
Indicator values for algorithm starting on 3rd June:
RSI: 67.53
STO K: 49.25
STO D: 50.03
Compare the values on the 3rd June for the same algorithm that starts 1 month earlier:
RSI: 56.52
STO K: 49.25
STO D: 50.03
The expectation is that the indicators should represent the same value in both cases, but they do not.
Actual Behavior
The values are incorrect when compared to the same indicator that is run 1 month earlier
Potential Solution
Reproducing the Problem
SPY: Hour, Indicator: Daily. 3rd June values for algorithm that starts on that date
SPY: Hour, Indicator: Daily. 3rd of June values for algorithm that starts 1 month earlier
SPY: Daily, Indicator: Daily. 3rd June values for algorithm that starts on that date
SPY: Daily, Indicator: Daily. 3rd of June values for algorithm that starts 1 month earlier
class TestWarmUp(QCAlgorithm):
def initialize(self):
# change the start date between runs to check that warm up shows the correct value
self.set_start_date(2024, 5, 1)
# self.set_start_date(2024, 6, 1)
self.set_end_date(2024, 7, 1)
self.set_cash(100000)
self.spy = self.add_equity("SPY", Resolution.HOUR).symbol
# Resolution.DAILY indicators
self._rsi = RelativeStrengthIndex(14, MovingAverageType.WILDERS)
self._sto = Stochastic(14, 3, 3)
self.register_indicator(self.spy, self._rsi, Resolution.DAILY)
self.register_indicator(self.spy, self._sto, Resolution.DAILY)
# Resolution.DAILY indicators
self._rsi_timedelta = RelativeStrengthIndex(14, MovingAverageType.WILDERS)
self._sto_timedelta = Stochastic(14, 3, 3)
self.register_indicator(self.spy, self._rsi_timedelta, timedelta(days=1))
self.register_indicator(self.spy, self._sto_timedelta, timedelta(days=1))
# warm up indicators
history = self.history[TradeBar](self.spy, 20, Resolution.DAILY)
for bar in history:
self._rsi.update(bar.end_time, bar.close)
self._sto.update(bar)
self._rsi_timedelta.update(bar.end_time, bar.close)
self._sto_timedelta.update(bar)
def on_data(self, data: Slice):
if self.is_warming_up:
return
if data.contains_key(self.spy):
chart_name = "Resolution.DAILY"
self.plot(chart_name, "RSI", self._rsi.current.value)
self.plot(chart_name, "STO K", self._sto.stoch_k.current.value)
self.plot(chart_name, "STO D", self._sto.stoch_d.current.value)
chart_name = "timedelta(days=1)"
self.plot(chart_name, "RSI", self._rsi_timedelta.current.value)
self.plot(chart_name, "STO K", self._sto_timedelta.stoch_k.current.value)
self.plot(chart_name, "STO D", self._sto_timedelta.stoch_d.current.value)
System Information
cloud
Checklist
I have completely filled out this template
I have confirmed that this issue exists on the current master branch
I have confirmed that this is not a duplicate issue by searching issues
I have provided detailed steps to reproduce the issue
The text was updated successfully, but these errors were encountered:
History warmup of indicators shows incorrect values when compared to the same indicators that have been active for a month already. This happens both when the indicator has a different resolution to the underlying symbol and when it has the same resolution.
Unable to compare this test with the warm_up_indicator() method for Stochastic indicator due to #8405
Expected Behavior
Warming up the indicator produces the correct values from the first day that it is warmed up.
With SPY set to Resolution.Hour and indicators using Daily resolution:
Indicator values for algorithm starting on 3rd June:
RSI: 67.08
STO K: 47.00
STO D: 57.95
Compare the values on the 3rd June for the same algorithm that starts 1 month earlier:
RSI: 56.02
STO K: 51.52
STO D: 62.86
The expectation is that the indicators should represent the same value in both cases, but they do not.
Additionally, changing symbol resolution to the same as the indicator resolution ie. Resolution.Daily also gives different values:
Indicator values for algorithm starting on 3rd June:
RSI: 67.53
STO K: 49.25
STO D: 50.03
Compare the values on the 3rd June for the same algorithm that starts 1 month earlier:
RSI: 56.52
STO K: 49.25
STO D: 50.03
The expectation is that the indicators should represent the same value in both cases, but they do not.
Actual Behavior
The values are incorrect when compared to the same indicator that is run 1 month earlier
Potential Solution
Reproducing the Problem
SPY: Hour, Indicator: Daily. 3rd June values for algorithm that starts on that date
SPY: Hour, Indicator: Daily. 3rd of June values for algorithm that starts 1 month earlier
SPY: Daily, Indicator: Daily. 3rd June values for algorithm that starts on that date
SPY: Daily, Indicator: Daily. 3rd of June values for algorithm that starts 1 month earlier
System Information
cloud
Checklist
master
branchThe text was updated successfully, but these errors were encountered: