下载MetaTrader 5
要添加评论,请登录注册
使用MQL5.community搜索。很简单!
wuguang2008
4
wuguang2008 2011.01.20 09:31 

//+------------------------------------------------------------------+
//| FATL.mq4 |
//| Copyright ? 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 2

#property indicator_color1 Wheat
#property indicator_color2 IndianRed
//---- buffers

double SATLBuffer[];
double SATLBuffer2[];

//+------------------------------------------------------------------+
//| FATL weights |
//+------------------------------------------------------------------+

#define SATLPeriods 65
double g_SATLKoef[SATLPeriods]=
{
0.0982862174,+0.0975682269,+0.0961401078,+0.0940230544,+0.0912437090,+0.0878391006,
+0.0838544303,+0.0793406350,+0.0743569346,+0.0689666682,+0.0632381578,+0.0572428925,
+0.0510534242,+0.0447468229,+0.0383959950,+0.0320735368,+0.0258537721,+0.0198005183,
+0.0139807863,+0.0084512448,+0.0032639979,-0.0015350359,-0.0059060082,-0.0098190256,
-0.0132507215,-0.0161875265,-0.0186164872,-0.0205446727,-0.0219739146,-0.0229204861,
-0.0234080863,-0.0234566315,-0.0231017777,-0.0223796900,-0.0213300463,-0.0199924534,
-0.0184126992,-0.0166377699,-0.0147139428,-0.0126796776,-0.0105938331,-0.0084736770,
-0.0063841850,-0.0043466731,-0.0023956944,-0.0005535180,+0.0011421469,+0.0026845693,
+0.0040471369,+0.0052380201,+0.0062194591,+0.0070340085,+0.0076266453,+0.0080376628,
+0.0083037666,+0.0083694798,+0.0082901022,+0.0080741359,+0.0077543820,+0.0073260526,
+0.0068163569,+0.0062325477,+0.0056078229,+0.0049516078,+0.0161380976
};

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(2);

SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(0, SATLBuffer);
// SetIndexDrawBegin(0,65);

//----
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//---- TODO: add your code here
int x,y,g=0,j,pos;
double sum3;
//----
if(counted_bars<0) return(-1);
//if (counted_bars>0) counted_bars--;
//---- main calculation loop
for(pos=Bars-counted_bars-1;pos>=0;pos--)
{
sum3=0; // zero summary
for(j=0;j<SATLPeriods;j++)
for(y=0;y<5;y++ )
g++;
SATLBuffer2[g]=g_SATLKoef[j];
for(x=g;x>=0;x--)
sum3+=SATLBuffer2[x]*Close[pos+x];
SATLBuffer[pos]=sum3/5;

//--------------------------------------------------------
}

return(0);
}
//+------------------------------------------------------------------+

附加的文件:
/
要添加评论,请登录注册