下载MetaTrader 5

求好人帮忙把这几行通达信代码改成MQl语言,很感谢

要添加评论,请登录注册
您了解MQL5可以创建自定义图形工具吗?
lawyingkit
6
lawyingkit 2013.07.30 09:47 

AA:=(3*CLOSE+OPEN+LOW+HIGH)/6;


BB:(20*AA+19*REF(AA,1)+18*REF(AA,2)+17*REF(AA,3)+16*REF(AA,4)+15*REF(AA,5)+14*REF(AA,6)

+13*REF(AA,7)+12*REF(AA,8)+11*REF(AA,9)+10*REF(AA,10)+9*REF(AA,11)+8*REF(AA,12)

+7*REF(AA,13)+6*REF(AA,14)+5*REF(AA,15)+4*REF(AA,16)+3*REF(AA,17)+2*REF(AA,18)+

REF(AA,20))/210,COLORYELLOW;


CC:MA(BB,5),COLORRED;



47803124
157
47803124 2013.08.01 17:09  

这样的指标无意义,我完全可以写出来,但我载入通达信看了,没有的均线QQ 47803124

lmeletric
19
lmeletric 2013.08.10 01:53  
#property indicator_chart_window
#property indicator_buffers 3
//#property indicator_color1 Blue
#property indicator_color2 White
#property indicator_color3 Blue

//int indicator_color3;
//---- indicator parameters
extern int MAperiod=10;

//---- indicator buffers
double ind_buffer0[];
double ind_buffer1[];
double ind_buffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1);
// SetIndexDrawBegin(1,SignalSMA);

//---- indicator buffers mapping
if(!SetIndexBuffer(0,ind_buffer0) && !SetIndexBuffer(1,ind_buffer1) && !SetIndexBuffer(2,ind_buffer2))
Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence |
//+------------------------------------------------------------------+
int start()
{
int limit;
double sum;
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--;
limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
for(int i=0; i<limit; i++)
ind_buffer0[i]=(3*Close[i]+Open[i]+High[i]+Low[i])/6.0;
//---- signal line counted in the 2-nd buffer
for(i=0; i<limit; i++)
{
sum=0;
for(int j=0; j<20; j++)
{
sum += (20-j)*ind_buffer0[i+j];
}
ind_buffer1[i] = sum/210.0;
}

for(i=0; i<limit; i++)
{
ind_buffer2[i]=iMAOnArray(ind_buffer1,Bars,MAperiod,0,MODE_LWMA,i);
}

//---- done
return(0);
}
要添加评论,请登录注册