//Macd
double Macd(string symbol,ENUM_TIMEFRAMES period,int fast,int slow,int index)
{
double buf[];
ArraySetAsSeries(buf,true);
int a=iMACD(symbol,period,0,fast,slow,STO_CLOSECLOSE);
int copied=CopyBuffer(a,0,0,index+1,buf);
return(buf[index]);
}