В чем может быть проблема?

Здравствуйте.
Модифицировал индикатор Андрея (@AM2)
Код дописал, но не получается вывести комментарии на экран.
Индикатор подсчета свечей за определенный срок. Вот сам файл модифицированный:

svechi.mq4 (11 Kb)

Комментарий ошибки:
'Comment' - wrong parameters count	svechi.mq4	529	4


Хотел сделать в двух столбцах:



Так же выдает ошибку компиляции…
F1 перечитал, там о таком вообще ни слова(((

Подскажите пожалуйста знающие.
В чем ошибка…
  • +4
  • Просмотров: 1360
  • 27 июня 2020, 15:45
  • maksGruv
Понравилcя материал? Не забудьте поставить плюс и поделиться в социальной сети!

  Предыдущая запись в моем блоге
Стрелочный индикатор RSI
19 июня 2020

Комментарии (14)

+
0
1. Уберите запятую после последнего аргумента
avatar

  8  Kudryashov Сообщений: 129

  • 27 июня 2020, 20:06
+
0
2. Функция Comment поддерживает всего 64 аргумента, у вас на вид их больше
avatar

  8  Kudryashov Сообщений: 129

  • 27 июня 2020, 20:07
+
0
к примеру 64 аргумента. у меня меньше, 24 параметра по две строки 48 строк кода.
avatar

  9  maksGruv Автор Сообщений: 340

  • 28 июня 2020, 10:57
+
0
Проблема была в запятой.
avatar

  8  Kudryashov Сообщений: 129

  • 28 июня 2020, 19:06
+
0
3. Это уже отсибятина*spam*  но зачем столько одинакового кода? Чем не нравиться 1 функция с разными входящими параметрами?*spam* 
avatar

  8  Kudryashov Сообщений: 129

  • 27 июня 2020, 21:03
+
0
Разница в том что индикатор считает количество свечей за месяц(22 дня). если каждый час просматривать и по каждой паре. Это огромное количество времени.
avatar

  9  maksGruv Автор Сообщений: 340

  • 28 июня 2020, 10:55
+
0
Я к тому что повторяющиеся операции удобнее записать в одной функцией и тогда вместо 569 строк вашего кода будет 141 строки выполняющих одно и тоже.
avatar

  8  Kudryashov Сообщений: 129

  • 28 июня 2020, 19:11
+
0

#property copyright "Copyright 2020, AM2"
#property link      "http://www.forexsystems.biz"
#property version   "1.00"
#property strict
#property indicator_chart_window
input int days=22;
input int hour0=0;
input int hour1=1;
input int hour2=2;
input int hour3=3;
input int hour4=4;
input int hour5=5;
input int hour6=6;
input int hour7=7;
input int hour8=8;
input int hour9=9;
input int hour10=10;
input int hour11=11;
input int hour12=12;
input int hour13=13;
input int hour14=14;
input int hour15=15;
input int hour16=16;
input int hour17=17;
input int hour18=18;
input int hour19=19;
input int hour20=20;
input int hour21=21;
input int hour22=22;
input int hour23=23;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
Comment("");
}
//+------------------------------------------------------------------+
//| 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[])
{
string symbol = Symbol();
string text_comment = "";
text_comment += "Bulls 00: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour0,time,open,close)) + "\n";
text_comment += "Bears 00: " + StringConcatenate(CountBarsType(symbol,"Bears",hour0,time,open,close)) + "\n";
text_comment += "Bulls 01: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour1,time,open,close)) + "\n";
text_comment += "Bears 01: " + StringConcatenate(CountBarsType(symbol,"Bears",hour1,time,open,close)) + "\n";
text_comment += "Bulls 02: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour2,time,open,close)) + "\n";
text_comment += "Bears 02: " + StringConcatenate(CountBarsType(symbol,"Bears",hour2,time,open,close)) + "\n";
text_comment += "Bulls 03: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour3,time,open,close)) + "\n";
text_comment += "Bears 03: " + StringConcatenate(CountBarsType(symbol,"Bears",hour3,time,open,close)) + "\n";
text_comment += "Bulls 04: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour4,time,open,close)) + "\n";
text_comment += "Bears 04: " + StringConcatenate(CountBarsType(symbol,"Bears",hour4,time,open,close)) + "\n";
text_comment += "Bulls 05: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour5,time,open,close)) + "\n";
text_comment += "Bears 05: " + StringConcatenate(CountBarsType(symbol,"Bears",hour5,time,open,close)) + "\n";
text_comment += "Bulls 06: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour6,time,open,close)) + "\n";
text_comment += "Bears 06: " + StringConcatenate(CountBarsType(symbol,"Bears",hour6,time,open,close)) + "\n";
text_comment += "Bulls 07: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour7,time,open,close)) + "\n";
text_comment += "Bears 07: " + StringConcatenate(CountBarsType(symbol,"Bears",hour7,time,open,close)) + "\n";
text_comment += "Bulls 08: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour8,time,open,close)) + "\n";
text_comment += "Bears 08: " + StringConcatenate(CountBarsType(symbol,"Bears",hour8,time,open,close)) + "\n";
text_comment += "Bulls 09: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour9,time,open,close)) + "\n";
text_comment += "Bears 09: " + StringConcatenate(CountBarsType(symbol,"Bears",hour9,time,open,close)) + "\n";
text_comment += "Bulls 10: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour10,time,open,close)) + "\n";
text_comment += "Bears 10: " + StringConcatenate(CountBarsType(symbol,"Bears",hour10,time,open,close)) + "\n";
text_comment += "Bulls 11: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour11,time,open,close)) + "\n";
text_comment += "Bears 11: " + StringConcatenate(CountBarsType(symbol,"Bears",hour11,time,open,close)) + "\n";
text_comment += "Bulls 12: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour12,time,open,close)) + "\n";
text_comment += "Bears 12: " + StringConcatenate(CountBarsType(symbol,"Bears",hour12,time,open,close)) + "\n";
text_comment += "Bulls 13: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour13,time,open,close)) + "\n";
text_comment += "Bears 13: " + StringConcatenate(CountBarsType(symbol,"Bears",hour13,time,open,close)) + "\n";
text_comment += "Bulls 14: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour14,time,open,close)) + "\n";
text_comment += "Bears 14: " + StringConcatenate(CountBarsType(symbol,"Bears",hour14,time,open,close)) + "\n";
text_comment += "Bulls 15: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour15,time,open,close)) + "\n";
text_comment += "Bears 15: " + StringConcatenate(CountBarsType(symbol,"Bears",hour15,time,open,close)) + "\n";
text_comment += "Bulls 16: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour16,time,open,close)) + "\n";
text_comment += "Bears 16: " + StringConcatenate(CountBarsType(symbol,"Bears",hour16,time,open,close)) + "\n";
text_comment += "Bulls 17: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour17,time,open,close)) + "\n";
text_comment += "Bears 17: " + StringConcatenate(CountBarsType(symbol,"Bears",hour17,time,open,close)) + "\n";
text_comment += "Bulls 18: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour18,time,open,close)) + "\n";
text_comment += "Bears 18: " + StringConcatenate(CountBarsType(symbol,"Bears",hour18,time,open,close)) + "\n";
text_comment += "Bulls 19: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour19,time,open,close)) + "\n";
text_comment += "Bears 19: " + StringConcatenate(CountBarsType(symbol,"Bears",hour19,time,open,close)) + "\n";
text_comment += "Bulls 20: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour20,time,open,close)) + "\n";
text_comment += "Bears 20: " + StringConcatenate(CountBarsType(symbol,"Bears",hour20,time,open,close)) + "\n";
text_comment += "Bulls 21: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour21,time,open,close)) + "\n";
text_comment += "Bears 21: " + StringConcatenate(CountBarsType(symbol,"Bears",hour21,time,open,close)) + "\n";
text_comment += "Bulls 22: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour22,time,open,close)) + "\n";
text_comment += "Bears 22: " + StringConcatenate(CountBarsType(symbol,"Bears",hour22,time,open,close)) + "\n";
text_comment += "Bulls 23: " + StringConcatenate(CountBarsType(symbol,"Bulls",hour23,time,open,close)) + "\n";
text_comment += "Bears 23: " + StringConcatenate(CountBarsType(symbol,"Bears",hour23,time,open,close)) + "\n";
Comment(text_comment);
return(rates_total);
}
//+------------------------------------------------------------------+
int CountBarsType(string symbol,string bar_type,datetime hour,const datetime &time[],const double &open[],const double &close[])
{
int bulls=0, bears=0;
int bars=iBarShift(NULL,0,iTime(NULL,PERIOD_D1,days));
int result = 0;
for(int index = 0; index < bars; index++)
   {
   if(TimeHour(time[index]) == hour)
      {
      if(close[index]-open[index]>0)
         {
         bulls++;
         }

      if(close[index]-open[index]<0)
         {
         bears++;
         }
      }
   }
if (bar_type == "Bulls") return(bulls);
if (bar_type == "Bears") return(bears);
return(EMPTY);
}

Редактирован: 28 июня 2020, 19:13
avatar

  8  Kudryashov Сообщений: 129

  • 28 июня 2020, 19:11
+
0
Воооо, спасибо большое) Я искал пример как правильно его описать и скомпоновать.
Я только учусь, пытаюсь читать чужой код и понимать. на чужом примере больше ясности становится)
Самому трудно обучатся…
avatar

  9  maksGruv Автор Сообщений: 340

  • 29 июня 2020, 15:42
