[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 399

 
gross >>:

Здравствуйте, решил занятся изучением MQL4, начал работать с массивами, возник вопрос: при выводе элемента Time[] выходит такое вот значение 1264149780, вместо вида 2006.11.01 14:35 к примеру, или возможно 1264149780 это координата?

read https://docs.mql4.com/ru/convert/TimeToStr

1264149780 is the number of seconds elapsed since 01.01.1970

 
alsu писал(а) >>

look for more logical errors.

SRC is like this:

Found the logical error everything matches.
Now the script looks like this, maybe someone would be interested:
int start()
  {
int Period_CCI=18;
int Period_MA=9;
double MApoCCI;
double ind_CCI, ind_CCI_2;
double Sum_CCI;
for (int k=0; k<5; k++)
  {
      for (int i=1+ k; i< Period_MA+1; i++)
       {
         ind_CCI= iCCI(Symbol(),0, Period_CCI,PRICE_TYPICAL, i);
         Sum_CCI= Sum_CCI+ ind_CCI;
       }
     MApoCCI= Sum_CCI/ Period_MA;
     int n= k+1;
     ind_CCI_2= iCCI(Symbol(),0, Period_CCI,PRICE_TYPICAL, n);
     Alert("MA по СиСиАй "+ k+" = "+ MApoCCI);
     Alert("СиСиАй "+ k+" = "+ ind_CCI_2);
     Sum_CCI=0;
}
//----
   return(0);
  }
 
Vekker писал(а) >>

Do you want a script or an indicator?

As an example of an indicator

Files:
 
Vinin писал(а) >>

Do you want a script or an indicator?

As an example of an indicator

This script will be later in the EA - as a script it was written to check the performance of this piece and the correctness of the numbers it produces for subsequent processing.

>>Thank you for the attached indicator, can you explain what it's about?

 
Vekker писал(а) >>

This script will be later on in the EA - as a script it was written to check the performance of this piece and the correctness of the numbers it produces for subsequent processing.

Thank you for the attached indicator - can you explain - what is it about?

// Build WPR

for (i=limit;i>0;i--) WPR[i]=iWPR(NULL,0,WPR.Period,i);

//first smoothing
for (i=limit;i>0;i--) EMA1[i]=iMAOnArray(WPR,0,EMA.1.Period,0,MODE_EMA,i);

// Second smoothing
for (i=limit;i>0;i--) EMA2[i]=iMAOnArray(EMA1,0,EMA.2.Period,0,MODE_EMA,i);

We should create an indicator that can be later used in the Expert Advisor.

It will be better and faster.

 

Can you please tell me what the problem is? I give two pieces of code that close all trades of the same direction:

for( ii=0; ii<OrdersTotal(); ii++)
      {
        OrderSelect( ii, SELECT_BY_POS, MODE_TRADES);
        
        if(OrderType()==OP_BUY)
          {
            if( closelong==1)
              {
                OrderClose(OrderTicket(),OrderLots(),Bid,20,Blue);
                return(0);
              }
          }
        if(OrderType()==OP_SELL)
          {
            if( closeshort==1)
              {             
                OrderClose(OrderTicket(),OrderLots(),Ask,20,Red);
                return(0);
              }
          }
      }

and the second one:

for( ii=OrdersTotal(); ii>0; ii--)
      {
        OrderSelect( ii, SELECT_BY_POS, MODE_TRADES);
        
        if(OrderType()==OP_BUY)
          {
            if( closelong==1)
              {
                OrderClose(OrderTicket(),OrderLots(),Bid,20,Blue);
                return(0);
              }
          }
        if(OrderType()==OP_SELL)
          {
            if( closeshort==1)
              {             
                OrderClose(OrderTicket(),OrderLots(),Ask,20,Red);
                return(0);
              }
          }
      }

Seems to be the same, only the second should close trades starting with the last, and the first should close starting with the first.

So, the first works correctly, all trades are closed, but the second closes only the very last trade and the rest are not. Why?

 
Azimuth >>:

Подскажите, пожалуйста, в чем тут загвоздка? Даю два куска кода, которые закрывают все сделки одного направления:

и второй:

Вроде бы все тоже самое, только второй должен закрывать сделки, начиная с последней, а первый - начиная с первой.

Так вот, первый работает правильно, все сделки закрываются, а вот второй закрывает только самую последнюю сделку, а остальные - нет. Почему?

Strange use of return, conditions and if nesting can be reduced.

if ((OrderType()==OP_BUY) && ( closelong==1))


And the countdown can OrdersTotal by one.


 
Can you tell me how to make the zigzag in the tester work. I run a script looking for pivot points and it gives results from the real quotes window, it's not the first indicator that does that. How do I fight it.
 
Andrei-1 писал(а) >>
Can you tell me how to make zigzag work in tester. I am running a script looking for pivot points but it shows the results from the window of real quotes, it is not the first indicator that does that. How to fight it.

A zigzag thrown over the graph in visualisation mode looks into the future.

I can give you a zigzag that doesn't look into the future.

 
Let's give it a try. Yes catching savchenkoandrei-ya@yandex.ru or link.
Reason: