我有一个指标不显示,不知道哪儿错了,请高手赐教
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_separate_window
#property indicator_buffers 3
input int m=144;
input int k=5;
double A1[];
double A2[];
double A3[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int OnInit()
{
SetIndexStyle(0,DRAW_NONE);
SetIndexBuffer(0,A1);
SetIndexStyle(1,DRAW_NONE);
SetIndexBuffer(1,A2);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1,clrWhite);
SetIndexBuffer(2,A3);
return(INIT_SUCCEEDED);
}
//------------------------------------------------------------------
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
if(rates_total<16)
{
return(0);
}
int i,limit;
limit=rates_total-prev_calculated;
if(prev_calculated>0)limit++;
ppp(i,limit);
return(rates_total);
}
//+------------------------------------------------------------------+
void ppp(int i,int limit)
{
//TR1:=EMA(CLOSE,16);
for(i=0;i<limit-1;i++)
{
A1[i]=iMA(NULL,0,m,0,MODE_EMA,PRICE_CLOSE,i);
}
//TR2:=EMA(TR1,16);
for(i=0;i<limit-1;i++)
{
A2[i]=iMAOnArray(A1,0,k,0,MODE_EMA,i);
}
for(i=0;i<limit-1;i++)
{
A3[i]=100000*(A2[0]-A2[2])/A2[2];
}
}
|