[MT4指标]HLema均线交叉预警
主图指标
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
是否含有未来函数:无
//+------------------------------------------------------------------+
//| CrossedAlerts.mq4 |
//| Coders Guru |
//| http://www.forex-tsd.com |
//+------------------------------------------------------------------+
#property copyright \"Coders Guru\"
#property link \"http://www.forex-tsd.com\"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- buffers
double ExtMapBuffer1;
double ExtMapBuffer2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
bool Crossed (double line1 , double line2 )
{
static string last_direction = \"\";
string current_dirction = \"\";
if(line1>line2)current_dirction = \"up\";
if(line1<=line2)current_dirction = \"down\";
if(current_dirction != last_direction)
{
Alert(\"EMA Cross for \"+Symbol()+\" on the \"+Period()+\" minute chart.\");
last_direction = current_dirction;
return (true);
}
else
{
return (false);
}
}
int start()
{
int counted_bars=IndicatorCounted();
//---- check for possible errors
if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
if (counted_bars>0) counted_bars--;
int pos=Bars-counted_bars;
while(pos>=0)
{
ExtMapBuffer1[pos]= iMA(NULL,0,144,0,MODE_EMA,PRICE_CLOSE,pos);
ExtMapBuffer2[pos]= iMA(NULL,0,200,0,MODE_EMA,PRICE_CLOSE,pos);
pos--;
}
Print(Crossed (ExtMapBuffer1[0],ExtMapBuffer2[0]));
//----
return(0);
}
//+------------------------------------------------------------------+
发表于:2017-08-11 10:33只看该作者
2楼
阅尽天下指标
韬客社区www.talkfx.co
发表于:2017-08-16 01:40只看该作者
3楼
阅尽天下指标
韬客社区www.talkfx.co
发表于:2018-07-11 09:51只看该作者
4楼
你不会把2个文件夹压缩在一起啊,难道非要分开?