Why don't you search first before trying out the mistakes?
Search for doji gives me 2 links to the code base and half a dozen articles about it: https://www.mql5.com/en/search#!keyword=doji%20candle%20detection
Copy and change according your needs - it's a lot faster.
Why don't you search first before trying out the mistakes?
Search for doji gives me 2 links to the code base and half a dozen articles about it: https://www.mql5.com/en/search#!keyword=doji%20candle%20detection
Copy and change according your needs - it's a lot faster.
Dear Carl
Thanks a lot for your response. Yes I used to do the same, and even now sometimes I do search. Anyway for me it actually consumes more time then looking out for mistake. I had downloaded Candle Pattern detector long back and done a lot of modifications in the same, as text book definitions does work efficiently in real life.
Lately I was introduced to Heiken Ashi Candles and on the basis of earlier 'Candle Pattern Detector' I have make my own HA Candle Pattern Detector, including defining what HA Doji etc should be.
This was an attempt to identify patterns with separate methods, and I discovered that same candle is detected by two different patterns. That is where I started looking deep into my code and could not find any logical reasoning for the same.
THIS IS TIME WHEN I RESORTED TO SEEK EXPERTS OPINION ON THE FORUM. This way I think learning process goes on. But it seems all dont share the same view here!!!
Anyway I have rewritten the code again in a different style and initial tests seems to be promising. I am attaching it here, for someone who may be benefitted by it.
//+-----------------------------------------------------------------------------------------------------------------------------+ //| METHOD: GetHACandleType() //| APPLICATION: //+-----------------------------------------------------------------------------------------------------------------------------+ CENUM_HA_BAR CiHAshi::GetHACandleType(int pIndex) { int k = pIndex; if(GetIndexClose(k) > GetIndexOpen(k)) { if(NormalizeDouble(GetBodySize(k) / GetAmplitude(k),4) <= 0.05) { return(BULL_DOJI); } else if(NormalizeDouble(GetBodySize(k) / GetAmplitude(k),4) > 0.05 && NormalizeDouble(GetBodySize(k) / GetAmplitude(k),4) <= 0.20) { return(BULL_STOP); } else if(NormalizeDouble(GetUpperWick(k) / GetAmplitude(k),4) > 0.50 && NormalizeDouble(GetBodySize(k) / GetAmplitude(k),4) > 0.20) { return(BULL_LUW); } else if(NormalizeDouble(GetLowerWick(k) / GetAmplitude(k),4) <= 0.01 && NormalizeDouble(GetUpperWick(k) / GetAmplitude(k),4) <= 0.50 && NormalizeDouble(GetBodySize(k) / GetAmplitude(k),4) > 0.20) { return(BULLISH); } else return(BULL_WEAK); } else if(GetIndexClose(k) < GetIndexOpen(k)) { if(NormalizeDouble(GetBodySize(k) / GetAmplitude(k),4) <= 0.05) { return(BEAR_DOJI); } else if(NormalizeDouble(GetBodySize(k) / GetAmplitude(k),4) > 0.05 && NormalizeDouble(GetBodySize(k) / GetAmplitude(k),4) <= 0.20) { return(BEAR_STOP); } else if(NormalizeDouble(GetLowerWick(k) / GetAmplitude(k),4) > 0.50 && NormalizeDouble(GetBodySize(k) / GetAmplitude(k),4) > 0.20) { return(BEAR_LLW); } else if(NormalizeDouble(GetUpperWick(k) / GetAmplitude(k),4) <= 0.01 && NormalizeDouble(GetLowerWick(k) / GetAmplitude(k),4) <= 0.50 && NormalizeDouble(GetBodySize(k) / GetAmplitude(k),4) > 0.20) { return(BEARISH); } else return(BEAR_WEAK); } return(WRONG_VALUE); } // END Of GetHACandleType()

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear Members
I have challenge to identify Bullish candle with attached code. Codes for Calculating BEAR_Doji / BEAR_SpinningTop / BEAR_LONGLOWERWICK candles also attached just in case needed by members for understanding.
Thanks in advance for your cooperation and suggestions.
regards