我在博易大师软件里写了一个指标,源代码如下:
MA40:=MA(CLOSE,X4); 按收盘价求平均线,参数X4=8;
RSV15:=((HHV(HIGH,16*X4)-MA40)/(HHV(HIGH,16*X4)-LLV(LOW,16*X4))*100)-70;(以下的原理同上);
RSV25:=(MA40-LLV(LOW,16*X4))/(HHV(HIGH,16*X4)-LLV(LOW,16*X4))*100;
A15:=SMA(RSV15,7*X4,X4);
//A15:=(X4*RSV15+6*X4*A15REV)/(7*X4)=(RSV15+6*A15REV)/7;
FASTK5:=SMA(RSV25,2*X4,X4);
//FASTK5:=(RSV25+FASTK5REV)/2;
B15:=SMA(FASTK5,2*X4,X4);
//B15:=(FASTK5+B15REV)/2;
DAI15:=B15-A15;
DAI2016:=MA(DAI15,20*X4);
AAA016
双线指标编程问题,请教!
AI15-DAI2016;----------------------划线
AAA04AI2016-70;----------------------------划线
我写的MT4程序如下:
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Lime
//--- input parameters
extern int x4=15;
//--- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexLabel(0,"AAA016");
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexLabel(1,"AAA04");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
double RSV15[],A15[],RSV25[],FASTK5[],B15[];
double DAI15[],DAI2016[],AAA016[],AAA04[];
if(counted_bars0) counted_bars --;
int limit=Bars-counted_bars;
ArrayResize(RSV15,Bars);
ArrayResize(A15,Bars);
ArrayResize(RSV25,Bars);
ArrayResize(FASTK5,Bars);
ArrayResize(B15,Bars);
ArrayResize(DAI15,Bars);
ArrayResize(DAI2016,Bars);
for(int i=0;i=0;i2 --)
{
A15[i2]=(RSV15[i2]+6*A15[i2+1])/7;
FASTK5[i2]=(RSV25[i2]+FASTK5[i2+1])/2;
B15[i2]=(FASTK5[i2]+B15[i2+1])/2;
}
for(int i4=0;i4 |