Find Last Red Candle

Back to topics list  | 1 2 To post a new topic, please log in or register
avatar
872
eevviill 2016.03.04 19:38 #
 
FxTrader_:

I hope it clear :)



 

avatar
87
FxTrader_ 2016.03.04 21:15 #
 

Hi eevviill,

Thank you But your code doesn't solve the problem

avatar
872
eevviill 2016.03.04 21:54 #
 
FxTrader_:

Hi eevviill,

Thank you But your code doesn't solve the problem

Why?
avatar
87
FxTrader_ 2016.03.04 22:17 #
 
Assuming the last red candle index [5] and candle index [4,3,2,1] all closed above the High of candle [5] . I need the alert to alert me once NOT for each candle that closed above the high of last red candle.

Also if the last red candle index [5] and candle index [2,1] closed above the High of candle [5] I need the alert to alert me for candle[2] only NOT for candle [2 and 1]

dose your code do that??

avatar
872
eevviill 2016.03.04 22:47 #
 
FxTrader_:
Assuming the last red candle index [5] and candle index [4,3,2,1] all closed above the High of candle [5] . I need the alert to alert me once NOT for each candle that closed above the high of last red candle.

Also if the last red candle index [5] and candle index [2,1] closed above the High of candle [5] I need the alert to alert me for candle[2] only NOT for candle [2 and 1]

dose your code do that??

Maybe screenshot helps. Becouse you give bad explanation.
avatar
87
FxTrader_ 2016.03.04 23:16 #
 

I hope it clear :)



avatar
872
eevviill 2016.03.05 10:30 #
 
int last_red_bar=-1;
double red_high=-1;
for(int i=0;i<Bars-20;i++)
{
if(Close[i]<Open[i])
{
last_red_bar=i;
red_high=High[i];
break;
}
}

for(int i=last_red_bar-1;i>=0 && last_red_bar>0;i--)
{
if(High[i]>red_high)
{
if(i==0) Alert(Hihihhi);
break;
}
}

 

avatar
Moderator
3418
GumRai 2016.03.06 06:52 #
 
   int last_Red_candle_index=1;
   static datetime last_Red_candle_time=0;
   static datetime alert_reference_time=0;

   while(true)
     {
      if(iOpen(Symbol(),0,last_Red_candle_index)>iClose(Symbol(),0,last_Red_candle_index))
        {
         last_Red_candle_time=iTime(Symbol(),0,last_Red_candle_index);
         break;
        }
      last_Red_candle_index++;
     }
   if(alert_reference_time!=last_Red_candle_time)
     {
      double red_candle_high=iHigh(Symbol(),0,last_Red_candle_index);
      for(int x=last_Red_candle_index-1;x>0;x--)
        {
         if(iClose(Symbol(),0,x)>red_candle_high)
           {
            Alert("Close Above Red Candle High  "+Symbol(),"    ",TimeToStr(CurTime(),TIME_DATE|TIME_MINUTES),
                  "   M",Period(),"  ");
            alert_reference_time=last_Red_candle_time;
            break;
           }
        }
     }

This should help you out

Back to topics list   | 1 2  

To add comments, please log in or register