Your code bool Rule1 = false; if(M5_Rates[1].open < M5_Rates[2].open) Rule2 = true;
Simplified bool Rule1 = M5_Rates[1].open < M5_Rates[2].open;
Your code if((Rule1 == true) && (Rule2 == true) && ((Rule3 == true) || (Rule4 == true)) && (Rule5 == true) && (Rule6 == true)) return(true); else return(false);
Simplified return Rule1 && Rule2 && (Rule3 || Rule4) && Rule5 && Rule6;
You would never write if( (2+2 == 4) == true) would you? if(2+2 == 4) is sufficient. So don't write if(bool == true), just use if(bool) or if(!bool).
-
for(int i = 1; i < 10; i++) { Pattern_M5.Check_Pattern(i,CANDLE_BULLISH_ENGULFING); Rule1 = true; }
Why is there a loop here? Why are you always setting Rule1 true nine (9) times?
William Roeder:
Thanks William,
about bool variable, I was confuse to use Simplified way, but now it is clear :)
the for..loop it to check if at least one Bullish Candle in previous 9 bars, as EMA sync and MACD Crossing may not sync with exactly previous bar being Bulling Engulfing. This code is run on IsNewBarM5, so will check previous 9 bars on each run.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Dear Members
I am trying following code for Pullback LONG, but feels a bit complicated. Also they give false signals when in RANGE.
Can someone suggest a correct and simple way to find pullbacks?