Errors, bugs, questions - page 2031

 
Andrey Barinov:

Read about type conversion and losses in doing so. https://www.mql5.com/ru/docs/basis/types/casting


Thank you! The idea is this: we have an indicator which gives few accurate signals.

Open any number of charts and, according to the MM and the indicator signal, open positions. We create text marks or buttons on the chart indicating the symbol and the current profit of the open positions. When you click the button, the desired chart is in the foreground.

 
Has the source of FOREX quotes changed on Metaquotes-Demo? The spreads are much smaller.
 
Slava:
A foursome?

Yes

 
Instead of a compile error, there is strange behaviour when executing
// Запускаем на MT5

#import "Temp.ex4" // EX4 - не ошибка
  void Func();
#import

void OnInit()
{
  Func();
}

Not just any DLL, not even Temp.ex4!

 
Vitaly Muzichenko:

Yes

The problem is that in the new MQL4 the strings are unicode. In all other places: objects, indicators, graphs, symbol names, logs, settings, etc. - the strings remain unicode. Therefore, when communicating with the "outside world" in MQL4 programs, every time the WideCharToMultiByte conversion is done. Normally, characters of strings are single byte (but different in different encodings), in Southeast Asia it is multibyte (in Chinese layout 1 character takes from 1 to 4 bytes.

So not only Chinese, but also Europeans will not understand 1251 code page

 
Slava:

The problem is that in the new MQL4 the strings are unicode. In all other places: objects, indicators, graphs, symbol names, logs, settings, etc. - the strings remain unicode. Therefore, when communicating with the "outside world" in MQL4 programs, every time the WideCharToMultiByte conversion is done. In usual case, characters of strings are single byte (but different in different encodings), in Southeast Asia it is multibyte (in Chinese layout 1 character takes from 1 to 4 bytes.

So not only Chinese, but also Europeans would not understand 1251 code page

Here's the trick: We create an object with a Cyrillic name, then on click it handles it in OnChartEvent, but its name is not visible there.

We'll check today in the five to see if this place will have a problem.

 
Vitaly Muzichenko:

Here's the thing: We create an object with a Cyrillic name, then on click it handles it in OnChartEvent, but you can't see its name there.

Today we'll check in FIVE to see if this place will have a problem.

It will work in Fiver.

And there is a solution for your case in Quaternary.

Call MQLSetInteger(MQL_CODEPAGE,CP_ACP) in OnInit;

Then the string conversions "back and forth" will be adequate


MQLSetInteger - Проверка состояния - Справочник MQL4
MQLSetInteger - Проверка состояния - Справочник MQL4
  • docs.mql4.com
Функция MQLSetInteger() предназначена для изменения текущей кодовой страницы в запущенной mql4-программе. Это может понадобиться в тех случаях, когда для запускаемых mql4-программ терминал устанавливает по умолчанию кодовую страницу, отличающаяся от той, которая использовалась при её компиляции. Например, mql4-программа скомпилирована на...
 
Please tell me if you know what I'm doing wrong:

this code runs on EURUSD 30m

#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0
ENUM_MA_METHOD     MA_Type   = MODE_SMA;
ENUM_APPLIED_PRICE MA_Price  = PRICE_CLOSE;
int handle;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
   handle = iMA("AAPL",_Period, 10,0,MA_Type,MA_Price);

   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{

   return(rates_total);
}
//+------------------------------------------------------------------+


terminal generates an error:
2017.10.11 14:35:23.352 11111111111111111111111111 (EURUSD,M30) cannot load indicator 'Moving Average' [4302]

When I print it out, it generates -1;

 
Money_Man:
Please tell me what I am doing wrong:

this code runs on EURUSD 30m



terminal gives an error:
2017.10.11 14:35:23.352 11111111111111111111111111 (EURUSD,M30) cannot load indicator 'Moving Average' [4302]



And so:

   handle = iMA(Symbol(),Period(), 10,0,MA_Type,MA_Price);

?

 
Money_Man:
Please tell me what I'm doing wrong:

this code runs on EURUSD 30m



the terminal gives an error:
2017.10.11 14:35:23.352 11111111111111111111111111 (EURUSD,M30) cannot load indicator 'Moving Average' [4302]


What does error 4302 mean?