convert indicator array code for EA code
i tried several method but fails
i dont want to use icustom, i want directly use indi code to EA
indicator here:
i want this indicator code to apply in EA code inside
i set variable to collect array data but failed
Without icustom is it possible?
i tried several method but fails
i dont want to use icustom, i want directly use indi code to EA
indicator here:
Inserted Code
#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);
} i want this indicator code to apply in EA code inside
i set variable to collect array data but failed
Inserted Code
x = vol[0]; xx = volavg[0]; xxx = volsteps[0];
Without icustom is it possible?