EaseOfMovementValue uses a stale midpoint after a flat bar
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Read Indicators/EaseOfMovementValue.cs lines 74–92 and find the related indicator tests. Reproduce the issue with period 1 using the flat bar followed by a non-flat bar described in the issue. Add a regression test that checks the next value is 2, while confirming ordinary bars and the flat bar’s own result retain their existing behavior.
Written by the indexing model from the issue text.
Description
Problem
EaseOfMovementValue returns before updating its previous high/low when a bar is flat. The next non-flat bar therefore measures its midpoint change against an older bar, producing an incorrect indicator value.
Source: Indicators/EaseOfMovementValue.cs, lines 74–92.
Reproduction
Run these updates with period 1, so smoothing does not obscure the result. All bars have positive volume and distinct, increasing timestamps.
using System;
using QuantConnect;
using QuantConnect.Data.Market;
using QuantConnect.Indicators;
var symbol = new Symbol(SecurityIdentifier.GenerateEquity("SPY", Market.USA, false), "SPY");
var time = new DateTime(2024, 1, 2, 9, 30, 0);
var emv = new EaseOfMovementValue(1, 10000);
emv.Update(new TradeBar(time, symbol, 9, 10, 8, 9, 10000, TimeSpan.FromMinutes(1)));
emv.Update(new TradeBar(time.AddMinutes(1), symbol, 20, 20, 20, 20, 10000, TimeSpan.FromMinutes(1)));
emv.Update(new TradeBar(time.AddMinutes(2), symbol, 20, 22, 20, 22, 10000, TimeSpan.FromMinutes(1)));
Console.WriteLine(emv.Current.Value);
Executed result: 24. Expected: 2.
The final midpoint is 21 and the preceding bar's midpoint is 20. The box ratio is (10000 / 10000) / (22 - 20) = 0.5, so EMV should be (21 - 20) / 0.5 = 2. Instead, the flat bar leaves the saved midpoint at 9, yielding (21 - 9) / 0.5 = 24.
Required result
A flat bar must still become the preceding bar for the next midpoint calculation. Cover a positive-volume flat bar followed by a non-flat bar in a regression test, while preserving existing behavior for ordinary bars and the flat bar's own result.
Priority is low because the reproduction is limited to a particular indicator/input sequence; there is no evidence of widespread impact.
- Dominant language
- C#
- Stars
- 22.6k
- Forks
- 5.4k
- Avg merge
- 11h 39m
- Merged PRs (30d)
- 104
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from QuantConnect/Lean
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
QuantConnect/Lean#10216 ·
Maintainers usually reply within 1 day
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
QuantConnect/Lean#10206 ·
Maintainers usually reply within 1 day
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
QuantConnect/Lean#10199 ·
Maintainers usually reply within 1 day
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
QuantConnect/Lean#10198 ·
Maintainers usually reply within 1 day
-
priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
QuantConnect/Lean#10191 · 1 comment ·
Maintainers usually reply within 1 day
All issues in QuantConnect/Lean
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
dotnet-outdated/dotnet-outdated#871 ·
Maintainers usually reply within 1 day
-
triage/untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
unoplatform/uno#26676 ·
Maintainers usually reply within 1 day
-
.NET bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
jhaizhou-ops/S2Arm#2177 · 3 comments ·
Maintainers usually reply within 1 day
-
area-CodeGen-coreclr untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
dotnet/runtime#138181 · 1 comment ·
Maintainers usually reply within 1 day