+
0
:D 
У меня также… Если бы ещё и комментарии были*uptrend* 
avatar

  8  Kudryashov Сообщений: 129

  • 30 июня 2020, 08:53
+
+1
С этим согласен) было бы вообще шикарно) можно было бы составить свой мануал по языку mql))
avatar

  9  maksGruv Автор Сообщений: 340

  • 1 июля 2020, 13:25
+
0
Причина в том, что Вы неправильно используете функцию Comment, вернее формат написания содержимого.
Вот так будет правильно:

   Comment("\n Bulls_00  = "+IntegerToString(bulls)
          +"\n Bears_00 = "+IntegerToString(bears)
          +"\n Bulls_1  = "+IntegerToString(bulls1)
          +"\n Bears_1  = "+IntegerToString(bears1)
          +"\n Bulls_2  = "+IntegerToString(bulls2)
          +"\n Bears_2  = "+IntegerToString(bears2)
          +"\n Bulls_3  = "+IntegerToString(bulls3)
          +"\n Bears_3  = "+IntegerToString(bears3)
          +"\n Bulls_4  = "+IntegerToString(bulls4)
          +"\n Bears_4  = "+IntegerToString(bears4)
          +"\n Bulls_5  = "+IntegerToString(bulls5)
          +"\n Bears_5  = "+IntegerToString(bears5)
          +"\n Bulls_6  = "+IntegerToString(bulls6)
          +"\n Bears_6  = "+IntegerToString(bears6)
          +"\n Bulls_7  = "+IntegerToString(bulls7)
          +"\n Bears_7  = "+IntegerToString(bears7)
          +"\n Bulls_8  = "+IntegerToString(bulls8)
          +"\n Bears_8  = "+IntegerToString(bears8)
          +"\n Bulls_9  = "+IntegerToString(bulls9)
          +"\n Bears_9  = "+IntegerToString(bears9)
          +"\n Bulls_10 = "+IntegerToString(bulls10)
          +"\n Bears_10 = "+IntegerToString(bears10)
          +"\n Bulls_11 = "+IntegerToString(bulls11)
          +"\n Bears_11 = "+IntegerToString(bears11));
