Dear users:
Im trying to code an indicator that shows the MA and EMA of the Volume bars. I have managed to successfully code the SMA but with the EMA, Im getting some issues and I cannot advance. I have detected some stacks overflow also. Anyway below is my code and I dont think I have it good at all. Any more experience can help?
Im trying to code an indicator that shows the MA and EMA of the Volume bars. I have managed to successfully code the SMA but with the EMA, Im getting some issues and I cannot advance. I have detected some stacks overflow also. Anyway below is my code and I dont think I have it good at all. Any more experience can help?
Inserted Code
double EMA_Volume(int i, int size)
{
if (i==MA_Period+2)return MA_Volume(i,size);
double multiplier=(2 / (size + 1) ) ;
return (Volume[i] - EMA_Volume(i+1,10) * multiplier + EMA_Volume(i+1,10));
}
double MA_Volume(int i, int size)
{
double suma=0;
for(int j=i; j<i+size;j++)
{
suma=suma+Volume[j];
}
if ((suma/size)==0){Alert("Something is wrong with the volume of bar nš= ",i," ",GetLastError());return 50;}
else
return (NormalizeDouble((Volume[i]/NormalizeDouble(suma/size,2))*100,2));
} Greetings, BeLikewater