Stagnation: Incorrect Computation

In SQX, stagnation is assumed passed, whenever a higher high is generated.

But, as shown in below, stagnation is not just a higher high, but is a higher high if never reached below it again.
Please whether correct the computation, or add another metric for these situations.

Attachments
image-0.png
(79.79 KiB)
image-0.png
(73.13 KiB)
  • Votes +3
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

AA
#1

Alex

14.06.2022 09:19

Task created

AA
#2

Alex

14.06.2022 09:19

Attachment Stagnation.png added

Stagnation.png
(53.24 KiB)
In SQX, stagnation is assumed passed, whenever a higher high is generated.

But, as shown in below, stagnation is not just a higher high, but is a higher high if never reached below it again.
Please whether correct the computation, or add another metric for these situations.

AA
#3

Alex

14.06.2022 10:04

Attachment Stagnation2.png added

Attachment Stagnation3.png added

Attachment Stagnation3.png deleted

Stagnation2.png
(88.06 KiB)
Another Example is Attached
AA
#4

Alex

14.06.2022 10:11

Attachment Stagnation3.png added

Stagnation3.png
(103.75 KiB)
And a more clear one, which shows great difference in real stagnation, and one shown by SQX.
AA
#5

Alex

14.06.2022 10:12
Voted for this task.
E
#6

Emmanuel

20.06.2022 21:44
Voted for this task.
KB
#7

kbtech

01.09.2022 23:10
Voted for this task.
g
#8

Lee Guan Chuan

14.11.2022 08:42

Status changed from New to Fixed

AA
#9

Alex

15.11.2022 06:18

Attachment Strategy 11455.sqx added

Strategy 11455.sqx
(158.48 KiB)
Dear Lee,

May I ask you to show an screenshot of new stagnation for below strategy?

g
#10

Lee Guan Chuan

15.11.2022 06:36

Attachment image-0.png added

image-0.png
(73.13 KiB)
Hi Alex, 


This is the stagnation that I tested on GBPUSD H1.


However, this fix is not in DEV 7. You have to wait for the next DEV release.


Thank you.

AA
#11

Alex

15.11.2022 07:15
Great! thank you
AA
#12

Alex

15.11.2022 08:05
As a suggestion:

You can make another metric called "max new high duration", which works like stagnation in previous versions.

This helps for people who interested in using previous version. (Some kind of backward compatibility)

g
#13

Lee Guan Chuan

16.11.2022 02:28

Attachment MaxNewHighDuration.jpg added

MaxNewHighDuration.jpg
(94.61 KiB)
Hi Alex,


Max New High Duration implemented.


Thank you.

AA
#14

Alex

29.11.2022 06:33

Attachment Screenshot 2022-11-29 071829.png added

Screenshot 2022-11-29 071829.png
(32.47 KiB)
Hi Lee,

I just downloaded 136-RC1.

In charts I can not see stagnation which is really important and you solved this issue.

Please show it on charts.

g
#15

Lee Guan Chuan

29.11.2022 06:53
Hi Alex,


It shows correctly from my side.

Have you run the backtest again in 136-RC1? Can you try this?


If stagnation/max new high drawdown doesn't show after you re-run the backtest, can you send me the strategy file so I can test it from my side?


Thank you.

AA
#16

Alex

29.11.2022 07:53

Attachment GBPUSD_H1_1201332143.sqx added

Attachment Screenshot 2022-11-29 084836.png added

Attachment Screenshot 2022-11-29 084903.png added

Attachment Screenshot 2022-11-29 083856.png added

GBPUSD_H1_1201332143.sqx
(242.85 KiB)
Screenshot 2022-11-29 084836.png
(182.45 KiB)
Screenshot 2022-11-29 083856.png
(120.87 KiB)
Screenshot 2022-11-29 084903.png
(145.83 KiB)

No correct calculations. (images before and after retest is shown)

Generally: stagnation MUST be always greater or equal to max new high.


Another new bug: stagnation can not be turned off inside chart.


These strategies are default ones that exists inside SQX.

last image (which is for another strategy) shows stagnation that can be added to the calculated one.


Also I think if calculation of stagnation is updated, there is no need to show max new high on chart.

We can only have it inside ranking.


