HOW CAN I DRAW ARROWS ON CHART OF 2 INDICATORS FROM 2 TIMEFRAMES

 
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.the code is below and indicators used
 
//+------------------------------------------------------------------+
//|                                       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);
}
 
  1. m5locatndwn = iCustom(NULL,PERIOD_M5,"Bollinger Bands_Stop_v2",5,0);
    Stoch1minup = iCustom(NULL,PERIOD_M1,"stoch cross",0,1);
    :
    CrossDown[i] = High[i] + Range*0.75;
    You are filling your buffers with the same values. Where is your i?
  2. Where are you converting your i to the M5 and M1 value? Don't mix apples and oranges
  3. How to do your lookbacks correctly.
  4. Why compute range instead of using ATR?
 
WHRoeder:
  1. You are filling your buffers with the same values. Where is your i?
  2. Where are you converting your i to the M5 and M1 value? Don't mix apples and oranges
  3. How to do your lookbacks correctly.
  4. Why compute range instead of using ATR?
Thank you WhRoeder, pls i am limited in my coding ability,just do some few modifications sometimes. i used "
limit=Bars-counted_bars;
   
   for(i = 1; i <= limit; i++) {

2. please dont understand "Don't mix apples and oranges"

3. was counting from bar 1 back to indicator counted().

4. the range was just so that i can add some values to the low or high when placing my arrow on the chart

Please all i wanted was (stoch to cross up on 1M and5M) and (price should be above bollinger buy on 1M and 5M) then draw UP arrow on the bar which it occured

same goes for SELL which is DOWN arrow.

ADD: i just read how to do loopback correctly, what will be my loopback as time series if i needed only 200 bars backwards?

Reason: