发表于:2006-10-13 13:12只看该作者
2楼
//--简单的可以这样
//+------------------------------------------------------------------+
//| alertprice.mq4 |
//| Copyright ?2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Magenta
//---- input parameters
extern double alertprice=1.2523;
int flag1;
extern int times=5;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(8);
//---- 1 additional buffers are used for counting.
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
IndicatorShortName("AlertPrice");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//-------
if(Close[0]==alertprice && flag1<=times)
{
Alert(Symbol()," ",Close[0]);
flag1++;
}
if(Close[0]>=alertprice+20*Point && flag1==times+1)
{Alert(Symbol()," ",Close[0]);
flag1=0;
}
if(Close[0]<=alertprice-20*Point && flag1==times+1)
{
Alert(Symbol()," ",Close[0]);
flag1=0;
}
return(0);
}
//+------------------------------------------------------------------+
[ 本帖最后由 老正 于 2006-10-16 13:16 编辑 ]
韬客外汇论坛TALKFOREX.COM