sqHammer contains error

Someone who was creating this code based on Shooting Star code probably forgot to change all these parameters to the opposite (first condition in each row was corrected, the second was not).


The key IF conditions are:


if(L < L1 && L < L2 && L < L3 )  {
  if(LW_D2 > UW && UW > BL90_M2 && CL >= CL_MPV && O != C && LW_D3 <= UW && LW_D4 <= UW)  {


       return(true);

      }
      if(LW_D3 > UW && UW > BL90_M2 && CL >= CL_MPV && O != C && LW_D4 <= UW)  {


          return(true);

      }
      if(LW_D4 > UW && UW > BL90_M2 && CL >= CL_MPV && O != C)  {


       return(true);





IT SHOULD BE:




if(L < L1 && L < L2 && L < L3 )  {
  if(LW_D2 > UW && LW > BL90_M2 && CL >= CL_MPV && O != C && LW_D3 <= UW && LW_D4 <= UW)  {


        return(true);

      }
      if(LW_D3 > UW && LW > BL90_M2 && CL >= CL_MPV && O != C && LW_D4 <= UW)  {


          return(true);

      }
      if(LW_D4 > UW && LW > BL90_M2 && CL >= CL_MPV && O != C)  {


        return(true);




OTHERWISE it will not find the best hammers (the ones with small body and smallest or no upper wicks).




I also don't understand why there is condition like: LW_D4 <= UW  - it means 1/4 of  lower wick is smaller than upper wick (what for ?).
It might be worth to check it closer if it is making sense (both in Hammer and similar in Shooting Star)

Attachments
No attachments
  • Votes +1
  • Project AlgoWizard
  • Type Bug
  • Status Fixed
  • Priority Normal

History

p
#1

pitro

10.05.2020 22:46

Task created

p
#2

pitro

11.05.2020 22:45
Ti Tomas, I am not sure how to contact you guys in person, 


I was trying to add my own modified/adjusted Candle Patterns using Code Editor but it didnt work. How to do it? 

Should I add new Snippet Indicator in Code Editor? I did it and made copy/paste of the content from i.e. Hammer.java snippet. I did slight adjustment to meet my needs. 

Compilation went well but  later on the strategy where I used these candle functions (I created the strategy with AlgoWizard)  did not work well. It was showing losses closing at the same minute. 


Also with AlgoWizard when I was trying to generate MQ5 code it didnt work. 

It told me that template is missing. So I added my own MyHammer.tpl in /extend/code/MetaTrader5/blocks section based on another example from Hammer.tpl and added Candle Pattern codes in SQ.mqh (I made respective copy from my older pattern versions, which I created in CustomFunctions.mq5 - they were working well there). 



Would you guide me (i.e. kind of step by step) what are the steps necessary to do new candle pattern snippet? 


My goal is to allow me to back test/optimize my strategy which I created in AlgoWizard and which has my own Candle Patterns as Snippets.


Thank you for help. Piotr

TB
#3

Tomas Brynda

14.05.2020 07:38

Status changed from New to In progress

Hi Piotr,

it looks like you do it right. 


I'll try to summarize what you need to do to create a new candle pattern MyHammer:

  1. Create a Java snippet MyHammer.java in package SQ.Blocks.CandlePatterns
  2. Add a function for calculating this pattern in /extend/code/MetaTrader5/CustomFunctions.mqh
  3. Create a freemarker template MyHammer.tpl in /extend/code/MetaTrader5/blocks and call the function defined in step 2 there

If you struggle with this, you can send me your files and I will check it out.


Thank you for your suggestion on the conditions modification, I will check that.


Best regards,

Tomas

p
#4

pitro

20.05.2020 23:41


OK thank you Tomas, I will try to create my own snippets. Will ask you for help when I face issues with it.


Thanks again, Piotr

TB
#5

Tomas Brynda

04.06.2020 11:46

Status changed from In progress to Fixed

Dw
#6

Diwi

27.06.2020 13:58
Voted for this task.

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