136 dev 5 - Corrupted Ulcer Strategy coming from builder with wrong UI_MODE for short side

Should be coming symmetrical but Ulcer has this UI_MODE bug. UI_MODE 1 should reverse to UI_MODE 2 but it doesn't and it is invisible in pseudo code and even AW.

In short all I did was remove and add the short Ulcer condition in the same way it appeared originally and then voila it was fixed. 

1. Took what came from builder and tested it for symmetry and it failed miserably.

2. Took the same strategy and removed the short signal and re-added the short signal exactly as it appeared before.
3. It retests nicely symmetrical.

I think it has to do with the UI_MODE. It comes out of builder on the short side with the wrong UI_MODE and you can't see it in algowizard but you can see it in the xml.


These two strats appear the same in the AW but they test differently and the xml is subtly different.


P.S. Normally we could work around this bug by specifying the uimode inside the parameters of the block but sadly we also have this bug causing the parameters not to be respected: 
https://roadmap.strategyquant.com/tasks/sq4_9294
(I have default Parameters for Ulcer Down rising but the builder isn't respecting the UI_MODE setting. Scroll down for screenshots.)


EDIT, REGARDING THE ATTACHED STRATEGIES
ulcer-broken-9
This is how it comes from the builder and it is broken. It does not behave symmetrically in SQX. It produces unsymmetrical mql code. It has an erroneous "Mode" specified in the XML. It looks normal in Pseudocode but it is broken. 

ulcer-broken-10
This is how it comes if you build it in algowizard and set up the "Mode" properly. It is correctly functioning. It behaves symmetrically. It gives the correct mql5 code. It has the correct "Mode" specified in the XML. It looks like the same pseudocode as the one above but this strategy is actually functioning properly.

We need the builder to build them like the ulcer-broken-10 file. The only difference between these two files that I can find is the XML

Attachments
  • Votes +5
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

b
#1

bentra

23.09.2022 15:34

Task created

b
#2

bentra

23.09.2022 15:35

Attachment ulcer-broken-9.sqx added

Attachment ulcer-broken-10.sqx added

Attachment Screenshot_174.png added

Attachment Screenshot_173.png added

Screenshot_174.png
(53.22 KiB)
Screenshot_173.png
(53.19 KiB)
ulcer-broken-10.sqx
(125.81 KiB)
ulcer-broken-9.sqx
(125.30 KiB)
b
#3

bentra

23.09.2022 15:36

Subject changed from Corrupted Ulcer Strategy coming from builder with wrong UI_MODE for short side to 136 dev 4 - Corrupted Ulcer Strategy coming from builder with wrong UI_MODE for short side

b
#4

bentra

23.09.2022 15:58

Description changed:

Should be coming symmetrical but Ulcer has this UI_MODE bug. UI_MODE 1 should reverse to UI_MODE 2 but it doesn't and it is invisible in pseudo code and even AW.

In short all I did was remove and add the short Ulcer condition in the same way it appeared originally and then voila it was fixed. 

1. Took what came from builder and tested it for symmetry and it failed miserably.

2. Took the same strategy and removed the short signal and re-added the short signal exactly as it appeared before.
3. It retests nicely symmetrical.

I think it has to do with the UI_MODE. It comes out of builder on the short side with the wrong UI_MODE and you can't see it in algowizard but you can see it in the xml.


These two strats appear the same in the AW but they test differently and the xml is subtly different.


P.S. Could be related to this: 
https://roadmap.strategyquant.com/tasks/sq4_9294

because yeah, I have default Parameters for Ulcer Down rising but the builder isn't respecting the UI_MODE setting.


Attachment Screenshot_177.png added

Attachment Screenshot_176.png added

Attachment Screenshot_175.png added

Screenshot_177.png
(110.26 KiB)
Screenshot_175.png
(220.71 KiB)
Screenshot_176.png
(275.66 KiB)
E
#5

Emmanuel

24.09.2022 11:59
Voted for this task.
b
#6

bentra

25.09.2022 06:00
Voted for this task.
CG
#7

Chris G

26.09.2022 16:03
Voted for this task.
HH
#8

Hans

27.09.2022 00:00
Voted for this task.
IH
#9

clonex / Ivan Hudec

03.10.2022 12:26
Maros toto sa ani neda len tak opravit.  Ide o toto:


Ulcer index je indikator ktory ma dva mody.  Long / Short.


Malo by to by takto. 


Mam 


UI(Mode,Period) 




UI(1,24)>0 


tak short by mal byt 


UI(2,24)<0


Su dve riesenia:


1)ze to njak vies ohandlovat

2)alebo ho rozdelime na dva indikatory na Long a Short verziu


ide o to ze ked pojde v builderi  tento indy tak on vzdy bude hladat opositne bloky s v rovnaom mode. A nie v druhom mode.



b
#10

bentra

19.10.2022 07:36
Not fixed in 136 dev 6 even though it's marked fixed and with that milestone....
MF
#11

Mark Fric

19.10.2022 11:26

Status changed from Fixed to In progress

what exactly is not working? 


