Please help me with this simple iCustom code

 

I want to edit the main cci indicator file and save it as a customed one for myself for special purpose. I want to use heiken ashi values instead of normal ones. In cci code which i wrote it from cci.mq4 file, there's 2 FOR loops. I want to know should i replace default high, low and close values in both for loops with heiken ashi ones? Did i write it true or some parts  including using iCustom for heiken ashi or anything else is wrong?  I think I'm missing heiken ashi bsar number in loop or something else is wrong. Please help me to do it in the right way. 

Please note that i wrote some part of cci for being short and the other codes are pasting without any changes from cci.mq4 file. 


//--- initial zero
   if(prev_calculated<1)
     {
      for(i=0; i<InpCCIPeriod; i++)
        {
         double HAhigh = iCustom(NULL,0,"Heiken Ashi", color1,color2,color3,color4, HAHIGH, 0);
double HAlow = iCustom(NULL,0,"Heiken Ashi", color1,color2,color3,color4, HALOW, 0);
double HAclose = iCustom(NULL,0,"Heiken Ashi", color1,color2,color3,color4, HACLOSE, 0);
         ExtCCIBuffer[i]=0.0;
         ExtPriceBuffer[i]=(HAhigh[i]+HAlow[i]+HAclose[i])/3;
         ExtMovBuffer[i]=0.0;
        }
     }
//--- calculate position
   pos=prev_calculated-1;
   if(pos<InpCCIPeriod)
      pos=InpCCIPeriod;
//--- typical price and its moving average
   for(i=pos; i<rates_total; i++)
     {

         double HAhigh = iCustom(NULL,0,"Heiken Ashi", color1,color2,color3,color4, HAHIGH, 0);
double HAlow = iCustom(NULL,0,"Heiken Ashi", color1,color2,color3,color4, HALOW, 0);
double HAclose = iCustom(NULL,0,"Heiken Ashi", color1,color2,color3,color4, HACLOSE, 0);
         ExtCCIBuffer[i]= ExtPriceBuffer[i]=(HAhigh[i]+HAlow[i]+HAclose[i])/3;
        ExtMovBuffer[i]=SimpleMA(i,InpCCIPeriod,ExtPriceBuffer);
     }
 

There are some things that I don't understand!

if(prev_calculated<1)
     {
      for(i=0; i<InpCCIPeriod; i++)
        {
         double HAhigh = iCustom(NULL,0,"Heiken Ashi", color1,color2,color3,color4, HAHIGH, 0);
double HAlow = iCustom(NULL,0,"Heiken Ashi", color1,color2,color3,color4, HALOW, 0);
double HAclose = iCustom(NULL,0,"Heiken Ashi", color1,color2,color3,color4, HACLOSE, 0);
         ExtCCIBuffer[i]=0.0;
         ExtPriceBuffer[i]=(HAhigh[i]+HAlow[i]+HAclose[i])/3;
         ExtMovBuffer[i]=0.0;
        }
     }

iCustom(..., 0); means you will always get the prices of the actual or latest bar (=0 ?) but you put them in buffer[i] which is the i-th bar - but where (and how) did you declare e.g. HAhigh[].

I think you should put the cursor on iCustom press F1 and start reading!

 
Carl Schreiber:

There are some things that I don't understand!

iCustom(..., 0); means you will always get the prices of the actual or latest bar (=0 ?) but you put them in buffer[i] which is the i-th bar - but where (and how) did you declare e.g. HAhigh[].

I think you should put the cursor on iCustom press F1 and start reading!

I named HAhigh myself as double and so on. Should i replace 0 with i  ? Or i should take off iCustom from for loop?