Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 595

 
realgentleman:

The Debugger has stopped working - why?

Since the middle of the day on 5 May, the Debugger has stopped giving out variable values at the breakpoint. In all programs for all variables. At the same time, the programs themselves work as before. At that time (and until now) Editor was "ver. 5.00 build 934" and MetaTrader "ver. 4.00 build 646" .

Here is a simple script, and this is what the Debugger shows. Can you please tell me what's wrong?

Here
 

How can I find out the commission and swap on a symbol in $ before opening a position?

 
Hello..... Once upon a time I found a library on the forum with all possible types of trawls ... now I can't find it, I dug through a bunch of links and can't find it, can anyone give me a link to it or the library itself
 
Zver4991:
Hello..... Once upon a time I found a library on the forum with all possible types of trawls ... now I can't find it, I dug through a lot of links and can't find it
https://www.mql5.com/ru/code/7108
 
exactly exactly what I was looking for ...thank you very much
 

the question is quite old and has been asked 100 per cent before but again the function doesn't fucking work and I can't remember why....

void OnTick()
  {
//---
   if(IsNewBar()==true)
     {

     if(TimeHour(TimeCurrent()) >= StartHour && TimeHour(TimeCurrent()) <= EndHour)
     {
          if(ExistPositions(NULL,-1,0,-1)==false)
{
OpenPosition(Symbol(),OP_SELL,0.1,Bid+sl*Point,Bid-tp*Point);
OpenPosition(Symbol(),OP_BUY,0.1,Ask-sl*Point,Ask+tp*Point);
}
}
   }  
  }
должны просто открываться два ордера при условии что нету открытых ордеров и в определенное время 
функции брал из ветки кима
пробовал магик добавлять все равно не работает
тупо игнорируется функция на проверку открытых ордеров
и открываются позиции на каждом баре
 
Zver4991:

the question is quite old and has been asked 100 per cent before but again the function doesn't fucking work and I can't remember why....

And why do you think "stupidly ignored..." maybe it works so well that it always returns false. That is, it just doesn't see open orders or worse... that's the way it's designed :)))
 
AlexeyVik:
Why do you think "stupidly ignored..." might work so well that it always returns false. That is, it just doesn't see open orders or worse... that's the way it's designed :)))


it's a function taken from a branch
/*Предназначена для проверки наличия открытых покупок или продаж. Аналогична функции ExistOrders. По умолчанию осматривает все позиции: текущего и других инструментов. Конкретизировать отбор можно комбинацией фильтров - параметров функции:

sy - Накладывает ограничение на наименование инструмента. По умолчанию параметр равен "" - отсутствие ограничений, то есть любой инструмент. Если передать NULL, то отбор позиций будет ограничен текущим инструментом.
op - Накладывает ограничение на тип позиции (Buy/Sell). По умолчанию ограничение отсутствует, то есть проверяется наличие позиции любого типа. Допустимые значения параметра -1, OP_BUY и OP_SELL.
mn - Накладывает ограничение на идентификационное ("магическое") число позиции. По умолчанию ограничение отсутствует, то есть проверяется наличие позиции с любым магическим числом.
ot - Накладывает ограничение на время открытия позиции. Проверяется, чтобы позиция была открыта позже значения данного параметра. По умолчанию ограничение отсутствует, то есть проверяется наличие позиции с любым временем открытия.
*/
//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 06.03.2008                                                     |
//|  Описание : Возвращает флаг существования позиций                          |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (""   - любой символ,                   |
//|                                     NULL - текущий символ)                 |
//|    op - операция                   (-1   - любая позиция)                  |
//|    mn - MagicNumber                (-1   - любой магик)                    |
//|    ot - время открытия             ( 0   - любое время открытия)           |
//+----------------------------------------------------------------------------+
bool ExistPositions(string sy="",int op=-1,int mn=-1,datetime ot=0)
  {
   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(ot<=OrderOpenTime()) return(True);
                    }
                 }
              }
           }
        }
     }
   return(False);
  }
хелп плиз если что то не так в ней
 
Zver4991:

is a function taken from the branch
I've never seen a worse code than Kim's, but it's advertised all over the web.

But if you find it hard to write such a check yourself, use what's available... Try it like this.

if(ExistPositions(Symbol(),-1,-1,0)==false)
 
AlexeyVik:
I've never seen a worse code than Kim's, but it's advertised all over the internet.

But if you find it hard to write such a check yourself, use what's available... Try it like this


i can't really say anything has changed. it still opens on every bar between the times i specified.
Reason: