初学者的问题 MQL5 MT5 MetaTrader 5 - 页 1065 1...105810591060106110621063106410651066106710681069107010711072...1503 新评论 Igor Makanu 2019.06.18 07:53 #10641 yiduwi:谢谢你,你能告诉我为什么箭头放在第二个柱子上而不是第一个柱子上吗?所以你把箭头放在第二条上,而不是放在第一条上--它不会自己画出来,对吗?))) 你肯定在这里多加了一个 BufferDN[i+1]=high[i+1]。 yiduwi 2019.06.18 08:04 #10642 Igor Makanu:所以你把箭头放在第二条上,而不是放在第一条上--它不会自己画出来,对吗?))) 我猜你一定在这里多加了一个 BufferDN[i+1]=high[i+1]。呃,没有那个,一般情况下,箭头放在第三条上,代码小,我哪里搞砸了? #property indicator_chart_window #property indicator_buffers 2 #property indicator_plots 2 //--- plot UP #property indicator_label1 "UP" #property indicator_type1 DRAW_ARROW #property indicator_color1 clrLawnGreen #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot DN #property indicator_label2 "DN" #property indicator_type2 DRAW_ARROW #property indicator_color2 clrDeepPink #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- indicator buffers double BufferUP[]; double BufferDN[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,BufferUP); SetIndexBuffer(1,BufferDN); PlotIndexSetInteger(0,PLOT_ARROW,233); PlotIndexSetInteger(1,PLOT_ARROW,234); //--- 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[]) { //--- if(rates_total<3) return(0); int limit=rates_total-prev_calculated; if(limit>1) { limit=rates_total-3; ArrayInitialize(BufferUP,EMPTY_VALUE); ArrayInitialize(BufferDN,EMPTY_VALUE); } for(int i=limit; i>=0; i--) { if (fabs(high[i+1]-high[i+2]) <= 0.0*_Point) { BufferDN[i]=high[i]; } } //--- return value of prev_calculated for next call return(rates_total); } 如果是这样的话,它就会进入第一条。BufferDN[i+2]=high[i+2]; 我不明白。 fxsaber 2019.06.18 08:06 #10643 Igor Makanu:这是解决方案,但我认为没有任何东西是我考虑过的。逻辑上说这是正确的。 Igor Makanu 2019.06.18 08:23 #10644 yiduwi:唉,没有单位,一般来说,箭头放在第三条上,代码小,我哪里弄错了? 它被放在第一条上,如果是这样的话,我就不明白了。可能是这样,但我没有在MT5下写,我可能是错的。 //+------------------------------------------------------------------+ //| tst.mq5 | //| IgorM | //| https://www.mql5.com/ru/users/igorm | //+------------------------------------------------------------------+ #property copyright "IgorM" #property link "https://www.mql5.com/ru/users/igorm" #property version "1.00" #property indicator_chart_window #property indicator_buffers 2 #property indicator_plots 2 //--- plot UP #property indicator_label1 "UP" #property indicator_type1 DRAW_ARROW #property indicator_color1 clrLawnGreen #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot DN #property indicator_label2 "DN" #property indicator_type2 DRAW_ARROW #property indicator_color2 clrDeepPink #property indicator_style2 STYLE_SOLID #property indicator_width2 1 input int Pips=5; //--- indicator buffers double BufferUP[]; double BufferDN[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,BufferUP); SetIndexBuffer(1,BufferDN); PlotIndexSetInteger(0,PLOT_ARROW,233); PlotIndexSetInteger(1,PLOT_ARROW,234); //--- 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 limit=rates_total-prev_calculated; if(limit>1 || prev_calculated==0) { limit=rates_total-2; ArrayInitialize(BufferUP,EMPTY_VALUE); ArrayInitialize(BufferDN,EMPTY_VALUE); } for(int i=limit; i>=0; i--) { if(fabs(high[i+1]-high[i])<=_Point*(double)Pips) BufferDN[i]=high[i]; } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+ yiduwi 2019.06.18 08:39 #10645 Igor Makanu:可能是这样,但我不在MT5下写作,我可能是错的。 另外,在第二条把我) Alexey Viktorov 2019.06.18 08:47 #10646 Igor Makanu: 谢谢,这就是其中的一个错误,但还是搞不清楚如何从159,002秒到44小时10分2秒(在线计算器 )。) 这是解决方案,但我认为我错过了一些东西 2019.06.18 11:46:22.691 tstss EURUSD,H1: h = 44 , m = 10 , s = 2在我看来,似乎更简单 int timeinsec = 159002; int sec = timeinsec%60; int min = ((timeinsec-sec)%3600)/60; int hou = (timeinsec-sec-min)/3600; Igor Makanu 2019.06.18 09:09 #10647 yiduwi:另外,在第二条把我)箭头应该只放在条件满足的地方,对了,我记得MT5最好有一个完整的松弛条件。 if(fabs(high[i+1]-high[i])<=_Point*(double)Pips) BufferDN[i]=high[i]; else BufferDN[i]=EMPTY_VALUE;阿列克谢-维克多罗夫。我认为这比较容易。 找到了!谢谢你!这正是我想要的。 pivomoe 2019.06.18 11:24 #10648 有一些代码有大量的Print调用。有没有什么方法可以在不删除代码的情况下快速关闭它们? 这是我目前看到的唯一选择。bool L=true; if(L)Print("123");即用 "if(L)Print("替换所有的 "Print(",也许还有一些其他的选项? Vladimir Karputov 2019.06.18 11:30 #10649 pivomoe: 有一些代码,其中有大量的Print调用。有没有什么方法可以在不从代码中删除打印的情况下快速禁用它们? 到目前为止,我只看到这个选项。 即用 "if(L)Print("取代所有的 "Print(",也许还有一些其他的选项? 在输入参数中输出 "打印 "标志。它将像你的代码一样工作,但标志本身(bool变量)将在输入参数中。 Rustam Ayupov 2019.06.18 16:44 #10650 你好! 在MT5测试器中通过所有符号进行优化,拒绝工作... 能否请您指点我如何使其发挥作用? 谢谢你。 1...105810591060106110621063106410651066106710681069107010711072...1503 新评论 原因: 取消 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
谢谢你,你能告诉我为什么箭头放在第二个柱子上而不是第一个柱子上吗?
所以你把箭头放在第二条上,而不是放在第一条上--它不会自己画出来,对吗?)))
你肯定在这里多加了一个 BufferDN[i+1]=high[i+1]。
所以你把箭头放在第二条上,而不是放在第一条上--它不会自己画出来,对吗?)))
我猜你一定在这里多加了一个 BufferDN[i+1]=high[i+1]。
呃,没有那个,一般情况下,箭头放在第三条上,代码小,我哪里搞砸了?
如果是这样的话,它就会进入第一条。 我不明白。这是解决方案,但我认为没有任何东西是我考虑过的。
逻辑上说这是正确的。
唉,没有单位,一般来说,箭头放在第三条上,代码小,我哪里弄错了?
它被放在第一条上,如果是这样的话,我就不明白了。可能是这样,但我没有在MT5下写,我可能是错的。
可能是这样,但我不在MT5下写作,我可能是错的。
另外,在第二条把我)
谢谢,这就是其中的一个错误,但还是搞不清楚如何从159,002秒到44小时10分2秒(在线计算器 )。)
这是解决方案,但我认为我错过了一些东西
在我看来,似乎更简单
另外,在第二条把我)
箭头应该只放在条件满足的地方,对了,我记得MT5最好有一个完整的松弛条件。
我认为这比较容易。
找到了!谢谢你!这正是我想要的。
即用 "if(L)Print("替换所有的 "Print(",也许还有一些其他的选项?
有一些代码,其中有大量的Print调用。有没有什么方法可以在不从代码中删除打印的情况下快速禁用它们? 到目前为止,我只看到这个选项。
即用 "if(L)Print("取代所有的 "Print(",也许还有一些其他的选项?
在输入参数中输出 "打印 "标志。它将像你的代码一样工作,但标志本身(bool变量)将在输入参数中。
你好!
在MT5测试器中通过所有符号进行优化,拒绝工作...
能否请您指点我如何使其发挥作用?
谢谢你。