[Build 135] Faulty/Non-Compiling MQL5 code with BearsPower/BullPower

If the BearsPower/BullsPower indicators are used in combination with another instance of itself or combined with a completely different indicator for the entries when building a strategy with the MT5 engine, the exported MQL5 code is faulty and won´t compile. Example:

The generated pseudo-Code is correct:


LongEntrySignal = ((BearsPower(Main chart,BPPeriod)[BPShift] is falling) and (BearsPower(Main chart,BPPeriod2)[BPShift] is falling)); ShortEntrySignal = ((BullsPower(Main chart,BPPeriod)[BPShift] is rising) and (BullsPower(Main chart,BPPeriod2)[BPShift] is rising)); LongExitSignal = BooleanValue; ShortExitSignal = BooleanValue;


But the created MQL5 code is faulty, both BearsPower generates nonsense:


if (_sqIsBarOpen == true) { // init signals only on bar open LongEntrySignal = (sqIsFalling(!!! BEARSPOWER_NULL_0_BPPeriod_3 not found in [BULLSPOWER_NULL_0_3_BPPeriod, BULLSPOWER_NULL_0_3_BPPeriod2, LOWEST_NULL_0_1_Period, ATR_NULL_0_19, ATR_NULL_0_122, ATR_NULL_0_222, HIGHEST_NULL_0_1_Period, HEIKENASHI_NULL_0, ], 2, false, 1) && sqIsFalling(!!! BEARSPOWER_NULL_0_BPPeriod2_3 not found in [BULLSPOWER_NULL_0_3_BPPeriod, BULLSPOWER_NULL_0_3_BPPeriod2, LOWEST_NULL_0_1_Period, ATR_NULL_0_19, ATR_NULL_0_122, ATR_NULL_0_222, HIGHEST_NULL_0_1_Period, HEIKENASHI_NULL_0, ], 2, false, 1)); ShortEntrySignal = (sqIsRising(BULLSPOWER_1, 2, false, 1) && sqIsRising(BULLSPOWER_2, 2, false, 1)); LongExitSignal = false; ShortExitSignal = false; }



As can be seen in the LongEntrySignal, this isn´t valid code (like in the ShortEntrySignal where it is correct) and won´t compile:


'BEARSPOWER_NULL_0_BPPeriod_3' - undeclared identifier BPError.mq5 269 41 'not' - undeclared identifier BPError.mq5 269 70 'not' - some operator expected BPError.mq5 269 70 'found' - unexpected token BPError.mq5 269 74 'BEARSPOWER_NULL_0_BPPeriod2_3' - undeclared identifier BPError.mq5 270 28 'not' - undeclared identifier BPError.mq5 270 58 'not' - some operator expected BPError.mq5 270 58 'found' - unexpected token BPError.mq5 270 62 8 errors, 1 warnings 9 2


Both definitions for the 2 BearsPower indicators that the strategy uses are not even defined in the code, only the 2 BullsPower are defined.


#define BULLSPOWER_1 0 //iCustom(NULL,0, "SqBullsPower", BPPeriod, PRICE_LOW) #define BULLSPOWER_2 1 //iCustom(NULL,0, "SqBullsPower", BPPeriod2, PRICE_LOW)


The only way to fix this issue is to "Edit" the strategy in the AlgoWizard, not changing anything, and saving it back to the Retester. Now the generated code is correct:




#define BEARSPOWER_1 0 //iCustom(NULL,0, "SqBearsPower", BPPeriod, PRICE_LOW) #define BEARSPOWER_2 1 //iCustom(NULL,0, "SqBearsPower", BPPeriod2, PRICE_LOW) #define BULLSPOWER_1 2 //iCustom(NULL,0, "SqBullsPower", BPPeriod, PRICE_LOW) #define BULLSPOWER_2 3 //iCustom(NULL,0, "SqBullsPower", BPPeriod2, PRICE_LOW) ................. ................. if (_sqIsBarOpen == true) { // init signals only on bar open LongEntrySignal = (sqIsFalling(BEARSPOWER_1, 2, false, 1) && sqIsFalling(BEARSPOWER_2, 2, false, 1)); ShortEntrySignal = (sqIsRising(BULLSPOWER_1, 2, false, 1) && sqIsRising(BULLSPOWER_2, 2, false, 1)); LongExitSignal = false; ShortExitSignal = false; }



I´ve already mentioned this issue to Tomas Vanek and sent an example strategy to him including my whole SQX installation in January 2022. But never heard back since then as he mentioned that "someone else" will fix this issue after he was also able to reproduce it. However, so far, it ain´t fixed. Thank you.

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

History

g
#1

geektrader

07.04.2022 01:43

Task created

g
#2

geektrader

07.04.2022 01:43
Voted for this task.
b
#3

bentra

07.04.2022 02:29
Voted for this task.
GA
#4

GaryAitcheson

07.04.2022 09:52
Voted for this task.
TV
#5

Tomas Vanek

07.04.2022 11:10

Attachment image-0.png added

image-0.png
(120.51 KiB)
This issue was already fixed in the patch of 135. We have tested this issue in build 136 with the strategy that you have provided and it works without any problems. See attached screenshot.
TV
#6

Tomas Vanek

07.04.2022 11:26
E
#7

Emmanuel

07.04.2022 13:41
Voted for this task.
MF
#8

Marti

07.04.2022 22:46
Voted for this task.
TT
#9

Tamas

07.09.2022 10:40

Status changed from New to Fixed


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