Aberrant Extra Bars Fed to Indicators

The OnBarUpdate function for Indicator block classes ocassionally gets called with extra bars that have abnormal Volume values and identical Open, High, Low, Close values to the (correct) next bar's Open. 



As a result, indicators that update their values on each OnBarUpdate (which is almost every indicator) will have erroneous values. 
The abnormal volume (roughly 20-30x the usual volume) will break any Volume based indicator.



To demonstrate this, I've implemented a custom PriceRangeIndicator that saves the OHLCV values and constructed a basic strategy that uses this indicator. It saves in user/libs/ohlcv.csv the data it reads. Note that the indicator is called with Shift = 1, so that the input values should already be set.


Attached you will find:
1. SQExtension_20231016_DataBug.sxp -> the code extension needed to reproduce.
2. price_logger.sqx -> the basic strategy that writes OHLCV values to file
3. BTCUSDT_BIN_PERP_MT5-M1-No Session.csv -> the data used to reproduce.
4. ohlcv.csv -> the output using a single Retester run.
5. expectedData.jpg -> screenshot of how the data looks aggregated by SQX data inspector
6. actualData.jpg -> screenshot of aberrant extra bars.


Note that this bug is likely breaking the values for all indicators used in simple strategies.



Attachments
expectedData.jpg
(309.56 KiB)
BTCUSDT_BIN_PERP_MT5-M1-No Session.csv
(3.00 MiB)
price_logger.sqx
(5.25 KiB)
SQExtension_20231016_DataBug.sxp
(1.25 KiB)
actualData.jpg
(516.57 KiB)
ohlcv.csv
(113.24 KiB)
  • Votes +5
  • Project StrategyQuant X
  • Type Bug
  • Status New
  • Priority Normal

History

AS
#1

andreis

16.10.2023 12:59

Task created

AS
#2

andreis

16.10.2023 13:02
A few more notes to aid reproducibility:

1. Versioning: currently using the 137.1749 release build.

2. Instrument was created with timestamp representing Start of bars.

3. Strategy was ran as MT5 hedged. 

4. Session: No Session

JB
#3

0xjoeblack@proton.me

16.10.2023 13:02
Voted for this task.
a
#4

astral

17.10.2023 12:09
Voted for this task.
AS
#5

andreis

17.10.2023 19:39
Voted for this task.
HF
#6

Vence_Jo

17.10.2023 20:06
Voted for this task.
E
#7

Emmanuel

22.10.2023 12:28
Voted for this task.

Votes: +5

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please