数组均线指标,执行效率很慢,显示不出来,各位大侠帮我改改吧 新评论 [删除] 2011.01.20 08:31 //+------------------------------------------------------------------+ //| FATL.mq4 | //| Copyright ? 2004, MetaQuotes Software Corp. | //| https://www.metaquotes.net// | //+------------------------------------------------------------------+ #property copyright "Copyright ? 2004, MetaQuotes Software Corp." #property link "https://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); } //+------------------------------------------------------------------+ 附加的文件: satl--zqdh.mq4 4 kb 这么个简单的程序为什么画不出线呢?请教牛牛们。 欢迎来到MQL4课程 能不能用mt4编写出这样的曲线EMA(MA(C,N),M)? 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
//+------------------------------------------------------------------+
//| FATL.mq4 |
//| Copyright ? 2004, MetaQuotes Software Corp. |
//| https://www.metaquotes.net// |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2004, MetaQuotes Software Corp."
#property link "https://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);
}
//+------------------------------------------------------------------+