Simple green bar testing count - page 2

 
Adj007 #:
Bless you for helping me with this problem. When a red candle appears it counts back the number instead of not counting. I have a different code on my DoFile that gives the same results. 

again, I do not know what you are saying...

the code I just provided only counts the number of green bars in the 10 bar loop that you wanted..

 

green (1), green (2), red (1), green(2), green(3), red(2). 


red has just taken away 1 from the second green candle which equates to 1. There are 4 green candles, but the count says 2 instead. 

 
Adj007 #:

green (1), green (2), red (1), green(2), green(3), red(2). 


red has just taken away 1 from the second green candle which equates to 1. There are 4 green candles, but the count says 2 instead. 

Not with the code I gave you

 

I've found the solution ! Adding these commands into the function helps the function to recognize the specificity of counting just green candles and also counting candles in general. Proud of this result, another one to add to the DoFile. case SOLVED

Those who are reading this post and need some help, dont hesitate to give me a message and I can help you with the code by explaining the logic to extend this as a signal ! 

//// count green candles WITHOUT resetting the count 
int CheckCount()

{
double count;
count = 0;
bool result = false;
int lookback= iBarShift("EURAUD",PERIOD_M5,Time[1]); // looks back 1 when putting THIS command into the for loop
   int m = TimeMinute(TimeCurrent()); 
   int h = TimeHour(TimeCurrent());
   int bars = ((h*60)+m)/5; // calculate and tell the ea that we ONLY want the count for every 5 minutes. 

// this is a very interesting find because using else if is redundant as the function will ONLY count what you are inputting after the for loop and nothing more.



"" "" ""