why not show arrow? mql5

 
why indicator are not show arrow ? 
#property indicator_chart_window

//--- input parameters

input int K_period_Mid=5;
input int D_period_Mid=3;
input int Slow_period_Mid=3;
input ENUM_STO_PRICE STO_PRICE_Mid=STO_LOWHIGH;
input ENUM_MA_METHOD STO_Ma_Mid=MODE_SMA;
input double OverBought=80;
input double OverSold=20;

input int shift=0;
input int CountBars=1000;
#property indicator_buffers 2
#property indicator_plots   2

#property indicator_color1 Green
#property indicator_type1  DRAW_ARROW

#property indicator_color2 Red
#property indicator_type2  DRAW_ARROW



double UpArrow[],DownArrow[],MABuffer[];

int LastArrowIndex;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   StoMain1=iStochastic(Symbol(),0,K_period_Mid,D_period_Mid,Slow_period_Mid,STO_Ma_Mid,STO_PRICE_Mid);
   SetIndexBuffer(0, UpArrow, INDICATOR_DATA);
   SetIndexBuffer(1, DownArrow, INDICATOR_DATA);
   
//----   
   //Setting the Buffer 0 to draw up arrow
   PlotIndexSetInteger(0,PLOT_ARROW,233);
   //PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0);
 
   //Setting the Buffer 0 to draw down arrow
   PlotIndexSetInteger(1,PLOT_ARROW,234);
   //PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0);
   
   
//----
   //IndicatorSetString(INDICATOR_SHORTNAME,"Sto (" + K_period_Mid +") ");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int StoMain1;double SmoothedBuffer1[];
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
      if(prev_calculated==0)
      {
         ArrayInitialize(UpArrow,0);
         ArrayInitialize(DownArrow,0);
      }
      
      int copied=CopyBuffer(StoMain1,0,0,CountBars,SmoothedBuffer1);
      
      for ( int i = shift; i < CountBars; i++) {
      
         
         
         if(SmoothedBuffer1[i]>OverBought)
         {
            DownArrow[i]=iHigh(Symbol(),0,i);printf(i+" "+SmoothedBuffer1[i]+" "+DownArrow[i]);
         }
         else DownArrow[i]=0;
         if(SmoothedBuffer1[i]<OverSold)
         {
            UpArrow[i]=iLow(Symbol(),0,i);printf(i+" "+SmoothedBuffer1[i]+" "+UpArrow[i]);
         }
         else UpArrow[i]=0;
      
      }
     
   
       
   //--- return value of prev_calculated for next call
   
   return(rates_total);
  }
 

Forum on trading, automated trading systems and testing trading strategies


When you post code please use the CODE button (Alt-S)!

Use the CODE button