LongEntrySignal = UlcerIndex(Main chart, UP UI, UlcerIndexiPeriod1)[2]   is rising;
ShortEntrySignal = UlcerIndex(Main chart, Down UI, UlcerIndexiPeriod1)[2]   is rising;

It seems correct to me. I'm testing creation of negation rules in builder, if something is not working please describe it better.
b
#12

bentra

19.10.2022 15:19

Attachment Screenshot_317.png added

Screenshot_317.png
(102.82 KiB)
It looks OK in the pseudo-code but it is not OK in the XML and obv it is not behaving OK.

Check the XML. The UI Mode for the short side is actually "Up UI" (1) instead of "Down UI" (2) even though it shows "Down UI" in the pseudocode.
MF
#13

Mark Fric

21.10.2022 09:40

Status changed from In progress to Fixed

no, it is fixed. You are referring to UlcerIndexDown**** or UlcerIndexUP**** snippets, but the mode value is hardcoded there (Down or Up)  in the translation scripts in /extend/Code, so it doesn't really use the Mode from XML.

It works correctly including XMl for simple UlcerIndex snippet.


b
#14

bentra

21.10.2022 15:57

Attachment Screenshot_324.png added

Attachment Screenshot_325.png added

Attachment ulcer-broken-9.sqx added

Attachment ulcer-broken-10.sqx added

Attachment dev6-fresh-broken-example.sqx added

Screenshot_324.png
(85.21 KiB)
ulcer-broken-9.sqx
(125.30 KiB)
dev6-fresh-broken-example.sqx
(1.15 MiB)
Screenshot_325.png
(68.39 KiB)
ulcer-broken-10.sqx
(125.81 KiB)
But the two strategies I supplied (files ulcer-broken-9 and ulcer-broken-10) behave differently in SQX even though the only difference is the xml bit. They look the same in pseudocode, and look the same in algowizard but behave differently in SQX. The one that has the wrong xml code and is not behaving correctly is the one that came from the builder. And the builder is still building them this way in 136 dev 6. So, no, this is not fixed, there is still a problem. 

Here's a fresh example from build 136 dev 6:
Even though the pseudocode looks right and the algowizard form looks right this strat still behaves unsymmetrically in SQX and produces this unsymmetrical MQL5 code.

(dev6-fresh-broken-example)
//------------------------
// Rule: Trading signals
//------------------------
if (_sqIsBarOpen == true) {
     // init signals only on bar open 
     LongEntrySignal = ((sqClose("NULL",02) > sqGetIndicatorValue(GANNHILO_1, 02))
      &&   sqIsRising(ULCERINDEX_1, 2false5));

     ShortEntrySignal = ((sqClose("NULL",02) < sqGetIndicatorValue(GANNHILO_1, 02))
      &&   sqIsRising(ULCERINDEX_1, 2false5));

   }


Should be this


//------------------------
// Rule: Trading signals
//------------------------
if (_sqIsBarOpen == true) {
     // init signals only on bar open 
     LongEntrySignal = ((sqClose("NULL",02) > sqGetIndicatorValue(GANNHILO_1, 02))
      &&   sqIsRising(ULCERINDEX_1, 2false5));

     ShortEntrySignal = ((sqClose("NULL",02) < sqGetIndicatorValue(GANNHILO_1, 02))
      &&   sqIsRising(ULCERINDEX_22false5));

   }


P.S. Hardcoding the mql5 translation code to look right will not fix the underlying issue. This strategy is still behaving incorrectly in SQX as well so, whatever is causing that needs to be fixed, from here it looks like the XML is causing the problem because that is the only difference I can see between a working correctly (in SQX) strategy and a broken one (files ulcer-broken-9 and ulcer-broken-10) 

HF
#15

Vence_Jo

21.10.2022 18:45
Voted for this task.
b
#16

bentra

22.10.2022 15:41
EDIT, REGARDING THE ATTACHED STRATEGIES
ulcer-broken-9
This is how it comes from the builder and it is broken. It does not behave symmetrically in SQX. It produces unsymmetrical mql code. It has an erroneous "Mode" specified in the XML. It looks normal in Pseudocode but it is broken. 

ulcer-broken-10
This is how it comes if you build it in algowizard and set up the "Mode" properly. It is correctly functioning. It behaves symmetrically. It gives the correct mql5 code. It has the correct "Mode" specified in the XML. It looks like the same pseudocode as the one above but this strategy is actually functioning properly.

We need the builder to build them like the ulcer-broken-10 file. The only difference between these two files that I can find is the XML
MF
#17

Mark Fric

25.10.2022 11:46
ok, sorry for my ommission. The whole problem is that the mode should be fixed, not configurable in all UlcerXXX signals.

Because it uses explicit mode, for example: Ulcer Index Down is rising


it doesn't make sense for Mode to be configurable at all.


I'm removing the Mode parameter in these snippets - I tested it and it shouldn't make any problems in build, retest and templates. 

If the parameter is there from older strategy, it is simply ignored, and proper fixed mode is used.


b
#18

bentra

25.10.2022 19:30
Yes, that did seem redundant, thanks for the clarification and for updating the milestone version.

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