//--- input parameters
input uint CalculateBars=20;
double K[][3];
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
ArrayResize(K,CalculateBars);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
for(int i = 0; i < ArrayRange(K, 0);i++)
{
K[i][0]= iMACD(NULL,PERIOD_CURRENT,36,18,9,PRICE_CLOSE,MODE_MAIN,i);
K[i][1]= iMACD(NULL,PERIOD_CURRENT,36,18,9,PRICE_CLOSE,MODE_SIGNAL,i);
K[i][2]=K[i][0]-K[i][1];
}
}