merge indicator and EA, and call indicator buffer value to EA withput i custom

 

Hlw


i hv an indicator but i want to merge it with my EA code, how can i call buffer value as set double variable? i dont want to call indicator value with icustom

my indicator here:

//------------------------------------------------------------------

//------------------------------------------------------------------
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1  DarkGray
#property indicator_color2  PaleVioletRed
#property indicator_color3  HotPink
#property indicator_width2  2
#property indicator_level2  3
#property indicator_minimum 0
#property indicator_levelcolor DarkGray

//
//
//
//
//

extern int    VolPeriod          = 14;
extern int    VolPrice           = PRICE_CLOSE;
extern int    Smooth             = 3;
extern int    SmoothMethod       = MODE_LWMA;
extern double DeviationsForSteps = 2.0;

double vol[];
double volavg[];
double volsteps[];

//------------------------------------------------------------------
//
//------------------------------------------------------------------

int init()
{
   SetIndexBuffer(0,vol);
   SetIndexBuffer(1,volavg);
   SetIndexBuffer(2,volsteps);
      Smooth = MathMax(Smooth,1);
   return(0);
}
int deinit() { return(0); }

//------------------------------------------------------------------
//
//------------------------------------------------------------------

int start()
{
   int count,counted_bars=IndicatorCounted();
      if(counted_bars < 0) return(-1);
      if(counted_bars>0) counted_bars--;
         int limit = MathMin(Bars-counted_bars,Bars-1);

   //
  
    
      for(int i = limit; i >= 0; i--)
      {
         double range = MathMax(High[i],Close[i+1])-MathMin(Low[i],Close[i+1]);
         double atr   = iATR(NULL,0,VolPeriod,i+1);
            if (atr!=0)
                  vol[i] = range/atr;
            else  vol[i] = 0;                  
      }
      for(i = limit; i >= 0; i--) volavg[i] = iMAOnArray(vol,0,Smooth,0,SmoothMethod,i);
      for(i = limit; i >= 0; i--)
      {
         volsteps[i] = volsteps[i+1];
         if (DeviationsForSteps>0)
         {
            double deviation = DeviationsForSteps*iStdDevOnArray(vol,0,VolPeriod,0,MODE_SMA,i);
               if (vol[i] > volsteps[i+1]+deviation) volsteps[i] = vol[i];
               if (vol[i] < volsteps[i+1]-deviation) volsteps[i] = vol[i];
          }
          else volsteps[i] = 1;               
      }
      
   return(0);
}


how can i call 3 buffers value in my EA


 double x,xx,xxx;

for (int ii=0;ii< 10;ii++)
{

 x = vol[i];
 xx = volavg[i];
xxx = volsteps[i];

   }   


its not working...so confused...i dont want to call indicator value with icustom


 
Hefajatur Rahman:

Hlw


i hv an indicator but i want to merge it with my EA code, how can i call buffer value as set double variable? i dont want to call indicator value with icustom

my indicator here:


how can i call 3 buffers value in my EA



its not working...so confused...i dont want to call indicator value with icustom



You can't call indicator butfer from EA without using the iCustom unless you implement its logic inside the EA call . Meaning that you have to apply the same calculations in the EA code
 

is it possible to collect array value as double variable like this


what should i do for collect array value


 double x,xx,xxx;

for (int ii=0;ii< 10;ii++)
{

 x = vol[i];
 xx = volavg[i];
xxx = volsteps[i];

   }