g
#17

Lee Guan Chuan

30.11.2022 04:15
Hi Alex,


The stagnation issue was caused by, its direct use the next new high value once it found a new break out from the equity chart. Therefore, it has ignored value between the last stagnation might have longer stagnation times. I have fixed this.


For the list of strategies that come with SQX still shows stagnation from the old logic. I will backtest the strategies and update the strategies with the latest stagnation.

Unfortunately, the stagnation was calculated when backtest happened, so if the logic has been updated in the new SQX version, all the strategies have to backtest again.


Thank you.

g
#18

Lee Guan Chuan

01.12.2022 10:13
Hi Alex,


We have reverted the Stagnation to the original Stagnation. This is because there are users that rely on this for their workflow. 

However, we are renaming the Stagnation that you mentioned into Max Drawdown Duration.


Thank you.

g
#19

Lee Guan Chuan

02.12.2022 16:10

Status changed from Fixed to In progress

I found that some scenarios need to take care of too. I will change this to In progress first.
g
#20

Lee Guan Chuan

04.12.2022 01:41

Status changed from In progress to Fixed

AA
#21

Alex

16.02.2023 07:05

Attachment Screenshot 2023-02-16 075300.png added

Attachment Strategy 34645.sqx added

Attachment photo_2023-02-16_07-58-43.jpg added

Strategy 34645.sqx
(55.40 KiB)
photo_2023-02-16_07-58-43.jpg
(57.60 KiB)
Screenshot 2023-02-16 075300.png
(150.74 KiB)
Hi,

Still there are some issues.

Attached is strategy and result of test in 136-final.

============

Another suggestion (not related to this bug shown in 1st picture, related to correct ones):

Why you do not change the name to the correct ones?

Definitely what you show as stagnation is max drawdown duration.

and what you show as max drawdown duration is the real stagnation!

last photo is taken from page 21 of book quantitative trading by Ernest P. Chan.

It shows what I say.


g
#22

Lee Guan Chuan

23.02.2023 04:35

Attachment Screenshot 2023-02-23 at 113245 AM.png added

Screenshot 2023-02-23 at 113245 AM.png
(364.10 KiB)
Hi Alex,


Have you retested the strategy? As shown in the picture, I have tested it, and it worked correctly.


For the naming unfortunately, I cannot change the name right now. There are users already practising using the original Stagnation. If we change it, it will affect the number of running workflows used by many users. Due to different formulas, the filter will work slightly differently, too.


Thank you.

AA
#23

Alex

24.02.2023 09:32

Dear Lee,

The strategy is tested with SQX136 Final.

It seems underlying symbol specifications are different (see profits and chart difference of my results and yours).

Currently I do not have access to it. Will send you mine soon.

AA
#24

Alex

27.02.2023 11:58

Attachment Screenshot 2023-02-27 125002.png added

Screenshot 2023-02-27 125002.png
(45.37 KiB)

Dear Lee,

The strategy is tested with SQX136 Final.

It seems underlying symbol specifications are different. attached is mine.

AA
#25

Alex

16.04.2023 12:52
Hi Lee,

Any updates?

Also as mentioned before, what you show as "max drawdown duration" is the real stagnation!

Please change the name from "max drawdown duration" to "StagnationV2" to avoid misunderstandings.


g
#26

Lee Guan Chuan

27.04.2023 08:14
Hello,


This is fixed. I found the issue.


Thank you.

AA
#27

Alex

27.04.2023 08:32

Hi Lee,

Thanks.

Have you also changed the name from "max drawdown duration" to something like "StagnationV2" to avoid misunderstandings?

g
#28

Lee Guan Chuan

27.04.2023 09:01
Yes. It called Stagnation V2 now.
AA
#29

Alex

11.09.2023 07:16
Stagnation V2 is shown only on charts in SQX137.

In other places it is still Max drawdown duration.

Please also change it in ranking filters.

AA
#30

Alex

17.09.2023 09:36
Also I recommend it another time:

What you named here as Stagnation, is exactly Max DD Duration.

And what named here as Max DD Duration, is exactly Stagnation.


Please correct these names!


Votes: +3

Drop files to upload

or

choose files

Max size: 5MB

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

...
Wait please