[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 568

 
Catrock >>:

Скажите пожалуйста, как реализовать условие.-

If( есть отложенные ордера) то делаем то и то ;

 for(int i=0; i<OrdersTotal();i++)
  {
  OrderSelect(i,SELECT_BY_POS);
  if(OrderType()==2||3||4||5) // Есть ли отложники?
   {
   // Действия
   }
  }
 

Thank you) But it did not solve the situation.

Here is the situation: I had a pending order of type 5(Sell Stop) and then the price reached it and it became a market order. Has the order type changed? I.e. has 5 changed in its properties?

When I insert the above mentioned combination, the "Actions" still change the characteristics of the open order but they should not. That is why I would like to make it a condition so that the actions are applied only to pending orders.

         if(OrdersTotal())                                              // Если стоят ордера в списке
         {
             OrderSelect(0, SELECT_BY_POS);                             // Выбираем первый
             if(OrderType()==(2||3||4||5))                              // Если он не открытый то можем модифицировать
             {
               Alert("Что то делаю с ордером =)");
               if (PricePointNew>PricePointOld)
               OrderModify( Ticket, PricePointNew-5*0.0001, PriсeStopNew+8*0.0001 , PricePointNew-Profit*0.0001 ,0 ,Green);
                else Print("OrderModify 1 вернул ошибку - ",GetLastError());
            
               if (PricePointNew<PricePointOld)
               OrderModify( Ticket, PricePointNew-5*0.0001, PriсeStopNew+8*0.0001 , PricePointNew-Profit*0.0001 ,0 ,Green);
               else Print("OrderModify 2 вернул ошибку - ",GetLastError());
            
               if(PriсeStopNew>PriсeStopOld && (PriсeStopNew-PriсeStopNew)<(Stop*0.0001))
               OrderModify( Ticket, PricePointNew-5*0.0001, PriсeStopNew+8*0.0001 , PricePointNew-Profit*0.0001 ,0 ,Green);
               else Print("OrderModify 3 вернул ошибку - ",GetLastError());
         
             if(PriсeStopNew<PriсeStopOld)
             OrderModify( Ticket, PricePointNew-5*0.0001, PriсeStopNew+8*0.0001 , PricePointNew-Profit*0.0001 ,0 ,Green);
             else Print("OrderModify 4 вернул ошибку - ",GetLastError());         
            }
         }
         else                               // Если нет ордеров, то ставим
         {
            f = OrderSend(Symbol(), 5, 0.01,(PricePointNew-5*Point*10) , 1,(PriсeStopNew+8*Point*10) ,(PricePointNew-Profit*Point*10));
            OrderSelect( 0, SELECT_BY_POS);
            Ticket =  OrderTicket();
 
if the sellstop is executed, it becomes type 1 and ceases to be a pending order and becomes a market order.
 

Can't figure it out.

I put the time in the array, but the printer prints 0 =(

for (i=0; i<=10; i++)
   {
     datetime Array[i] = iTime(NULL,0,i);
     Print("Время: ",Array[i]);
   }
Print outputs zeros... What's wrong?
 
Then I'm stuck)) When I run Expert Advisor in the tester with visualization, the market order still changes, I don't understand why... I made a big code, apparently there is an algorithmic error somewhere.
 
Noterday >>:

Не могу понять

Загоняю в массив время, а принтом выводится 0 =(

Принт выводит нули... Что не так?

the array must be declared outside the loop and the size must be fixed (or an indication that it is an indicator array)

datetime Array[10];
int start() 
{
for (int i=0; i<=10; i++)
   {
     Array[i] = iTime(NULL,0,i);
     Print("Время: ",Array[i]);
   }


}
 
Catrock >>:
Тогда я застрял)) Запускаю эксперт в тестере с визуализацией, рыночный ордер все равно меняется, непонятно почему.. Нагородил большой код, видимо ошибка где то алгоритмическая.
what exactly is changing in the market order? Be clearer about what you want to achieve.
 
Techno >>:

массив надо объявлять вне цикла и размер должен быть фиксированный(либо указание что речь о индикаторном массиве)

still not working.... How does iTime write the time to an array? In seconds from 1970 or "yyyyy:mm:dd hh:mm"
 
Noterday >>:
всё равно не работает.... как iTime записывает время в массив? В секундах о 1970 или "yyyy:mm:dd hh:mm"
with this design, yes, in seconds. It all works for me. Compile and check just this part of the code.
 

In a market order at this point, the take profit and stop loss levels change. They should not.

Only pending orders can be changed in my system. If the order becomes a market order, the changes are not allowed. The Expert Advisor uses one order in total.

Reason: