"Teach" the EA !!! [it made the number of trades (not orders) I wanted during the interval I specified ]

 
Good day!!! Tell me, Mr. programmers, is it possible to "teach" the Expert Advisor to make a certain number of trades?
 
BeerGod:
over a certain amount of time or the total number of open positions at the same time ?

The time interval has already been defined in it. I need it to make the required number of trades (not orders) within the time interval I have specified
 
sergeev:

Please repeat the question in an extended statement.


For example, if my EA opens an order, a certain amount of time will pass and all the orders will be closed (there is a result). If the EA opens an order again, a certain amount of time will pass and the order will be closed (we have got the result). And the EA does not open any more, i.e., it disconnects. And as I said earlier, the time frame in the EA is adjustable, which means that you can set the number of deals within the time frame. In Expert Advisor settings, in the options window, you should see an additional option, where you can set the number of deals (do not confuse with the number of open orders).
 

The easiest and most straightforward way is to look at the entire order history and count how many orders are made in a given time interval. This would be slow to test, if done, it should be done just before the order is opened (after all the opening checks), so as not to run through the history unnecessarily.

 
Rapitvina:

The time interval is already set in it. I need it to perform the required number of deals (not orders) within the time frame I have specified.
It should not exceed the required number (easy to do) - or not less than the required number (then we have problems with entry conditions)?
 
Rich:
Should there be no more than the required number (easy to do) - or no less than the required number (then the conditions for entry are unclear)?

What is not clear? The input conditions are defined by the time interval.....
 
Rapitvina:

He has to commit as much as I want him to.

:) Can he do it?
 
Integer:

:) Can he do it?

Yes, he can. He does it every day, you just have to press the ON/OFF button yourself.
 
Rapitvina:

It will. It does this every day just has to press the ON/OFF button itself.


Here's Yi Kim's function

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 19.02.2008                                                     |
//|  Описание : Возвращает количество секунд после открытия последней позиций. |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (""   - любой символ,                   |
//|                                     NULL - текущий символ)                 |
//|    op - операция                   (-1   - любая позиция)                  |
//|    mn - MagicNumber                (-1   - любой магик)                    |
//+----------------------------------------------------------------------------+
datetime SecondsAfterOpenLastPos(string sy="", int op=-1, int mn=-1) {
  datetime t;
  int      i, k=OrdersTotal();

  if (sy=="0") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      if (OrderSymbol()==sy || sy=="") {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (op<0 || OrderType()==op) {
            if (mn<0 || OrderMagicNumber()==mn) {
              if (t<OrderOpenTime()) t=OrderOpenTime();
            }
          }
        }
      }
    }
  }
  return(TimeCurrent()-t);
}

Calling from an advisor.

If(SecondsAfterOpenLastPos()>300) //300- 5 минут,600- 10 минут И.Т.Д
set the time you want........., no, not that one?

 
r772ra:
put the right time ........., no, not that one?


no, you need a function that counts the number of orders over a given time range.
 
sergeev:

no, you need a function that counts the number of orders over a specified time range.

No, it does not need to count orders in the terminal field all orders are closed.
Reason: