连续阴阳报警(语音报警)
extern int 连续K线数=4;//连续k线数
int mark=0,i;//报警标记
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
//mark=0;
int 连续阴数=0,连续阳数=0;
for(i=0;i<连续K线数;i++)
{
if(iOpen(NULL,0,i)-iClose(NULL,0,i)>0) 连续阴数++;
}
for(i=0;i<连续K线数;i++)
{
if(iOpen(NULL,0,i)-iClose(NULL,0,i)<0) 连续阳数++;
}
Comment("\n",连续K线数,"根K线范围内的阴线数:",连续阴数,"根 阳线数:",连续阳数,"根");
if(连续K线数==连续阳数 && mark!=1)
{
PlaySound("连续阳线.wav");
// Alert(Symbol()," 连续出现",连续阳数,"根阳线");
mark=1;
}
if(连续K线数==连续阴数 && mark!=2)
{
PlaySound("连续阴线.wav");
//Alert(Symbol()," 连续出现",连续阴数,"根阴线");
mark=2;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
学习了,谢谢分享、、、 路过,支持一下啦 好帖,来顶下 没看完~~~~~~ 先顶,好同志 帮你顶下哈!! 学习了,不错 帮你顶下哈!! 谢谢楼主分享 帮你顶下哈!!
页:
[1]
2