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

 
Serg-s-n писал(а) >>
Good evening all! Who knows how to close an order and select the very first order and close it?

PLEASE HELP!!!

Find a position with a minimum opening time.

 
Serg-s-n писал(а) >>
Good evening all! Who knows how to select the first order and close it when closing an order?

PLEASE HELP!!!

As correctly said, you need to find the order with the earliest open time, get its ticket, select the order with that ticket, and close it.

Here is an example of how to find the order you need:

  int ticket = -1;
  datetime MinDateTime = 0;

  for (int i=1; i<=OrdersTotal(); i++)         // Цикл по всем ордерам
  
    if (OrderSelect( i-1, SELECT_BY_POS)==true)  // Если есть следующий        
    {
      if ( ticket < 0 || OrderOpenTime() < MinDateTime ) // Его дата меньше, чем дата предыдущего найденного?
      {
        if ( OrderType() == OP_BUY )          // Это ордер на покупку?
        {
          ticket = OrderTicket();             // Запомнить его ticket.
          MinDateTime = OrderOpenTime();
        }
      }
    }     
  }                                           // Конец тела цикла

Once the ticket of the order you need is found, you need to select it with the OrderSelect(ticket, SELECT_BY_TICKET) function, and close OrderClose() with the parameters you need.

 
We have an EA which opens positions with TP and SL. How do I calculate how many SL positions have currently been lost in a row since the last successful order?
 

1. OrdersHistoryTotal

2. Sort the closed orders by time

3. determine the last orders in a row OrderProfit<0

 
sergeev >>:

1. OrdersHistoryTotal

2. Сортируем закрытые ордера по времени

3. Определяем у последних подряд идущие OrderProfit<0


Thank you
 

Good afternoon.

Please solve the problem. When I call the MarketInfo("EURUSD", MODE_STOPLEVEL) function - minimum allowed stop loss/stake profit level in pips, it shows 10 pips.

different numbers are shown in the terminal, for example sl=30, tp=10. What should I do, how can I separate them in a function call?

 
gvi2504 писал(а) >>

Good afternoon.

Please solve the problem. When I call the MarketInfo("EURUSD", MODE_STOPLEVEL) function - minimum allowed stop loss/stake profit level in pips, it shows 10 pips.

different numbers are shown in the terminal, for example sl=30, tp=10. What should I do? How do I separate them in a function call?

When you set the minimum stop for SL and TP it will show different values.)

 
Techno >>:

Уровень минимальных стопов для SL и TP один и тот же, не может она тебе показывать разных значений, иначе дц втопку )

I thought so too, but in MasterForex, SL and TP are different. Any other thoughts on the subject?

 
gvi2504 писал(а) >>

I thought so too, but in MasterForex, SL and TP are different. Any other thoughts on the subject?

how do you know they are different?

 
Techno >>:

а как ты определил, что разные?

When I was looking for an error every action was overAlagged, and it turned out TP passes when modifying, but SL is not too close.