my indicator only work on current chart

 
I 've written an indicator with mql4 code. this indicator work properly in current chart but when i change symbol string from Null to "AUDJPY" for example , the indicator does not work ,
 can anybody help me ? 
Files:
farhad.mq4  4 kb
 

Use SRC code displaying your code if it is a short program like this

//+------------------------------------------------------------------+
//|                               Forex Generator version 4.1        |
//|                                 Copyright (C) 2011, Etasoft Inc. |
//|                                    http://www.forexgenerator.com |
//+------------------------------------------------------------------+
// Keywords: indicator developer, Forex indicator builder, create forex indicator, MT4


#property copyright "Your copyright"
#property link "Link to your website"
#property indicator_separate_window
#property indicator_buffers 2



#property indicator_color1 Red
#property indicator_width1 2



#property indicator_color2 Red
#property indicator_width2 2



// exported variables


// local variables
int ObjCount = 0;  // count of all objects created on the chart, allows creation of objects with unique names
int current = 0; // variable points to current bar
int sss = 0;
int aaa = 0;
double Buffer21[];
double Buffer16[];
int value21,value16;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
    if (false) ObjectsDeleteAll();      // clear the chart
    IndicatorShortName("Buy 97 Sell 99");
    IndicatorDigits(0);
    IndicatorBuffers(2);
    
    SetIndexBuffer(0, Buffer21);
    SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
    
    SetIndexBuffer(1, Buffer16);
    SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);
    
    
    return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
    if (false) ObjectsDeleteAll();
    
    
    return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator start function                                  |
//+------------------------------------------------------------------+
int start()
{
    OnEveryTick14();
    
    return(0);
}

//+------------------------------------------------------------------+

void OnEveryTick14()
{
    int f;
    int i;
    int counted_bars = IndicatorCounted();
    if(counted_bars < 0) return(-1);
    if(counted_bars > 0) counted_bars--;
    i = Bars - counted_bars;
    // main calculation loop
    while (i >= 0)
    {
    f++;
        current = i;

        if (iCustom(NULL, NULL, "TCCI Ahmad",0,16,0,0,1,1,0,0,1) > iCustom(NULL, NULL, "THV Ahmad",0,1))
         {
           if (sss==0)
           {
           if (iHigh(NULL,NULL,0) > High[iHighest(NULL,0,MODE_HIGH,20,1)])
                {
                         Buffer21[current]= 1;
                         Buffer16[current]= 0;
                         value21 = f;
                         sss = 1;
                         aaa = 0;       
                         value16=-1;
                 }
        }
         }
       

         else  if (iCustom(NULL, NULL, "TCCI Ahmad",0,16,0,0,1,1,0,0,1) < iCustom(NULL, NULL, "THV Ahmad",0,1))
         {
         if (aaa==0)
         {
          if (iLow(NULL,NULL,0) < Low[iLowest(NULL,0,MODE_LOW,20,1)])
                 {
                        Buffer16[current]= 3;
                        Buffer21[current]= 0;
                        value16 = f;
                        aaa = 1;
                        sss = 0;
                        value21=-2;
                 }
        }
         }

        
        if (Buffer21[value21]==1) 
         {
                Buffer21[current]= 1;
                Buffer16[current]= 4;

         }
        
        if (Buffer16[value16]==3) 
         {
                Buffer16[current]= 3;
                Buffer21[current]= 2;

        }

        i--;
    }
}




so we see directly your problem

what  does NULL mean  ??

can it be a string and an integer the same time ??

check iCustom,   iLow,   iHigh   what type input first and second parameter has to be

Don't think NULL == '0'  (zero)  and also something like "EURUSD"

 
also no need for decrement counted
 
deVries:

Use SRC code displaying your code if it is a short program like this

so we see directly your problem

what  does NULL mean  ??

can it be a string and an integer the same time ??

check iCustom,   iLow,   iHigh   what type input first and second parameter has to be

Don't think NULL == '0'  (zero)  and also something like "EURUSD"

 

deVries:

Use SRC code displaying your code if it is a short program like this

so we see directly your problem

what  does NULL mean  ??

can it be a string and an integer the same time ??

check iCustom,   iLow,   iHigh   what type input first and second parameter has to be

Don't think NULL == '0'  (zero)  and also something like "EURUSD"


 i want to have data of this indicator for AUDJPY when the current chart is not AUDJPY, for example current chart is EURUSD . 

the SECOND SRC work on the every chart prpperly 

but first SRC that i change string symbol from null to AUDJPY does not work when the current chart is not AUDJPY . I WANT to have data of this indicator for AUDJPY when current chart is not AUDJPY.

//+------------------------------------------------------------------+
//|                               Forex Generator version 4.1        |
//|                                 Copyright (C) 2011, Etasoft Inc. |
//|                                    http://www.forexgenerator.com |
//+------------------------------------------------------------------+
// Keywords: indicator developer, Forex indicator builder, create forex indicator, MT4


#property copyright "Your copyright"
#property link "Link to your website"
#property indicator_separate_window
#property indicator_buffers 2



#property indicator_color1 Red
#property indicator_width1 2



#property indicator_color2 Red
#property indicator_width2 2



// exported variables


