Errors, bugs, questions - page 1151

 

Anyone with problems or questions about the affiliate program's conversion accounting - write to me, I'll test it:

    1. Tablet (Windows 8.1)
    2. PC (Windows 8.1)
    3. Smartphone(Android)
 

I have a problem with the StringConcatenate() function in MQL4. A block of zeros appears in the string. This can be seen when outputting the summary string to a file.

void OnStart()
  {
//---
  string sample = "0123456789ABCDEF";
  string s = "";
  for(int i=0;i<260;i++)
  {
   s = StringConcatenate(s, sample);
   Print(StringBufferLen(s), " ", StringLen(s), " ", s);
  } 
  Print(s);
  }

Here is what the terminal writes

2014.06.05 12:28:25.378 String_concat_test EURUSD,Daily: 3872 3872 ???????????????

2014.06.05 12:28:25.378 String_concat_test EURUSD,Daily: 3856 3856 ???????????????

2014.06.05 12:28:25.378 String_concat_test EURUSD,Daily: 3840 3840 ???????????????

2014.06.05 12:28:25.378 String_concat_test EURUSD,Daily: 3824 3824 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123

2014.06.05 12:28:25.378 String_concat_test EURUSD,Daily: 3808 3808 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123

2014.06.05 12:28:25.378 String_concat_test EURUSD,Daily: 3792 3792 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123

 
Zeros mean zero bytes of a few kilobytes
 
Luckhuman:

I have a problem with the StringConcatenate() function in MQL4. A block of zeros appears in the string. This can be seen when outputting the summary string to a file.

Thanks for the post, fixed. The fix will be included in the next build.
 
Please explain why in the Trading tab the current prices (this is the column Price to the right of SL/TP - not to be confused with the open price to the left of SL/TP!) for market positions and pending orders are shown differently for the same instrument, of the same type (for example, buy)? In theory the current price for the symbol should be the same, at least for several open orders it changes synchronously (coincides).
 
marketeer:
Please explain why in the Trading tab the current prices (this is the column Price to the right of SL/TP - not to be confused with the open price to the left of SL/TP!) for market positions and pending orders are shown differently for the same instrument, of the same type (e.g. buy)? The current price in the symbol should be the same, at least for several open orders it changes synchronously (coincides).

Because there is a Bid price and there is an Ask price:

bid_ask

In the picture, there is an open position(sell) and there are two pending orders(sell limit and buy limit). For an open position(sell) the current price Ask is specified. For asell limit the current price Bid is specified. For buy limit the currentAsk price is specified.

 
I have no "Calendar" tab. Terminal MetaTrader 5 x64 build 946 started (MetaQuotes Software Corp.). Demo account on MetaQuotes-Demo server. Besides there are several real accounts in the terminal.

And it is only missing on the laptop. On a tablet and a PC, there is a Calendar tab.


 
When starting MT4 in the indicator, init() fails because MarketInfo(xxx, MODE_TICKVALUE) returns zero (for all symbols). It's clear that the tick value is tied to the account currency, but the terminal displays windows even before the login. Then it turns out that no value-linked script will work properly? Is this a feature or a bug?
 
How do I know if an indicator is placed on the chart by itself or if it is called from another indicator via iCustom?
 
marketeer:
When you start MT4 in the indicator, init() does not take place, because MarketInfo(xxx, MODE_TICKVALUE) returns zero (for all symbols). It's clear that the tick value is tied to the account currency, but the terminal displays windows even before the login. Then it turns out that no value-linked script will work properly? Is this a feature or a bug?

MetaTrader 4. Version: 4.00 Build 654.

Try to use Symbol() instead of xxx and use OnInit() instead of init():

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
//--- превращение динамических массивов в индикаторные буферы
   SetIndexBuffer(0,ExtMapBufferEMA,INDICATOR_DATA);
//--- MarketInfo
   Print("Symbol=",Symbol());
   Print("Минимальная дневная цена=",MarketInfo(Symbol(),MODE_LOW));
   Print("Максимальная дневная цена=",MarketInfo(Symbol(),MODE_HIGH));
   Print("Время поступления последней котировки=",(MarketInfo(Symbol(),MODE_TIME)));
   Print("Последняя поступившая цена предложения=",MarketInfo(Symbol(),MODE_BID));
   Print("Последняя поступившая цена продажи=",MarketInfo(Symbol(),MODE_ASK));
   Print("Размер пункта в валюте котировки=",MarketInfo(Symbol(),MODE_POINT));
   Print("Количество цифр после запятой в цене инструмента=",MarketInfo(Symbol(),MODE_DIGITS));
   Print("Спрэд в пунктах=",MarketInfo(Symbol(),MODE_SPREAD));
   Print("Минимально допустимый уровень стоп-лосса/тейк-профита в пунктах=",MarketInfo(Symbol(),MODE_STOPLEVEL));
   Print("Размер контракта в базовой валюте инструмента=",MarketInfo(Symbol(),MODE_LOTSIZE));
   Print("Размер минимального изменения цены инструмента в валюте депозита=",MarketInfo(Symbol(),MODE_TICKVALUE));
   Print("Минимальный шаг изменения цены инструмента в пунктах=",MarketInfo(Symbol(),MODE_TICKSIZE));
   Print("Размер свопа для ордеров на покупку=",MarketInfo(Symbol(),MODE_SWAPLONG));
   Print("Размер свопа для ордеров на продажу=",MarketInfo(Symbol(),MODE_SWAPSHORT));
   Print("Календарная дата начала торгов (фьючерсы)=",MarketInfo(Symbol(),MODE_STARTING));
   Print("Календарная дата окончания торгов (фьючерсы)=",MarketInfo(Symbol(),MODE_EXPIRATION));
   Print("Разрешение торгов по указанному инструменту=",MarketInfo(Symbol(),MODE_TRADEALLOWED));
   Print("Минимальный размер лота=",MarketInfo(Symbol(),MODE_MINLOT));
   Print("Шаг изменения размера лота=",MarketInfo(Symbol(),MODE_LOTSTEP));
   Print("Максимальный размер лота=",MarketInfo(Symbol(),MODE_MAXLOT));
   Print("Метод вычисления свопов=",MarketInfo(Symbol(),MODE_SWAPTYPE));
   Print("Способ расчета прибыли=",MarketInfo(Symbol(),MODE_PROFITCALCMODE));
   Print("Способ расчета залоговых средств=",MarketInfo(Symbol(),MODE_MARGINCALCMODE));
   Print("Начальные залоговые требования для 1 лота=",MarketInfo(Symbol(),MODE_MARGININIT));
   Print("Размер залоговых средств для поддержки открытых ордеров в расчете на 1 лот=",MarketInfo(Symbol(),MODE_MARGINMAINTENANCE));
   Print("Маржа, взимаемая с перекрытых ордеров в расчете на 1 лот=",MarketInfo(Symbol(),MODE_MARGINHEDGED));
   Print("Размер свободных средств, необходимых для открытия 1 лота на покупку=",MarketInfo(Symbol(),MODE_MARGINREQUIRED));
   Print("Уровень заморозки ордеров в пунктах=",MarketInfo(Symbol(),MODE_FREEZELEVEL));
//---
   return(INIT_SUCCEEDED);
  }
Reason: