求教数组循环 新评论 xt107 2021.07.21 03:56 #property copyright "Copyright " #property link "XUE" //---- #property indicator_chart_window #property indicator_buffers 4 #property indicator_plots 4 extern int n1=10; extern int n2=60; extern int aa=0; double ma1Buffer[]; double ma2Buffer[]; double upBuffer[]; double downBuffer[]; //double macdBuffer[]; int OnInit() { SetIndexBuffer(0,ma1Buffer); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2,clrWhite); SetIndexLabel(0,"ma1"); SetIndexBuffer(1,ma2Buffer); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2,clrRed); SetIndexLabel(1,"ma2"); SetIndexBuffer(2,upBuffer); SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,3,clrMagenta); SetIndexLabel(2,"up"); SetIndexArrow(2,225); SetIndexBuffer(3,downBuffer); SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,3,clrYellow); SetIndexLabel(3,"down"); SetIndexArrow(3,226); return(INIT_SUCCEEDED); } void deinit() { ObjectsDeleteAll(); } 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[]) { int i,limit; if(rates_total<n1 || rates_total<n2) { return(0); } limit=rates_total-prev_calculated; if(prev_calculated>0) limit++; for(i=0;i<limit;i++) { double xiao1=iMA(NULL,0,n1,0,MODE_SMA,PRICE_CLOSE,i); double xiao2=iMA(NULL,0,n1,0,MODE_SMA,PRICE_CLOSE,i+1); double da1=iMA(NULL,0,n2,0,MODE_SMA,PRICE_CLOSE,i); double da2=iMA(NULL,0,n2,0,MODE_SMA,PRICE_CLOSE,i+1); ma1Buffer[i]=xiao1; ma2Buffer[i]=da1; bool condition 1; Condition 1=xiao1>da1 && xiao2<da2;//Golden Cha condition double s[]; int p=0; if(condition 1==true) { printf("Each time the distance meets the condition"+i);//Print the number of k-lines each time the condition meets to the present s[p]=i;// printf(s[p]); //Cannot print } } return(rates_total); } 问题:求条件成立到现在的K线数量,想实现第p次成立到现在的K先数量,但把符合条件的序号赋值给数组,但始终打印不出来。求教! THIS INDICATOR, HOW ARE THE BANDS CALCULATED, PLEASE Error inserting indicator alert for Metatrader 5 [Help] Who can help me convert old version Indicator to new MQL4 version(build 600) Wen Tao Xiong 2021.07.21 09:01 #1 写法有问题 xt107 2021.07.22 08:29 #2 Wen Tao Xiong: 写法有问题 求教下,该怎么写。谢谢! 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
问题:求条件成立到现在的K线数量,想实现第p次成立到现在的K先数量,但把符合条件的序号赋值给数组,但始终打印不出来。求教!