QuantConnect / QuantConnect/Lean

Daily Closing Price & Indicator Descrepancy When Changing Resolution

Open
#4,577 5 comments 0 reactions 1 assignee View on GitHub

@Martin-Molinero is already working on this.

Since May 28, 2024.

bug data-integrity
Dominant language
C#
Stars
21.7k
Forks
5.3k
Avg merge
2d 22h
Merged PRs (30d)
34

Description

Expected Behavior
  1. The daily price of a forex symbol should be the same, regardless of the resolution of data we select.
  2. Indicator values should be the same at the end of each day when we initialize indicators with a daily resolution but change the symbol resolution.
Actual Behavior
  1. In this backtest, the daily closing price of a forex pair differs when changing the symbol resolution.
  2. The logs listed below show the following findings of the backtest:
    • When selecting equities in the backtest:
      • The ATR values are equal during the first 2 days for all the resolutions, but then they start to diverge.
      • The EMA values are equal during the first 3 days for all the resolutions, but then the minute resolution's values start to diverge while the hourly and daily resolutions remain equal.
    • When selecting forex in the backtest:
      • The ATR values are different at each time step across all the resolutions.
      • The EMA values for the minute and hour resolutions are equal. Only the first EMA value on daily resolution is equal to the other resolutions.

Logs:
fx-daily.txt
fx-hour.txt
fx-minute.txt
equities-daily.txt
equities-minute.txt
equities-hour.txt

Potential Solution

Unknown. The _previousInput property of indicators is private, so I cannot see which values the indicators are being updated with.

Reproducing the Problem

Utilize this backtest.

System Information

Run in the browser in the Algorithm Lab. Windows 10.

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.