#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DeepSkyBlue
#property indicator_color2 DeepSkyBlue
int Periods=80;
double Line[],Line1[];
int init()//初始化函数
{
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID, 2);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID, 2);
SetIndexBuffer(0,Line);
SetIndexBuffer(1,Line1);
return(0);
}
int deinit()//反初始化函数
{
ObjectsDeleteAll();
return(0);
}
int start()
{
int i;
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for (i=limit-1;i>=0;i--)
{
Line[i]=iMA(NULL,0,Periods,0,MODE_EMA,PRICE_HIGH,i);
Line1[i]=iMA(NULL,0,Periods,0,MODE_EMA,PRICE_LOW,i);
}
return(0);
} |