Question about OBJPROP_TIMEFRAMES - page 2

 
angevoyageur:

Just for fun.

By the way I found 2 bugs in the process, see comments (first one already found by Gumrai)

Thanks Angevoyageur,

really good to see the bitwise & operation used. I found the documentation a little confusing, but seeing how you have used it, I understand now. 

 
GumRai:

Thanks Angevoyageur,

really good to see the bitwise & operation used. I found the documentation a little confusing, but seeing how you have used it, I understand now. 

Great, that was the goal. Happy it's useful.
 
Thanks guys, that was a real good lesson for me. I don't understand everything (never did anything with bitwise-stuff) but I bookmarked this thread to learn from it.
 

Sorry to ask this question,pls i need help on an indicator i was working on(modifying to suit my need),i wanted my indicator to use 2 timeframes-1min and 5mins to give a signal by showing an arrow on the bar it occured using 2 indicators, stoicastic ( 5,3,3) and Bollinger Bands_Stop_v2. pls the result is a dancing arrow ,sometimes vanishes i.e it repaints and i dont know why.this is the modified indicator i was working on.Please can anyone help fix my problem.


//+------------------------------------------------------------------+
//|                                       Stochastic_Cross_Alert.mq4 |
//|                         Copyright © 2016, fxcode           |
//|                                                                  |
//|    |
//|                  |
//+------------------------------------------------------------------+

#property copyright "Copyright © 2016, fxcod"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LawnGreen
#property indicator_color2 Red
#property indicator_width1  2
#property indicator_width2  2

extern bool SoundON=true;
extern bool EmailON=false;
//---- input parameters
extern int KPeriod=5;
extern int DPeriod=3;
extern int Slowing=3;
extern int MA_Method = 0; // SMA 0, EMA 1, SMMA 2, LWMA 3
extern int PriceField = 0; // Low/High 0, Close/Close 1


double CrossUp[];
double CrossDown[];
int flagval1 = 0;
int flagval2 = 0;
int min1_up =0;
int min1_dwn =0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0, DRAW_ARROW, EMPTY);
   SetIndexArrow(0, 233);
   SetIndexBuffer(0, CrossUp);
   SetIndexLabel(0,"UP");
   SetIndexStyle(1, DRAW_ARROW, EMPTY);
   SetIndexArrow(1, 234);
   SetIndexBuffer(1, CrossDown);
   SetIndexLabel(1,"DOWN");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 

//----
   return(0);
  }


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
   int limit, i, counter;

   double Stoch1minup,Stoch1mindwn,getstoch5up,getstoch5dwn;
   double m1val,m5val;
   double m1locatnup,m1locatndwn,m5locatnup,m5locatndwn;
   double Range, AvgRange;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;
   
   for(i = 1; i <= limit; i++) {
   
      counter=i;
      Range=0;
      AvgRange=0;
      for (counter=i ;counter<=i+9;counter++)
      {
         AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
      }
      Range=AvgRange/10;
       
    
      
      //........................
  m1val = iClose(NULL,PERIOD_M1,1);
  m5val = iClose(NULL,PERIOD_M5,1);
  m1locatnup = iCustom(NULL,PERIOD_M1,"Bollinger Bands_Stop_v2",4,0);
  m1locatndwn = iCustom(NULL,PERIOD_M1,"Bollinger Bands_Stop_v2",5,0);
  m5locatnup = iCustom(NULL,PERIOD_M5,"Bollinger Bands_Stop_v2",4,0);
  m5locatndwn = iCustom(NULL,PERIOD_M5,"Bollinger Bands_Stop_v2",5,0);
  Stoch1minup = iCustom(NULL,PERIOD_M1,"stoch cross",0,1);
  Stoch1mindwn = iCustom(NULL,PERIOD_M1,"stoch cross",1,1);
  getstoch5up = iCustom(NULL,PERIOD_M5,"stoch cross",0,1);
  getstoch5dwn = iCustom(NULL,PERIOD_M5,"stoch cross",1,1);
  
  //.............................................
      
      
      //if ((Stoch1minup !=0)&& (m1val >m1locatnup) && (getstoch5up !=0)&& (m5val >m5locatnup))
      if(Stoch1minup !=0){min1_up++;}
      if(m1val >m1locatnup){min1_up++;}
      if(getstoch5up !=0){min1_up++;}
      if(m5val >m5locatnup){min1_up++;}
      
      if (min1_up ==4)
        
      {
        
         CrossUp[i] = Low[i] - Range*0.75;
      
        
         Alert("up");
         
      }
      //else if ((Stoch1mindwn !=0)&& (m1val <m1locatndwn) && (getstoch5dwn !=0)&& (m5val <m5locatndwn))
     // else if (getstoch5dwn !=0)
     
     if(Stoch1mindwn !=0){min1_dwn++;}
     if(m1val <m1locatndwn){min1_dwn++;}
     if(getstoch5dwn !=0){min1_dwn++;}
      if(m5val <m5locatndwn){min1_dwn++;}
      
      if (min1_dwn ==4)
      
      {
   
        CrossDown[i] = High[i] + Range*0.75;
    
        Alert("down");
        
      }
   }

   return(0);
}

 
please these are the indicators i used.please find attached.
 

WHRoeder, please am sorry, i just needed a fast answer.really sorry, but can i still ask questions here?


Reason: