MarketProfile value area loop never ends when valueAreaVolumePercentage is 1
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
Direzione di ricerca
Inizia con Indicators/MarketProfile.cs ed esamina CalculateValueArea, soprattutto il comportamento del ciclo dopo che entrambi gli indici dei livelli di prezzo raggiungono i limiti del profilo. Controlla i percorsi di aggiornamento di VolumeProfile e TimeProfile usando una percentuale di value area pari a 1. Il lavoro è terminato quando entrambi gli aggiornamenti ritornano e la value area si estende dal livello di prezzo più basso a quello più alto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Expected Behavior
VolumeProfile and TimeProfile accept a valueAreaVolumePercentage of 1 in their constructors. With that value the value area should cover the whole profile: after each update ValueAreaLow is the lowest price level, ValueAreaHigh is the highest, and the indicator returns like it does for any other percentage.
Actual Behavior
With valueAreaVolumePercentage = 1 the first Update never returns. MarketProfile.CalculateValueArea spins forever, so any algorithm using VP(period, 1) or TP(period, 1) hangs on its first bar.
Potential Solution
CalculateValueArea (Indicators/MarketProfile.cs) loops with
while (currentVolume <= ValueAreaVolume && ValueAreaVolume != 0)
where ValueAreaVolume = totalVolume * _valueAreaVolumePercentage. With a percentage of 1 the target is the total volume, so currentVolume <= ValueAreaVolume is still true once the area covers every price level. At that point nextMinIndex == lastMin and nextMaxIndex == lastMax, so lowVolume and highVolume are both 0. The first branch (highVolume == 0) is taken, adds 0 to currentVolume, and leaves minIndex unchanged. The final else { break; } is unreachable, so the loop never exits.
Fix: stop the loop when the area can't grow any further, i.e. when both nextMinIndex == lastMin and nextMaxIndex == lastMax (or equivalently when lowVolume == 0 && highVolume == 0). Results for percentages below 1 are unaffected since the loop already terminates before the edges in those cases. PR #9958 implements this.
Reproducing the Problem
var vp = new VolumeProfile(period: 3, valueAreaVolumePercentage: 1m);
var time = new DateTime(2024, 1, 1);
vp.Update(new TradeBar(time, Symbols.SPY, 100m, 100m, 100m, 100m, 1000m)); // never returns
Multiple price levels also hang:
var vp = new VolumeProfile(period: 3, valueAreaVolumePercentage: 1m);
vp.Update(new TradeBar(time, Symbols.SPY, 100m, 100m, 100m, 100m, 1000m));
vp.Update(new TradeBar(time.AddMinutes(1), Symbols.SPY, 101m, 101m, 101m, 101m, 500m));
vp.Update(new TradeBar(time.AddMinutes(2), Symbols.SPY, 102m, 102m, 102m, 102m, 200m));
Running either in a task with a 10 second timeout times out on master. The same applies to TimeProfile, which shares CalculateValueArea.
System Information
Reproducible on current master (2e55894c8), any OS. Reported from Ubuntu with .NET SDK 10.0.403.
Checklist
- I have completely filled out this template
- I have confirmed that this issue exists on the current
masterbranch - I have confirmed that this is not a duplicate issue by searching issues
- I have provided detailed steps to reproduce the issue
- Lingua principale
- C#
- Stelle
- 22.3k
- Fork
- 5.4k
- Merge medio
- 1g 6h
- PR unite (30g)
- 37
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di QuantConnect/Lean
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
QuantConnect/Lean#9957 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
QuantConnect/Lean#9955 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
QuantConnect/Lean#9953 ·
I maintainer di solito rispondono entro 1 giorno
-
WebullFeeModel charges SPXW options the SPX exchange feeForse già presa @Amadeus-22 l’ha presa 10 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
QuantConnect/Lean#9922 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
TradeStationBrokerageModel rejects extended-hours limit orders on equity optionsForse già presa @AlexCatarino l’ha presa 9 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
QuantConnect/Lean#9920 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di QuantConnect/Lean
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Dashboard renders attachment links that resolve to 404 when the FILES binding is absentApertabug 優先: 低
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
.NET area: storage bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Larson-Logan/medal-sync#61 ·
I maintainer di solito rispondono entro 1 giorno