Fixed : Set Profit Target, Set Stop Loss source code is not accessible



If we use "Set Profit target" or "Set Stop Loss",  we are getting an error while generating the source code :

An error occured while generating the strategy XML source code.
Exc. When calling function "childWithKeyExists", required parameter "block" (parameter #1) was specified, but had null/missing value.

----
Tip: If the parameter value expression on the caller side is known to be legally null/missing, you may want to specify a default value for it with the "!" operator, like paramValue!defaultValue.
----

----
FTL stack trace ("~" means nesting-related):
    - Failed at: #function childWithKeyExists(block, key)  [in template "global/globalFunctions.inc" in function "childWithKeyExists" at line 240, column 1]
    - Reached through: #include includeFile  [in template "MetaTrader5\\Main.tpl" at line 693, column 4]
----





the TPL file are not working correctly :



      // Move PT to       if(sqSelectPosition(<@printMagicNumber block />, <@printSymbol block />, <@printParam block "#Direction#" />, <@printComment block />)) {  <#if childWithKeyExists(block, "#ProfitTarget#") == true>          sqSetSLPT(PositionGetInteger(POSITION_TICKET), 0, sqFixMarketPrice(<@printRangeLevelMethod block "#ProfitTarget#" "price" />, PositionGetString(POSITION_SYMBOL))); <#else>          sqSetSLPT(PositionGetInteger(POSITION_TICKET), 0, sqFixMarketPrice(<@printRangeLevelMethod block "#ProfitTarget.ProfitTarget#" "price" />, PositionGetString(POSITION_SYMBOL))); </#if>             }






      // Move SL        if(sqSelectPosition(<@printMagicNumber block />, <@printSymbol block />, <@printParam block "#Direction#" />, <@printComment block />)) { <#if childWithKeyExists(block, "#StopLoss#") == true>          sqSetSLPT(PositionGetInteger(POSITION_TICKET), sqFixMarketPrice(<@printRangeLevelMethod block "#StopLoss#" "price" />, PositionGetString(POSITION_SYMBOL)), 0); <#else>          sqSetSLPT(PositionGetInteger(POSITION_TICKET), sqFixMarketPrice(<@printRangeLevelMethod block "#StopLoss.StopLoss#" "price" />, PositionGetString(POSITION_SYMBOL)), 0); </#if>        }





Please see attached video and test template


https://drive.proton.me/urls/JF13D8H6W0#Rke415djkvSs




Attachments
O UB 547 test Profit Target.sqx
(5.99 KiB)
image-0.png
(66.32 KiB)
  • Votes +1
  • Project AlgoWizard
  • Type Bug
  • Status Fixed
  • Priority Normal

History

E
#1

Emmanuel

18.09.2023 13:04

Task created

E
#2

Emmanuel

18.09.2023 13:04
Voted for this task.
E
#3

Emmanuel

18.09.2023 13:34

Description changed:



If we use "Set Profit target" or "Set Stop Loss",  we are getting an error while generating the source code :

An error occured while generating the strategy XML source code.
Exc. When calling function "childWithKeyExists", required parameter "block" (parameter #1) was specified, but had null/missing value.

----
Tip: If the parameter value expression on the caller side is known to be legally null/missing, you may want to specify a default value for it with the "!" operator, like paramValue!defaultValue.
----

----
FTL stack trace ("~" means nesting-related):
    - Failed at: #function childWithKeyExists(block, key)  [in template "global/globalFunctions.inc" in function "childWithKeyExists" at line 240, column 1]
    - Reached through: #include includeFile  [in template "MetaTrader5\\Main.tpl" at line 693, column 4]
----





the TPL file are not working correctly :



      // Move PT to       if(sqSelectPosition(<@printMagicNumber block />, <@printSymbol block />, <@printParam block "#Direction#" />, <@printComment block />)) {  <#if childWithKeyExists(block, "#ProfitTarget#") == true>          sqSetSLPT(PositionGetInteger(POSITION_TICKET), 0, sqFixMarketPrice(<@printRangeLevelMethod block "#ProfitTarget#" "price" />, PositionGetString(POSITION_SYMBOL))); <#else>          sqSetSLPT(PositionGetInteger(POSITION_TICKET), 0, sqFixMarketPrice(<@printRangeLevelMethod block "#ProfitTarget.ProfitTarget#" "price" />, PositionGetString(POSITION_SYMBOL))); </#if>             }






      // Move SL        if(sqSelectPosition(<@printMagicNumber block />, <@printSymbol block />, <@printParam block "#Direction#" />, <@printComment block />)) { <#if childWithKeyExists(block, "#StopLoss#") == true>          sqSetSLPT(PositionGetInteger(POSITION_TICKET), sqFixMarketPrice(<@printRangeLevelMethod block "#StopLoss#" "price" />, PositionGetString(POSITION_SYMBOL)), 0); <#else>          sqSetSLPT(PositionGetInteger(POSITION_TICKET), sqFixMarketPrice(<@printRangeLevelMethod block "#StopLoss.StopLoss#" "price" />, PositionGetString(POSITION_SYMBOL)), 0); </#if>        }





Please see attached video and test template


https://drive.proton.me/urls/JF13D8H6W0#Rke415djkvSs




TT
#4

Tamas

22.01.2024 09:54

Status changed from New to Waiting for information

Attachment image-0.png added

image-0.png
(317.82 KiB)
Hello Emmanuel, I am not able to reproduce the bug in the latest build of sqx138. Screenshot attached as a proof :)


I have noticed that you have sqx137 in the video.

Do you still have the same problem with sq138 or can we close the task?


If you still face the problem, please attach the problematic strategies from your databank + the template file.

E
#5

Emmanuel

14.02.2024 13:37

Attachment image-0.png added

image-0.png
(83.19 KiB)
Hello Tomas,


I tested it on Build 138.


 it is working fine as well on my side now with Build 138.


Thank you for your answer and for your excellent work !!

E
#6

Emmanuel

14.02.2024 13:37

Subject changed from Urgent : Set Profit Target, Set Stop Loss source code is not accessible to Solved : Set Profit Target, Set Stop Loss source code is not accessible

E
#7

Emmanuel

14.02.2024 13:38

Subject changed from Solved : Set Profit Target, Set Stop Loss source code is not accessible to Fixed : Set Profit Target, Set Stop Loss source code is not accessible

TT
#8

Tamas

14.02.2024 13:55

Status changed from Waiting for information to Fixed


Votes: +1

Drop files to upload

or

choose files

Max size: 5MB

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

...
Wait please