How can I get this?

 

How can i get this parts (marked in red) on the graph?

I'm trying this:

bool isThereAHole(int dist=10,int mode=1){
int downs=0,ups=0;
for(int i=1;i<=dist;i++){
if(Close[i]>Open[i] && Open[i+1]>Open[i]){
downs++;
}
if(Close[i]<Open[1] && Open[i+1]<Close[i]){
ups++;
}
}
if(dows<ups){
return(false);
}else{
int b;
if(subindo == 2){
if(Open[0]>Open[1] || Close[0]>Close[1])
b++;
if(!ObjectCreate("fundo",OBJ_VLINE,0,Time[0],Close[0])){
if(GetLastError() == 4200)
ObjectCreate("fundo["+b+"]",OBJ_VLINE,0,Time[0],Close[0]);
if(GetLastError()!=0)
Print("Error N°:"+GetLastError());
}else{
if(!ObjectSet("Fundo",OBJPROP_COLOR,Red))
Print("error"+GetLastError());
}
}else{
return(false);
}
}
return(false);
}



But it doesn't returns me what i want. I want to get exactlywhen it starts to come up, but i have no idea about how to do it.
Can someone help me? =)