help in this piece of code ... please

To add comments, please log in or register
Marinov
33
Marinov  

hello ...


I work on an indicator and

I try to play with candle hammer I calculate it the following way in the code, my problem is in the loop inside the first loop

I want when the price comes back to the opening of candle the indicator gives an alert

My code :

   int i,limit,x=-1 ;

   limit=rates_total-prev_calculated;
   if(prev_calculated>0)
      limit++;

   for(i=0; i<limit; i++){
   double BodyLastBar = MathAbs(open[i+Shift] - close[i+Shift])*Mod;// Shift is number of back candles 
   double BodyHammerBar =MathAbs(open[i] - close[i]);  
   
  if( BodyHammerBar > BodyLastBar && BodyHammerBar > 20*Point  ){
  if(close[i] - open[i] > 0){
  SetTrends("BarUp"+i,time[i] , open[i],time[i] , close[i],13 ,clrPlum);
  if(i > NumOfCandles)
  for(int k=i; k< i-(NumOfCandles+1); k--){
    if(low[k] <= open[i] ){
    Alert("   Price back = ",Price);
    }
  }
 }
 }

thank you ...

Marinov
33
Marinov  
solved ... thank you
To add comments, please log in or register