象高手求教！！！

25
2009.10.21 04:37

//+------------------------------------------------------------------+
//| EAtest.mq4 |
//| Copyright ?2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
double ma13v[];
double ma13vv[];

int start()
{
//----
for (int i =1;i<=3000;i++)
{
double ma05,ma013, ma5,ma13;
ma05=iMA(NULL,0,5,0,MODE_SMA,PRICE_CLOSE,i-1) ;
ma013=iMA(NULL,0,13,0,MODE_SMA,PRICE_CLOSE,i-1) ;
ma5=iMA(NULL,0,5,0,MODE_SMA,PRICE_CLOSE,i) ;
ma13=iMA(NULL,0,13,0,MODE_SMA,PRICE_CLOSE,i) ;

if((ma05>ma013&&ma5<ma13)|| (ma013>ma05&&ma13<ma5))
{
ma13v[i]=ma13;
}
else ma13v[i]=0.1;

Print("ma",ma13v[i]);

}

/* double a;
if(ma13v[i]!=0.1)
ma13vv[j]=ma13v[i];
j++;
Print("ma13vv[5]",a);*/

return(0);
}
//+-

178
2009.10.21 15:30
Print("ma=" + DoubleToStr(ma13v[i], 5));
172
2009.10.21 20:07
double ma13v[];

double ma13vv[];

double ma13v[3000];
double ma13vv[3000];

25
2009.10.26 02:42
y2k_connect 写道 >>
Print("ma=" + DoubleToStr(ma13v[i], 5));

25
2009.10.26 02:43
xfxyldj 写道 >>
double ma13v[];

double ma13vv[];

double ma13v[3000];
double ma13vv[3000];

178
2009.10.26 04:57
tang15021122935 写道 >>

double ma13v[];

```int init() {
IndicatorBuffers(1);

SetIndexBuffer(0, ma13v);
SetIndexDrawBegin(0, 0);
SetIndexEmptyValue(0, 0);

return(0);
}```

172
2009.10.26 05:12
tang15021122935 写道 >>

`SetIndexBuffer（）`

 ArrayResize( void array[], int new_size)

25
2009.10.27 05:02
y2k_connect 写道 >>

double ma13v[];

if((ma13vv[i-1]>ma13vv[i-2]) && (ma13vv[i-1]>ma13vv[i]))

if((ma13vv[i-1]<ma13vv[i]) && (ma13vv[i-1]<ma13vv[i-2]))
di[i]=ma13vv[i];

#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Red
#property indicator_color4 Blue
#property indicator_color5 Yellow

//---- input parameters
//---- indicator buffers
double gao[100000];
double di[100000];
double crossup[100000];
double crossdown[100000];
double ma13v[100000];
double ma13vv[100000];
double fanzhuan[1000000];
datetime tim[1000000];
datetime crosstim[1000000];
int shift[100000];
int xiaobiao[100000];
int count=0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- line shifts when drawing

//---- first positions skipped when drawing

//---- 3 indicator buffers mapping
SetIndexBuffer(0,gao);
SetIndexBuffer(1,di);
SetIndexBuffer(2,crossup);
SetIndexBuffer(3,crossdown);
SetIndexBuffer(4,ma13v);

//---- drawing settings
SetIndexStyle(0,DRAW_ARROW);
SetIndexStyle(1,DRAW_ARROW);
SetIndexStyle(2,DRAW_ARROW,EMPTY, 2, Red);
SetIndexStyle(3,DRAW_ARROW,EMPTY, 2, Blue);
SetIndexStyle(4,DRAW_ARROW,EMPTY, 2, Yellow);

SetIndexArrow(0,67);
SetIndexArrow(1,68);
SetIndexArrow(2,241);
SetIndexArrow(3,242);
SetIndexArrow(4,251);

SetIndexEmptyValue(0, 0);
SetIndexEmptyValue(1, 0);
SetIndexEmptyValue(2, 0);
SetIndexEmptyValue(3, 0);
SetIndexEmptyValue(4, 0);

//---- index labels

//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Bill Williams' Alligator |
//+------------------------------------------------------------------+
int start()
{
int limit;
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;
//---- main loop
for(int i=1; i<limit; i++)
{
//---- ma_shift set to 0 because SetIndexShift called abowe

double ma05,ma013, ma5,ma13;
ma05=iMA(NULL,0,5,0,MODE_SMA,PRICE_CLOSE,i-1) ;
ma013=iMA(NULL,0,13,0,MODE_SMA,PRICE_CLOSE,i-1) ;
ma5=iMA(NULL,0,5,0,MODE_SMA,PRICE_CLOSE,i) ;
ma13=iMA(NULL,0,13,0,MODE_SMA,PRICE_CLOSE,i) ;

if(ma05>ma013&&ma5<ma13)

crossup[i]=ma13;

if (ma013>ma05&&ma13<ma5)
crossdown[i]=ma13;

if((ma05>ma013&&ma5<ma13)|| (ma013>ma05&&ma13<ma5))

ma13v[i]=ma13;

}

for(i=1;i<20000;i++)
{
if(ma13v[i]!=0)
{
ma13vv[count]=ma13v[i];
count++;
}

Comment("ma13vv[2]", DoubleToStr(ma13vv[2],5) );

}

for(i=3;i<2000;i++)
{
if((ma13vv[i-1]>ma13vv[i-2]) && (ma13vv[i-1]>ma13vv[i]))
gao[i]=ma13vv[i];

if((ma13vv[i-1]<ma13vv[i]) && (ma13vv[i-1]<ma13vv[i-2]))
di[i]=ma13vv[i];
}

178
2009.10.27 05:52

```#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Red
#property indicator_color4 Blue
#property indicator_color5 Yellow```

```#property indicator_separate_window

#property indicator_buffers	2
#property indicator_color4	Lime		// BarUp

#property indicator_color5	Red		// BarDown

//---- input parameters

... ...

//---- buffers

double	BarUp[], BarDown[];

int init() {

IndicatorBuffers(2);

IndicatorDigits(Digits + 1);

IndicatorShortName("ma_2");

SetLevelValue(0, 0);

SetLevelStyle(STYLE_DOT, 1, Silver);

SetIndexBuffer(0, BarUp);

SetIndexStyle(0, DRAW_HISTOGRAM);

SetIndexLabel(0, "Bar+");

SetIndexDrawBegin(0, ma_period1);

SetIndexEmptyValue(0, 0);

SetIndexBuffer(1, BarDown);

SetIndexStyle(1, DRAW_HISTOGRAM);

SetIndexLabel(1, "Bar-");

SetIndexDrawBegin(1, ma_period1);

SetIndexEmptyValue(1, 0);

return(0);

}

... ...
```
/