# Help Newbie question

20
2013.12.16 11:37
```int start()
{
int i,
n,
Counted_Bars;
double Sum,
NatLog,
Sum_Sq,
Avg,
Avg_Sq,
Rms,
R_0,
R_1,
E_0,
E_1;

//------------------------------------------------------------------
Counted_Bars= IndicatorCounted();
i=Bars-Counted_Bars-1;
if (i>History-1)
i=History-1;
while(i>=0)
{
Sum =0;
Sum_Sq =0;
for(n=i;n<=i+Aver_Bars-1;n++)
{
NatLog=MathLog(Close[n]);
Sum=Sum + NatLog;
Sum_Sq=Sum_Sq + MathPow(NatLog,2);

Avg =Sum/Aver_Bars;
Avg_Sq =Sum_Sq/Aver_Bars;
Rms =MathSqrt(Avg_Sq);
R_0 =Avg/Rms;
R_1 =1/(MathSqrt(Aver_Bars));
E_0 =(R_0-R_1)+1;
E_1 = E_0/2;

}

Buf_0[i] =E_1; //79th line

i--;
}
```
'[' - assignment expected C:\Users\Mankin\Desktop\MetaTrader\experts\indicators\Prob_v1.mq4 (79, 11)
']' - assignment expected C:\Users\Mankin\Desktop\MetaTrader\experts\indicators\Prob_v1.mq4 (79, 13)
'=' - unexpected token C:\Users\Mankin\Desktop\MetaTrader\experts\indicators\Prob_v1.mq4 (79, 15)
';' - assignment expected C:\Users\Mankin\Desktop\MetaTrader\experts\indicators\Prob_v1.mq4 (79, 19)
Can't seem to figure out what's wrong.
Moderator
18002
2013.12.16 11:56
Abcogito:
'[' - assignment expected C:\Users\Mankin\Desktop\MetaTrader\experts\indicators\Prob_v1.mq4 (79, 11)
']' - assignment expected C:\Users\Mankin\Desktop\MetaTrader\experts\indicators\Prob_v1.mq4 (79, 13)
'=' - unexpected token C:\Users\Mankin\Desktop\MetaTrader\experts\indicators\Prob_v1.mq4 (79, 15)
';' - assignment expected C:\Users\Mankin\Desktop\MetaTrader\experts\indicators\Prob_v1.mq4 (79, 19)
Can't seem to figure out what's wrong.
Neither can we without seeing all the code . . . how have you declared the buffer Buf_0 ?
20
2013.12.16 11:59
```#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue

extern int History =50;
extern int Aver_Bars =5;

double Buf_0;
//+------------------------------------------------------------------+
//| Initialization function                              |
//+------------------------------------------------------------------+

int init()
{
SetIndexBuffer(0,Buf_0);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
return;
}
//+------------------------------------------------------------------+
//| Deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{

return;
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
int i,
n,
Counted_Bars;
double Sum,
NatLog,
Sum_Sq,
Avg,
Avg_Sq,
Rms,
R_0,
R_1,
E_0,
E_1;

//------------------------------------------------------------------
Counted_Bars= IndicatorCounted();
i=Bars-Counted_Bars-1;
if (i>History-1)
i=History-1;
while(i>=0)
{
Sum =0;
Sum_Sq =0;
for(n=i;n<=i+Aver_Bars-1;n++)
{
NatLog=MathLog(Close[n]);
Sum=Sum + NatLog;
Sum_Sq=Sum_Sq + MathPow(NatLog,2);

Avg =Sum/Aver_Bars;
Avg_Sq =Sum_Sq/Aver_Bars;
Rms =MathSqrt(Avg_Sq);
R_0 =Avg/Rms;
R_1 =1/(MathSqrt(Aver_Bars));
E_0 =(R_0-R_1)+1;
E_1 = E_0/2;

}

Buf_0[i] =E_1;

i--;
}

return;
}
//+------------------------------------------------------------------+```
Here this might clarify some things, thanks for the response
Moderator
18002
2013.12.16 12:03
Abcogito:
Here this might clarify some things, thanks for the response

OK, this isn't a buffer, it's just a double variable . . .

`double Buf_0;`

. . . read here and look at the sample code: IndicatorBuffers()