// local variables
int ObjCount = 0;  // count of all objects created on the chart, allows creation of objects with unique names
int current = 0; // variable points to current bar
int sss = 0;
int aaa = 0;
double Buffer21[];
double Buffer16[];
int value21,value16;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
    if (false) ObjectsDeleteAll();      // clear the chart
    IndicatorShortName("Buy 97 Sell 99");
    IndicatorDigits(0);
    IndicatorBuffers(2);
    
    SetIndexBuffer(0, Buffer21);
    SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
    
    SetIndexBuffer(1, Buffer16);
    SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);
    
    
    return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
    if (false) ObjectsDeleteAll();
    
    
    return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator start function                                  |
//+------------------------------------------------------------------+
int start()
{
    OnEveryTick14();
    
    return(0);
}

//+------------------------------------------------------------------+

void OnEveryTick14()
{
    int f;
    int i;
    int counted_bars = IndicatorCounted();
    if(counted_bars < 0) return(-1);
    if(counted_bars > 0) counted_bars--;
    i = Bars - counted_bars;
    // main calculation loop
    while (i >= 0)
    {
    f++;
        current = i;

        if (iCustom("AUDJPY", NULL, "TCCI Ahmad",0,16,0,0,1,1,0,0,1) > iCustom("AUDJPY", NULL, "THV Ahmad",0,1))
         {
           if (sss==0)
           {
           if (iHigh("AUDJPY",NULL,i) > High[iHighest("AUDJPY",0,MODE_HIGH,20,1)])
                {
                         Buffer21[current]= 1;
                         Buffer16[current]= 0;
                         value21 = f;
                         sss = 1;
                         aaa = 0;       
                         value16=-1;
                 }
        }
         }
       

         else  if (iCustom("AUDJPY", NULL, "TCCI Ahmad",0,16,0,0,1,1,0,0,1) < iCustom("AUDJPY", NULL, "THV Ahmad",0,1))
         {
         if (aaa==0)
         {
          if (iLow("AUDJPY",NULL,i) < Low[iLowest("AUDJPY",0,MODE_LOW,20,1)])
                 {
                        Buffer16[current]= 3;
                        Buffer21[current]= 0;
                        value16 = f;
                        aaa = 1;
                        sss = 0;
                        value21=-2;
                 }
        }
         }

        
        if (Buffer21[value21]==1) 
         {
                Buffer21[current]= 1;
                Buffer16[current]= 4;

         }
        
        if (Buffer16[value16]==3) 
         {
                Buffer16[current]= 3;
                Buffer21[current]= 2;

        }

        i--;
    }
}




//+------------------------------------------------------------------+
//|                               Forex Generator version 4.1        |
//|                                 Copyright (C) 2011, Etasoft Inc. |
//|                                    http://www.forexgenerator.com |
//+------------------------------------------------------------------+
// Keywords: indicator developer, Forex indicator builder, create forex indicator, MT4


#property copyright "Your copyright"
#property link "Link to your website"
#property indicator_separate_window
#property indicator_buffers 2



#property indicator_color1 Red
#property indicator_width1 2



#property indicator_color2 Red
#property indicator_width2 2



// exported variables


// local variables
int ObjCount = 0;  // count of all objects created on the chart, allows creation of objects with unique names
int current = 0; // variable points to current bar
int sss = 0;
int aaa = 0;
double Buffer21[];
double Buffer16[];
int value21,value16;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
    if (false) ObjectsDeleteAll();      // clear the chart
    IndicatorShortName("Buy 97 Sell 99");
    IndicatorDigits(0);
    IndicatorBuffers(2);
    
    SetIndexBuffer(0, Buffer21);
    SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
    
    SetIndexBuffer(1, Buffer16);
    SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);
    
    
    return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
    if (false) ObjectsDeleteAll();
    
    
    return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator start function                                  |
//+------------------------------------------------------------------+
int start()
{
    OnEveryTick14();
    
    return(0);
}

//+------------------------------------------------------------------+

void OnEveryTick14()
{
    int f;
    int i;
    int counted_bars = IndicatorCounted();
    if(counted_bars < 0) return(-1);
    if(counted_bars > 0) counted_bars--;
    i = Bars - counted_bars;
    // main calculation loop
    while (i >= 0)
    {
    f++;
        current = i;

        if (iCustom(NULL, NULL, "TCCI Ahmad",0,16,0,0,1,1,0,0,1) > iCustom(NULL, NULL, "THV Ahmad",0,1))
         {
           if (sss==0)
           {
           if (iHigh(NULL,NULL,i) > High[iHighest(NULL,0,MODE_HIGH,20,1)])
                {
                         Buffer21[current]= 1;
                         Buffer16[current]= 0;
                         value21 = f;
                         sss = 1;
                         aaa = 0;       
                         value16=-1;
                 }
        }
         }
       

         else  if (iCustom(NULL, NULL, "TCCI Ahmad",0,16,0,0,1,1,0,0,1) < iCustom(NULL, NULL, "THV Ahmad",0,1))
         {
         if (aaa==0)
         {
          if (iLow(NULL,NULL,i) < Low[iLowest(NULL,0,MODE_LOW,20,1)])
                 {
                        Buffer16[current]= 3;
                        Buffer21[current]= 0;
                        value16 = f;
                        aaa = 1;
                        sss = 0;
                        value21=-2;
                 }
        }
         }

        
        if (Buffer21[value21]==1) 
         {
                Buffer21[current]= 1;
                Buffer16[current]= 4;

         }
        
        if (Buffer16[value16]==3) 
         {
                Buffer16[current]= 3;
                Buffer21[current]= 2;

        }

        i--;
    }
}