=0.0;
}
for(i=pos; i
{
double sum=0.0;
for(k=0; k
sum+=ExtMainBuffer[i-k];
ExtSignalBuffer=sum/InpDPeriod;
}
string strAlertMessage;
/// UP
if (dtLastTime!=Time[0] && ExtMainBuffer[0]>ExtSignalBuffer[0] && ExtMainBuffer[1]
{
dtLastTime = Time[0];
strAlertMessage = StringConcatenate("KD 金叉: ",Symbol(),"_",PeriodToString(Period())," ",DoubleToStr(Close[0],Digits));
if (AlertPopup)
Alert(strAlertMessage);
if (Sound)
PlaySound("alert.wav");
if (Email)
SendMail(strAlertMessage,
"最新价格 "+DoubleToStr(Close[0],Digits)+
"\n服务器时间: " + TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS));
if (Mobile)
SendNotification(strAlertMessage);
}
/// DOWN
if (dtLastTime!=Time[0] && ExtMainBuffer[0]ExtSignalBuffer[1])
{
dtLastTime = Time[0];
strAlertMessage = StringConcatenate("KD 死叉: ",Symbol(),"_",PeriodToString(Period())," ",DoubleToStr(Close[0],Digits));
if (AlertPopup)
Alert(strAlertMessage);
if (Sound)
PlaySound("alert.wav");
if (Email)
SendMail(strAlertMessage,
"最新价格 "+DoubleToStr(Close[0],Digits)+
"\n服务器时间: " + TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS));
if (Mobile)
SendNotification(strAlertMessage);
}
//--- OnCalculate done. Return new prev_calculated.
return(rates_total);
}
//+------------------------------------------------------------------+
string PeriodToString (int imin)
{
string strprd;
switch (imin)
{
case (1):
strprd="M1";
break;
case (2):
strprd="M2";
break;
case (3):
strprd="M3";
break;
case (5):
strprd="M5";
break;
case (15):
strprd="M15";
break;
case (30):
strprd="M30";
break;
case (60):
strprd="H1";
break;
case (60*4):
strprd="H4";
break;
case (60*24):
strprd="D1";
break;
case (60*24*7):
strprd="W1";
break;
}
return (strprd);
}