下载MetaTrader 5
要添加评论,请登录注册
发表 您的文章,全世界数以千计的人们都将阅读它!
ZhiJun Zhang
476
ZhiJun Zhang 2011.11.29 12:34 

怎么在macd双线指标上加上箭头?

怎么在macd双线指标背离的情况下加上箭头?

下面是macd双线指标 ,知道的帮个忙???我的邮件:cnre@sina.com

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Yellow
//--- input parameters
extern int macd_fast=12;
extern int macd_slow=26;
extern int macd_period=9;
//--- 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);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return( -1);
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
for(int i=0;i<limit;i++) //這個循環是K線序列循環。是給ExtMapBuffer1234賦值
{
ExtMapBuffer1[i]=iMACD(NULL,0,macd_fast,macd_slow,macd_period,PRICE_CLOSE,MODE_MAIN,i);
//調用系統自帶MACD柱狀線的值,並用這個值給ExtMapBuffer1[i]賦值
ExtMapBuffer2[i]=iMACD(NULL,0,macd_fast,macd_slow,macd_period,PRICE_CLOSE,MODE_SIGNAL,i);
//調用系統自帶MACD紅線的值,並用這個值給ExtMapBuffer2[i]賦值
}
return(0);
}
//+------------------------------------------------------------------+

Ricky Wen
4437
Ricky Wen 2011.12.02 02:24  
hi, 我写过macd 顶底背离的指标。 qq: 357435993
/
要添加评论,请登录注册