Please help my code T_T

 

#property indicator_buffers 2
#property indicator_color1 SeaGreen
#property indicator_color2 Red

double CrossUp[];
double CrossDown[];
extern int FasterEMA = 4;
extern int SlowerEMA = 8;
extern int RSI_Period = 13;         //8-25
extern int RSI_Price = 0;           //0-6
extern int Volatility_Band = 34;    //20-40
extern int RSI_Price_Line = 2;      
extern int RSI_Price_Type = 0;      //0-3
extern int Trade_Signal_Line = 7;   
extern int Trade_Signal_Type = 0;   //0-3
extern bool SoundON=true;
double alertTag;
 double control=2147483647;
 double RSIBuf[],UpZone[],MdZone[],DnZone[],MaBuf[],MbBuf[];
 
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0, DRAW_ARROW, EMPTY,3);
   SetIndexArrow(0, 233);
   SetIndexBuffer(0, CrossUp);
   SetIndexStyle(1, DRAW_ARROW, EMPTY,3);
   SetIndexArrow(1, 234);
   SetIndexBuffer(1, CrossDown);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
  double MA,RSI[];
   double Range, AvgRange;
   ArrayResize(RSI,Volatility_Band);
   int counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars-1;
   int counter;
   
   for(int i=limit; i>=0; i--)
   {
        counter=i;
        Range=0;
        AvgRange=0;
        RSIBuf[i] = (iRSI(NULL,0,RSI_Period,RSI_Price,i)); 
        MA = 0;
        for(int x=i; x<i+Volatility_Band; x++) 
        {
            RSI[x-i] = RSIBuf[x];
            MA += RSIBuf[x]/Volatility_Band;
        }
        UpZone[i] = (MA + (1.6185 * StDev(RSI,Volatility_Band)));
        DnZone[i] = (MA - (1.6185 * StDev(RSI,Volatility_Band)));  
        MdZone[i] = ((UpZone[i] + DnZone[i])/2);
    }
    
    for (i=limit-1;i>=0;i--)  
    {
        MaBuf[i] = (iMAOnArray(RSIBuf,0,RSI_Price_Line,0,RSI_Price_Type,i));
        MbBuf[i] = (iMAOnArray(RSIBuf,0,Trade_Signal_Line,0,Trade_Signal_Type,i));   
    } 
      
      if ((MaBuf[i] > MbBuf[i]) && (MaBuf[i+1] < MbBuf[i+1] )) {
         CrossUp[i] = Low[i] - Range*0.5;
      }
      else if((MaBuf[i] < MbBuf[i]) && (MaBuf[i+1] > MbBuf[i+1] )) {
          CrossDown[i] = High[i] + Range*0.5;
      }
        
  }

double StDev(double& Data[], int Per)
{
    return(MathSqrt(Variance(Data,Per)));
}



double Variance(double& Data[], int Per)
{
    double sum, ssum;
    for (int i=0; i<Per; i++)
    {
        sum += Data[i];
        ssum += MathPow(Data[i],2);
    }
    return((ssum*Per - sum*sum)/(Per*(Per-1)));
}

I can pass compile but it don't show arrow.i want to make arrow from tdi cross. thank you ^_^
 
 double RSIBuf[],UpZone[],MdZone[],DnZone[],MaBuf[],MbBuf[];
You do not size these arrays, so you will get an array out of range error
 

It is still pretty "messi" but it works.

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 SeaGreen
#property indicator_color2 Red

double CrossUp[];
double CrossDown[];
extern int FasterEMA = 4;
extern int SlowerEMA = 8;
extern int RSI_Period = 13;         //8-25
extern int RSI_Price = 0;           //0-6
extern int Volatility_Band = 34;    //20-40
extern int RSI_Price_Line = 2;      
extern int RSI_Price_Type = 0;      //0-3
extern int Trade_Signal_Line = 7;   
extern int Trade_Signal_Type = 0;   //0-3
extern bool SoundON=true;
double alertTag;
 double control=2147483647;
 double RSIBuf[],UpZone[],MdZone[],DnZone[],MaBuf[],MbBuf[];
 
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  IndicatorBuffers(5);
//---- indicators
   SetIndexStyle(0, DRAW_ARROW, EMPTY,1);
   //SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 3, Red);
   SetIndexArrow(0, 233);
   SetIndexBuffer(0, CrossUp);
   SetIndexStyle(1, DRAW_ARROW, EMPTY,1);
   //SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 3, Lime);
   SetIndexArrow(1, 234);
   SetIndexBuffer(1, CrossDown);
   
   SetIndexBuffer(2, RSIBuf);
   SetIndexBuffer(3, MaBuf);
   SetIndexBuffer(4, MbBuf);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
  double MA,RSI[];
   double Range, AvgRange;
   ArrayResize(RSI,Volatility_Band);
   int counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars-1;
   int counter;
   
   for(int i=limit; i>=0; i--)
   {
        counter=i;
        Range=0;
        AvgRange=0;
        RSIBuf[i] = iRSI(NULL,0,RSI_Period,RSI_Price,i); 
        //MA = 0;
        //for(int x=i; x<i+Volatility_Band; x++) 
        //{
        //    RSI[x-i] = RSIBuf[x];
        //    MA += RSIBuf[x]/Volatility_Band;
        //}
        //UpZone[i] = (MA + (1.6185 * StDev(RSI,Volatility_Band)));
        //DnZone[i] = (MA - (1.6185 * StDev(RSI,Volatility_Band)));  
        //MdZone[i] = ((UpZone[i] + DnZone[i])/2);
        
    }
    
    for (i=limit-1;i>=0;i--)  
    {
        MaBuf[i] = (iMAOnArray(RSIBuf,0,RSI_Price_Line,0,RSI_Price_Type,i));
        MbBuf[i] = (iMAOnArray(RSIBuf,0,Trade_Signal_Line,0,Trade_Signal_Type,i));   
    //} 
      if ((MaBuf[i] > MbBuf[i]) && (MaBuf[i+1] < MbBuf[i+1] )) {
         CrossUp[i] = Low[i] - Range*0.5;
      }
      else if((MaBuf[i] < MbBuf[i]) && (MaBuf[i+1] > MbBuf[i+1] )) {
          CrossDown[i] = High[i] + Range*0.5;
      }
    }
        
  }

double StDev(double& Data[], int Per)
{
    return(MathSqrt(Variance(Data,Per)));
}



double Variance(double& Data[], int Per)
{
    double sum, ssum;
    for (int i=0; i<Per; i++)
    {
        sum += Data[i];
        ssum += MathPow(Data[i],2);
    }
    return((ssum*Per - sum*sum)/(Per*(Per-1)));
}