avatar

  18  Andrju81 Сообщений: 245 - Андрей

  • 27 июня 2020, 22:04
+
0
Или так в два столбика:

   Comment("\n Bulls_00  = "+IntegerToString(bulls)+"  Bulls_6  = "+IntegerToString(bulls6)
          +"\n Bears_00 = "+IntegerToString(bears)+"   Bears_6  = "+IntegerToString(bears6)
          +"\n Bulls_1  = "+IntegerToString(bulls1)+"     Bulls_7  = "+IntegerToString(bulls7)
          +"\n Bears_1  = "+IntegerToString(bears1)+"  Bears_7  = "+IntegerToString(bears7)
          +"\n Bulls_2  = "+IntegerToString(bulls2)+"   Bulls_8  = "+IntegerToString(bulls8)
          +"\n Bears_2  = "+IntegerToString(bears2)+"  Bears_8  = "+IntegerToString(bears8)
          +"\n Bulls_3  = "+IntegerToString(bulls3)+"     Bulls_9  = "+IntegerToString(bulls9)
          +"\n Bears_3  = "+IntegerToString(bears3)+"  Bears_9  = "+IntegerToString(bears9)
          +"\n Bulls_4  = "+IntegerToString(bulls4)+"   Bulls_10 = "+IntegerToString(bulls10)
          +"\n Bears_4  = "+IntegerToString(bears4)+"  Bears_10 = "+IntegerToString(bears10)
          +"\n Bulls_5  = "+IntegerToString(bulls5)+"   Bulls_11 = "+IntegerToString(bulls11)
          +"\n Bears_5  = "+IntegerToString(bears5)+"  Bears_11 = "+IntegerToString(bears11));
avatar

  18  Andrju81 Сообщений: 245 - Андрей

  • 27 июня 2020, 22:20
+
0
Можно так
Comment("\n Bulls_00  = "+IntegerToString(bulls)+"  Bears_00  = "+IntegerToString(bears)
          +"\n Bulls_1 = "+IntegerToString(bulls1)+"   Bears_1  = "+IntegerToString(bears1)
avatar

  16  ssg Сообщений: 817

  • 28 июня 2020, 04:41

Зарегистрируйтесь или авторизуйтесь, чтобы оставить комментарий
Начать торговлю с Альпари