为什么加上Strict之后指标就不显示了,应该修改什么地方? 新评论 Jie Hao Xie 2022.01.10 08:21 //#property Strict #property indicator_chart_window #property indicator_buffers 3 #property indicator_plots 3 //--- plot SuperTrend #property indicator_label1 "SuperTrend" #property indicator_type1 DRAW_LINE #property indicator_style1 STYLE_SOLID #property indicator_width1 3 //--- plot Lower #property indicator_label2 "Lower" #property indicator_type2 DRAW_LINE #property indicator_color2 clrRed #property indicator_style2 STYLE_SOLID #property indicator_width2 3 //--- plot Upper #property indicator_label3 "Upper" #property indicator_type3 DRAW_LINE #property indicator_color3 clrGreen #property indicator_style3 STYLE_SOLID #property indicator_width3 3 //--- input parameters input int SuperTrend_Period=10; input double SuperTrend_Multiplier=3.0; //--- indicator buffers double LowerBuffer[]; double UpperBuffer[]; double SuperTrend[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,SuperTrend); SetIndexLabel(0,"SuperTrend"); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,LowerBuffer); SetIndexLabel(1,"SuperTrend Down"); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,UpperBuffer); SetIndexLabel(2,"SuperTrend Up"); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ 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 iNewBars,iCountedBars,i; double dAtr,dUpperLevel,dLowerLevel; // Get unprocessed ticks iCountedBars=IndicatorCounted(); if(iCountedBars<0) return (-1); if(iCountedBars>0) iCountedBars--; iNewBars=Bars-iCountedBars; for(i=iNewBars;i>=0;i--) // Calc SuperTrend { dAtr=iATR(NULL, 0, SuperTrend_Period, i); dUpperLevel=(High[i]+Low[i])/2+SuperTrend_Multiplier*dAtr; dLowerLevel=(High[i]+Low[i])/2-SuperTrend_Multiplier*dAtr; // Set supertrend levels if(Close[i]>SuperTrend[i+1] && Close[i+1]<=SuperTrend[i+1]) { SuperTrend[i]=dLowerLevel; } else if(Close[i]<SuperTrend[i+1] && Close[i+1]>=SuperTrend[i+1]) { SuperTrend[i]=dUpperLevel; } else if(SuperTrend[i+1]<dLowerLevel) { SuperTrend[i]=dLowerLevel; } else if(SuperTrend[i+1]>dUpperLevel) { SuperTrend[i]=dUpperLevel; } else { SuperTrend[i]=SuperTrend[i+1]; } // Draw SuperTrend lines UpperBuffer[i]=EMPTY_VALUE; LowerBuffer[i]=EMPTY_VALUE; if(Close[i]>SuperTrend[i] || (Close[i]==SuperTrend[i] && Close[i+1]>SuperTrend[i+1])) UpperBuffer[i]=SuperTrend[i]; else if (Close[i]<SuperTrend[i] || (Close[i]==SuperTrend[i] && Close[i+1]<SuperTrend[i+1])) LowerBuffer[i]=SuperTrend[i]; } return(0); } //+------------------------------------------------------------------+ #property Strict 这个是我在网上下载的supertrend源码 问题是如果前面加上#property Strict就用不了了 这个怎么解决呢?半天了不知道该改什么地方求教! Tiecheng Fu 2022.01.10 09:00 #1 //#property Strict 这个是针对新版mt4,对语法和编译方面更严格而已。 如果仅仅是使用这个指标,如果指标没问题,可以忽略这个strict 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
这个是我在网上下载的supertrend源码 问题是如果前面加上#property Strict就用不了了 这个怎么解决呢?半天了不知道该改什么地方求教!