//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_width1 2
#property indicator_width2 2
#property indicator_color1 Red
#property indicator_color2 Lime
extern int 均线=5;
double duo[];
double kong[];
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0,duo);
SetIndexBuffer(1,kong);
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexDrawBegin(0,均线);
SetIndexDrawBegin(1,均线);
IndicatorDigits(Digits);
return(0);
}
//+------------------------------------------------------------------+
int start()
{
double temp0,temp1;
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars0) counted_bars--;
limit=Bars-counted_bars;
for(int i=limit; i>=0; i--)
{
duo[i]=EMPTY_VALUE;
kong[i]=EMPTY_VALUE;
temp0=iMA(NULL,0,均线,0,MODE_SMA,PRICE_CLOSE,i);
temp1=iMA(NULL,0,均线,0,MODE_SMA,PRICE_CLOSE,i+1);
if(temp0>=temp1) {duo[i]=temp0; duo[i+1]=temp1;}
else {kong[i]=temp0; kong[i+1]=temp1;}
}
return(0);
}
//+------------------------------------------------------------------+ |