求助:MT4自定义指标 不能自动刷新

刚学MT4,编了个指标,能够在数据窗口显示,但是不能随时间自动刷新,请教高手指点。代码如下:
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
extern int MA_Period=1;
extern int MA_Shift=0;
extern int MA_Method=0;
//---- indicator buffers
double ExtMapBuffer[];
//----
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
int draw_begin;
string short_name;
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexShift(0,MA_Period-1);
IndicatorDigits(3);

draw_begin=MA_Period-1;
//---- indicator short name
switch(MA_Method)
{
case 1 : short_name="SELL("; break;
default :
MA_Method=0;
short_name="BUY(";
}
IndicatorShortName(short_name+" Period= "+MA_Period+" )");
SetIndexDrawBegin(0,draw_begin);
//---- indicator buffers mapping
SetIndexBuffer(0,ExtMapBuffer);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
ExtCountedBars=IndicatorCounted();
if(ExtCountedBars>0) ExtCountedBars--;

switch(MA_Method)
{
case 0 : BUY(); break;
case 1 : SELL();
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
//| BUY() |
//+------------------------------------------------------------------+
void BUY()
{
int limit=Bars-ExtCountedBars;

for(int i=0; i<=limit; i++)
{
ExtMapBuffer[i]=(High[i]-Low[i+1])/Low[i+1];
}

//---- zero initial bars
if(ExtCountedBars<1)
ExtMapBuffer[Bars-1]=0;
}
//+------------------------------------------------------------------+
//| SELL() |
//+------------------------------------------------------------------+
void SELL()
{
int limit=Bars-ExtCountedBars;

for(int i=0; i<limit; i++)
{
ExtMapBuffer[i]=(High[i+1]-Low[i])/High[i+1];
}

//---- zero initial bars
if(ExtCountedBars<1)
ExtMapBuffer[Bars-1]=0;
}

第1个回答  2010-06-29
1楼 目的还不简单吗 搞钱啊
第2个回答  2010-06-25
查看一下时间变量是否正确。
第3个回答  2010-06-25
你刚学,就去学编指标,你学每天的目的是什么呀
相似回答