#property indicator_separate_window#property indicator_minimum 0#property indicator_buffers 1#property indicator_color1 Blue//---- input parametersexternint ExtStdDevPeriod=7;
externint ExtStdDevMAMethod=0;
externint ExtStdDevAppliedPrice=0;
externint ExtStdDevShift=0;
externint Period_ADX = 1; // Calculated MA periodexternint Period_MA = 2; // Calculated MA period//---- buffersdouble ExtStdDevBuffer[];
double ADX[]; // Wert Steigungdouble SMA[];
double SMA1[];
double SMA2[]; // SMA//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int init()
{
string sShortName;
ArraySetAsSeries(SMA,true);
ArraySetAsSeries(SMA1,true);
ArraySetAsSeries(SMA2,true);
//---- indicator buffer mappingSetIndexBuffer(0,ExtStdDevBuffer);
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
//---- line shifts when drawing
SetIndexShift(0,ExtStdDevShift);
//---- name for DataWindow and indicator subwindow label
sShortName="StdDev("+ExtStdDevPeriod+")";
IndicatorShortName(sShortName);
SetIndexLabel(0,sShortName);
//---- first values aren't drawn
SetIndexDrawBegin(0,ExtStdDevPeriod);
//----return(0);
}
//+------------------------------------------------------------------+//| Standard Deviation |//+------------------------------------------------------------------+int start()
{
//////int counted_bars; // Number of counted bars int i;
i=Bars-counted_bars-1; // Index of the first uncountedwhile(i>=0) // Loop for uncounted bars
{
ADX[i]=((High[1]+Low[1])/2)+(Open[1]-Close[1]); // Value of 0 buffer on i bar
i--; // Calculating index of the next bar
}
i=Bars-counted_bars-1;
while(i>=0) // Loop for uncounted bars
{
SMA[i]=iMAOnArray(ADX,0,2,0,MODE_SMA,i); // Value of 1st buffer on i bar
i--; // Calculating index of the next bar
}
i=Bars-counted_bars-1;
while(i>=0) // Loop for uncounted bars
{
SMA1[i]=iMAOnArray(SMA,0,2,0,MODE_SMA,i); // Value of 1st buffer on i bar
i--; // Calculating index of the next bar
}
while(i>=0) // Loop for uncounted bars
{
SMA2[i]=iMAOnArray(SMA1,0,2,0,MODE_SMA,i); // Value of 1st buffer on i bar
i--; // Calculating index of the next bar
}
///////int j,nCountedBars;
double dAmount,dMovingAverage[];
/////---- insufficient dataif(Bars<=ExtStdDevPeriod) return(0);
//---- bars count that does not changed after last indicator launch.
nCountedBars=IndicatorCounted();
//----Standard Deviation calculation
i=Bars-ExtStdDevPeriod-1;
if(nCountedBars>ExtStdDevPeriod)
i=Bars-nCountedBars;
while(i>=0)
{
dAmount=0.0;
dMovingAverage[i]=SMA2[i];
for(j=0; j<ExtStdDevPeriod; j++)
{
dAmount+=(Close[0]-dMovingAverage[i])*(Close[0]-dMovingAverage[i]);
}
ExtStdDevBuffer[i]=MathSqrt(dAmount/ExtStdDevPeriod);
i--;
}
//----return(0);
}
i need to Standard Deviation calculation from SMA2[i]=iMAOnArray(SMA1,0,2,0,MODE_SMA,i)
plz help with this code
i need to Standard Deviation calculation from SMA2[i]=iMAOnArray(SMA1,0,2,0,MODE_SMA,i)
plz help thank you