I encountered a strange situation the other day - the indicator on TF M1 is not correctly determining the opening price of the daily bar. The indicator has been used for about 3 years, and I had no problems with it before. The shift was very significant, about 500 pips, at the same time, in the morning it was showing correct data, but in the afternoon it was already lying. Changing TF did not help, only changing TF of indicator calculation in the indicator settings itself helped. I don't know how to reproduce it. Such glitches are scary when trading automatically.
When trying to create a resource, the compiler complains about the BMP file mouse.bmp
unsupported image format 'C:\Users\pc\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Files\Images\MyBMP\mouse.bmp'
Although, if used directly, there is no error and the image is displayed correctly.
#property strictstring label_name="currency_label"; // имя объекта OBJ_BITMAP_LABEL #resource "\\Files\\Images\\MyBMP\\Style-Pause-icon.bmp"; // путь к файлу каталог_данных_терминала\MQL4\Files\Images\MyBMP\... //#resource "\\Files\\Images\\MyBMP\\mouse.bmp"; string press ="::Files\\Images\\MyBMP\\Style-Pause-icon.bmp"; // RESOURCEstring unpress ="\\Files\\Images\\MyBMP\\mouse.bmp"; // путь к файлу каталог_данных_терминала\MQL4\... //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ intOnInit()
{
//--- создадим кнопку OBJ_BITMAP_LABEL, если ее еще нет if(ObjectFind(0,label_name)<0)
{
//--- попробуем создать объект OBJ_BITMAP_LABEL bool created=ObjectCreate(0,label_name,OBJ_BITMAP_LABEL,0,0,0);
if(created)
{
//--- привяжем кнопку к правому верхнему углу графика ObjectSetInteger(0,label_name,OBJPROP_CORNER,CORNER_RIGHT_UPPER);
//--- теперь настроим свойства объекта ObjectSetInteger(0,label_name,OBJPROP_XDISTANCE,100);
ObjectSetInteger(0,label_name,OBJPROP_YDISTANCE,50);
//--- сбросим код последней ошибки в 0 ResetLastError();
//--- загрузим картинку для состояния кнопки "Нажата" bool set=ObjectSetString(0,label_name,OBJPROP_BMPFILE,0,press);
//--- проверим результат if(!set)
{
PrintFormat("Не удалось загрузить картинку из файла %s. Код ошибки %d",press,GetLastError());
}
ResetLastError();
//--- загрузим картинку для состояния кнопки "Отжата"
set=ObjectSetString(0,label_name,OBJPROP_BMPFILE,1,unpress);
if(!set)
{
PrintFormat("Не удалось загрузить картинку из файла %s. Код ошибки %d",unpress,GetLastError());
}
//--- отдадим графику команду на обновление, чтобы кнопка появилась сразу же, не дожидаясь тика ChartRedraw(0);
}
else
{
//--- объект создать не удалось, сообщим об этом PrintFormat("Не удалось создать объект OBJ_BITMAP_LABEL. Код ошибки %d",GetLastError());
}
}
//--- return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ voidOnDeinit(constint reason)
{
//--- удалим объект с графика ObjectDelete(0,label_name);
}
//+------------------------------------------------------------------+
[in] Относительный путь к файлу, содержащему данные для ресурса. Если путь начинается с обратной косой черты "\" (пишется "\\"), то файл ищется относительно папки Если второй вариант функции вызывается для...
When trying to create a resource, the compiler complains about the BMP file mouse.bmp
Although, if used directly, there is no error and the image is displayed correctly.
file is in archive.
Editor
Behavior in MT4 is the same...
Doesn't want to swallow 8 bitmaps. Better convert to 24 or 32 bit.
32-bit is preferable when you need alpha-channel, then you can get an image on a transparent background instead of rectangular background covering the chart.
In that case, bitmaps must be converted to an array via ResourceReadImage and COLOR_FORMAT_ARGB_NORMALIZE must be used.
Оператор возврата return - Операторы - Основы языка - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
Good afternoon, after update the following bug occurred [MT4 (1280) / MetaEditor (2375)]:
Template function overload in class body, template parameter overrides correct function version. (For global functions - allowing overloading works ok.)
template<typename T>
class template_class{};
class X
{
public:
template<typename T>
void f(const template_class<T>&)
{
Print("T");
T * obj = NULL;
}
void f(const template_class<string>&)
{
Print("string");
}
void call()
{
template_class<string> ts;
f(ts); //Вызывает версию Т, а должен string.
}
};
voidOnStart()
{
X x;
x.call();
}
At the moment, there are a bunch of identical files that differ only in the last digit of the extension.
They are in different folders. Are they linked by a symlink?
In MQL5 common to both Terminals.
How do I change the language of the MT5 interface? I think there used to be a toggle in the menu, now I can't find it.
When trying to create a resource, the compiler complains about the BMP file mouse.bmp
Although, if used directly, there is no error and the image is displayed correctly.
file is in archive.
Editor
Behavior in MT4 is the same...
When trying to create a resource, the compiler complains about the BMP file mouse.bmp
Although, if used directly, there is no error and the image is displayed correctly.
file is in archive.
Editor
Behavior in MT4 is the same...
Doesn't want to swallow 8 bitmaps.
Better convert to 24 or 32 bit.
32-bit is preferable when you need alpha-channel, then you can get an image on a transparent background instead of rectangular background covering the chart.
In that case, bitmaps must be converted to an array via ResourceReadImage and COLOR_FORMAT_ARGB_NORMALIZE must be used.
Expanding scope via template parameter to access functions with a return value.
Example 1:Calling a function of a base class.
Example 2: Calling a static function of a class.
Template function overload in class body, template parameter overrides correct function version.
(For global functions - allowing overloading works ok.)