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

 
alexhammer:
But if nothing happens on the first tick due to some circumstances, it will lose all the others. Is there an option so that it makes calculations up to a certain point and then goes into wait mode for the next candle?
 

alexhammer:

I don't think dzhini wanted exactly what you are suggesting. You are proposing to work on opening prices, while he wants to work on ticks, but not more than one trade within one bar.

 
dzhini:
But if nothing happens on the first tick due to some circumstances, it will lose all the others. Is there such a way to make it perform calculations up to a certain point and then wait for the next candle?

You have to use the KimIV function to do this, and I suggest you think about how to use it and decide for yourself.

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

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

The KimIV function should be used for this, and I suggest you think about how to use it.

uhhhhhhhhhhhhhhh, we'll figure it out ))) thank you
 
khorosh:

You need to use the KimIV function to do this, and I suggest you think about it and decide for yourself.

Cool... it's working. THANK YOU!!!
 
alexhammer:

Missing the third option ( in time)
 
VINAR:

Missing the third option ( in time)
please, a studio :)))
 

What can cause this problem?

I copy all code (copy-paste) of a working EA from one file to a new EA window (another file) and it stops working? same situation in save as mode

 

hello all

I am new to mts programming

I have a good Expert Advisor that makes 14 000 deposits

after that it starts to lose

I changed the maximum drawdown parameter to 14 000 and it does not lose 22 000

Thanks in advance

 
evgenii_7:

hello all

I am new to mts programming

I have a good Expert Advisor that makes 14 000 deposits

after that it starts to lose

I changed the maximum drawdown parameter to 14 000 and it does not lose 22 000

Thanks in advance


without timely optimisation of input parameters everything pours out sooner or later... for there is nothing "eternal" but true values... :-))) the market changes from time to time...

Reason: