下载MetaTrader 5
要添加评论,请登录注册
您习惯使用智能手机进行交易吗?MetaTrader 5移动版最适合您!
up10
78
up10 2008.01.23 12:21 

//+------------------------------------------------------------------+
//| DMI.mq4 |
//| Copyright ?2007, MetaQuotes Software Corp. |
//| http://www.MetaQuotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2007, MetaQuotes Software Corp."
#property link "http://www.MetaQuotes.net"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue

//---- buffers
double Buffer1[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Buffer1);
SetIndexDrawBegin(0,Buffer1);

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
int i, limit;
if(counted_bars>0) counted_bars--;
limit=Bars-IndicatorCounted();

double aa[];

for(i=0;i<limit;i++)
aa[i]=Close[i]-Close[i+5];

for(i=0;i<limit;i++)
Buffer1[i]=iMAOnArray(aa,Bars,14,0,MODE_SMA,i);

//----
return(0);
}
//+------------------------------------------------------------------+

okwh
1629
okwh 2008.01.23 16:22  

你没明白MT中数组的使用方式,该为下面的 aa

double Buffer1[];

double aa[];
........

//---- indicators

IndicatorBuffers(2);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Buffer1);

SetIndexBuffer(1,aa);

up10
78
up10 2008.01.23 16:49  
谢谢DxdCn。不过自定义数组的话一定得多加一根线吗?我其实不想画aa这条线阿。
up10
78
up10 2008.01.23 19:07  
搞定了,谢谢DxdCn。
/
要添加评论,请登录注册