新人对MQL4和MQL5的任何问题,对算法和代码的帮助和讨论 - 页 1491

 
Alexey Viktorov:

如此明目张胆地撒谎是不体面的。你删除你的帖子,把你的文盲归咎于别人。骗子。

什么信息?
,我从一开始只写了prev_calculated和rate_total。

对此,我得到了你的答复。

你为什么要这样取笑一个没有经验的程序员呢?

如果有遗漏的历史,而且差额超过1怎么办?但我们并不关心,让我们跳过一个酒吧......你知道,多一个,少一个。如果没有解释,我们为什么要给出代码?看看你最后得到了什么?

所以你就是那个骗子)

1

 
Taras Slobodyanik:

是的,你需要改变数组的方向,或者采取rate_total-2 的索引而不是1


加入后。

ArraySetAsSeries(open,true);
ArraySetAsSeries(high,true);
ArraySetAsSeries(low,true);
ArraySetAsSeries(close,true);
ArraySetAsSeries(time,true);   

定义正确。

2021.06.02 18:33:09.480 Test (Volatility 10 Index,M1)   Up
2021.06.02 18:34:09.479 Test (Volatility 10 Index,M1)   Dn

完整的代码。

//+------------------------------------------------------------------+
//|                                                    test.mq5 |
//|                                  Copyright 2021, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window

#property indicator_buffers 2
#property indicator_plots   2

#property indicator_label1  "Signal UP"
#property indicator_type1   DRAW_ARROW
#property indicator_color1  clrLime
#property indicator_style1  STYLE_SOLID
#property indicator_width1  2

#property indicator_label2  "Signal DN"
#property indicator_type2   DRAW_ARROW
#property indicator_color2  clrRed
#property indicator_style2  STYLE_SOLID
#property indicator_width2  2

double up[];
double dn[];

datetime fin=0, last=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
    IndicatorSetString(INDICATOR_SHORTNAME, "Prototype");
    
   SetIndexBuffer(0,up,INDICATOR_DATA);
   PlotIndexSetInteger(0,PLOT_ARROW,233);
    
   SetIndexBuffer(1,dn,INDICATOR_DATA);
   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[])
   {
   
   ArraySetAsSeries(open,true);
   ArraySetAsSeries(high,true);
   ArraySetAsSeries(low,true);
   ArraySetAsSeries(close,true);
   ArraySetAsSeries(time,true);   
 
   fin=iTime(Symbol(), PERIOD_M1 ,0);
   if(last==fin) return(rates_total);
   last=fin;
   
   if(rates_total - prev_calculated == 1)
      {
         if(open[1] > close[1])
         {
           Print("Dn");
         }
    else if(open[1] < close[1])
         {
           Print("Up");
         }
     }

return(rates_total);
}
 
Taras Slobodyanik:

什么信息?
,我从一开始只写了prev_calculated和rate_total。

对此,我得到了你的答复。

所以你就是那个骗子)


是的,我没有删除它,我只是没有马上找到那个帖子。

关于交易、自动交易系统和交易策略测试的论坛。

新手对MQL4和MQL5的任何问题,对算法和代码的帮助和讨论

Taras Slobodyanik, 2021.06.02 16:47

因为没有括号。

if(rates_total - prev_calculated == 1)
   {
   //Print("Новый бар");
   if(open[1] > close[1])
        {
        Print("Dn");
        }
   else if(open[1] < close[1])
        {
        Print("Up");
        }
   }

但是!还在收回你的话,你是谁?
 
于是就有了
   ArraySetAsSeries(open,true);
   ArraySetAsSeries(high,true);
   ArraySetAsSeries(low,true);
   ArraySetAsSeries(close,true);
   ArraySetAsSeries(time,true);   
 

   if(rates_total - prev_calculated == 1)
      {
         if(open[1] > close[1])
         {
           Print("Dn");
         }
    else if(open[1] < close[1])
         {
           Print("Up");
         }
     }
 
谢谢你的帮助 :)
 
Alexey Viktorov:

是的,我没有删除它,我只是没有立即找到它。

但是!还在收回我的话,你是谁?
Alexey Viktorov:

如此明目张胆地撒谎是不礼貌的。你删除你的帖子,把你的文盲归咎于别人。骗子。

所以我是个骗子,因为我没有 删除我的帖子,并 我的文盲归咎于 别人,原创)))。


我再说一遍。

Taras Slobodyanik:

我并不建议你阅读左边的条形封闭,那不是我的代码)

只有我的

if(rates_total - prev_calculated == 1)
 
m-r LSV:
谢谢你的帮助 :)

请)。

 
再分享一些。唯一的条件是,你们都使用GoPro--为了这个故事。
 
Artyom Trishkin:
再分享一些。唯一的条件是,你们都使用GoPro--为了这个故事。

这是一些 "聪明人 "的策略,把灰尘吹到他们的眼睛里,当他们失败时,指责他们所有的罪过,掩盖他们的文盲和无能,让对手证明他不是一个傻瓜。

 
Taras Slobodyanik:

这是一些 "聪明人 "的策略,把灰尘吹到他们的眼睛里,当他们失败时,指责他们所有的罪过,以掩盖他们的文盲和无能,让他们的对手证明他不傻。

塔拉西克,滚开......白痴。看看你的提示后生成的代码......这叫做 "教人如何不做",任何人不理解都是他自己的错。

原因: