Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 635

 

Some advice for a newbie, please!

My task is to create a sub-window (sub-windows) from an Expert Advisor in the chart window to which it is attached.

I've looked through everything, but haven't found how to do it. You can create/edit objects

subwindows that have already been created by other indicators, but they don't have what I need...

How do I get out of this situation?

 
boroda4:

A tip for a newbie, please!

My task is to create a sub-window (sub-windows) from an Expert Advisor in the chart window to which it is attached.

I've looked through everything, but haven't found how to do it. You can create/edit objects

subwindows that have already been created by other indicators, but I don't have what I need...

How do I get out of this situation?


Have a look at the article, maybe you will find something
 
Vinin:

Only a loop will help you. Go through and count.

Can you tell me how to calculate the number of filled cells in an array?

The array contains trendline prices, relative to the current bar.

 sch=ObjectsTotal(OBJ_TREND);//количество трендовы линий
for(int s=0;s<sch;s++) 
 {
 
// ArraySort(masS,WHOLE_ARRAY,0,MODE_DESCEND);
// ArraySort(masB,WHOLE_ARRAY,0,MODE_DESCEND);
  
   DWnem=ObjectName(s); //Текущее имя объекта
   DW="downtrendline"+IntegerToString(s);//Для фильтрации запроса
   DW2="uptrendline"+IntegerToString(s);//
  if(DWnem="")//если объекта уже нет, то обнуляем ячейку массива
   {
   masS[s]=0;
   masB[s]=0;
   }
 if(DWnem=DW)//если имя совпадает с фильтром, то запоминаем в массив
{
  if(ObjectGet(DWnem,OBJPROP_COLOR)==Goldenrod) { 
   masS[s]=ObjectGetValueByShift(DWnem,1);}
  if(ObjectGet(DWnem,OBJPROP_COLOR)==Gainsboro) { 
   masS[s]=ObjectGetValueByShift(DWnem,1);}
  if(ObjectGet(DWnem,OBJPROP_COLOR)==White) { 
   masS[s]=ObjectGetValueByShift(DWnem,1);}
}   
for(int a=0;a<20;a++)// ну а тут счетчик, чтоб посчитать сколько ячеек записано в масив { if(mas[a]>0) sch++; } Как остановить счетчик?

I can't figure it out.

I can't figure it out for the life of me and that's it, please help!!!

 

Can you please tell me how to get the TerminalTester's termination signal in the terminal?

int start()
   {
    //---------------------------------- Из Терминала запустим ТерминалТестер -------------------------
    Start   = ShellExecuteW(0, "Open", "terminal.exe", "D:\\Alpari_Terminal_Tester\\tester\\optimise.ini", "D:\\Alpari_Terminal_Tester", 3);
    while(STOP)
        {
         //------ Функция запроса проверки состояния ТерминалТестера ------
         // STOP=?????????????????????????????????????????????????;
         Sleep(1000);
        }
    return(0);
   }
 
Top2n:

Can you tell me how to calculate the number of filled cells in an array?

The array contains trendline prices, relative to the current bar.

I can't figure it out.

I can't figure it out and that's it, please help!!!

Try it like this:

int limit = ...; //до какого числа нужно
MathMin(sch++,limit); //если это будет работать, не пробовал

Maybe it will work. Good luck!

 
Top2n:

Can you tell me how to calculate the number of filled cells in an array?

The array contains trendline prices, relative to the current bar.

I can't figure it out.

I can't figure it out for the life of me and that's it, help please!!!


Probably need to null the counter in time, so it does not wind more, and counted again from scratch?

Kilometre functions are not good, it's better to put complete pieces of actions in separate functions, even if some of them are called only once. And it's better to call these separate functions from the main function.

This counting will do?

#property strict

/******************************************************************************/
uint getFilledCellsNumber(double &array[]) { // Массив принимается по ссылке, то есть, НЕ копируется
  uint cnt = 0;

  for (int i = 0, limit = ArraySize(array); i < limit; i++) {
    if (array[i] > 0) {
      cnt++;
    }
  }

  return cnt;
}

/******************************************************************************/
void OnStart() {
  double a[] = {0, 1.2, 1.3, 0, 1.1};
  uint filledCellsNumber = getFilledCellsNumber(a); // Массив передаётся по ссылке, то есть, НЕ копируется

  Print("Number of filled cells: ", filledCellsNumber);
}

When I start it up, I get the following:

00:24:46 Script 1 EURUSDm,H1: loaded successfully
00:24:46 1 EURUSDm,H1: initialized
00:24:46 1 EURUSDm,H1: Number of filled cells: 3
00:24:46 1 EURUSDm,H1: uninit reason 0
00:24:46 Script 1 EURUSDm,H1: removed

Seems to count right.

 

Hello.

When compiling a program written in 2012, a warning appears:

possible loss of data due to type conversion FinBuy1531.mq4 144 7

What does it mean and how can I avoid it?

P.S. The program is running normally in the tester.

 
simpleton:

Perhaps the counter should be zeroed out in time so that it does not add more and counts again from scratch?

Kilometric functions are not good, complete chunks of actions are better placed in separate functions, even if some of them are only called once. And from the main function call those separate ones.

Will this counting work?

When I start it up, I get the following:

Seems to count correctly.


OOO thank you very much!!!)) It works great in general.

Thank you all for your help!)

 
Shurkin:

Hello.

When compiling a program written in 2012, a warning appears:

possible loss of data due to type conversion FinBuy1531.mq4 144 7

What does it mean and how can I avoid it?

P.S. The program is running normally in the tester.

You need to correctly perform the Type conversion in the code.
 

Code line:

int Dgt=MarketInfo(Symbol(),MODE_DIGITS);

Warning:

possible loss of data due to type conversion FinBuy1531.mq4 144 7

I think the types correspond to each other. What is wrong here?

Reason: