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)
Status changed from New to In progress
it looks like you do it right.
I'll try to summarize what you need to do to create a new candle pattern MyHammer:
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
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
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