Got it! As the names are identical, the smallest first digit in the number is selected and it is the 4th object, then as the first 2 objects have a 4th digit, the smallest digit following the 4th of the first 2 objects is selected.
A100:
Yes, only inverse conversion can't be done. Assigning random numbers to objects is like calling the language MQL831 instead of MQL5.
In my opinion, in order to process the objects in the order of their creation manually, you have to either number the names after all of them or during the process of each of them creation and then run the robot to process and write the array keeping the numeration of creation in the names. This will allow correct sorting of objects from the list in the future through theObjectName function and others like it, in the orderof objects creation manually.
In my opinion, in order to process objects in order of creation manually, we need to either number the names after all objects have been created or in the process of each object's creation and then turn on the robot, that it processes and writes an array keeping the numbering of creation in the names. In future, this will allow to properly select objects from the list, both through the ObjectName function and others like it, in the orderof objects created manually.
Why not use ObjectGetInteger() with property identifier OBJPROP_CREATETIME?
2. Возвращает true или false в зависимости от успешности выполнения функции. В случае успеха значение свойства помещается в приемную переменную, передаваемую по ссылке последним параметром. [in] Модификатор указанного свойства. Для первого варианта по умолчанию значение модификатора равно 0. Большинство свойств не требуют модификатора...
What prevents me from using ObjectGetInteger() with property ID OBJPROP_CREATETIME ?
The idea is that I want everything I draw on the chart to be written in the name of objects, including the numbering of object creation in the list, in the order of creation, timeframe, Fibo level type and Fibo level type serial number, at the same time writing arrays with these level data in the order they are listed. Then we will create criteria for trade actions by these names and data in arrays corresponding to the order of creation of these objects.
So far, I've found this way: we create 4 Fibo objects In the list, the order of creation is saved, number them for processing according to the order of creation Run the Expert Advisor
//+------------------------------------------------------------------+//| F.mq5 |//| Copyright 2020, MetaQuotes Software Corp. |//| https://www.mql5.com |//+------------------------------------------------------------------+#property copyright"Copyright 2020, MetaQuotes Software Corp."#property link"https://www.mql5.com"#property version"1.00"//+------------------------------------------------------------------+//| Fibo_Massiv.mq5 |//| Copyright 2020, MetaQuotes Software Corp. |//| https://www.mql5.com |//+------------------------------------------------------------------+string NameFiboUp[15]; // Объявление массиваstring NameFiboDown[15]; // Объявление массиваstring NameFibo[9]; // Объявление массиваint TimeFrame[9];
string Num[9];
int Frame;
//string New_N;//+------------------------------------------------------------------+intOnInit()
{
//______________________________Массив новых имён с индексацией номеров очерёдности________________________________
NameFiboUp[1]="FiboUp1 ";
NameFiboDown[1]="FiboDown1 ";
NameFiboUp[2]="FiboUp2 ";
NameFiboDown[2]="FiboDown2";
NameFiboUp[3]="FiboUp3";
NameFiboDown[3]="FiboDown3 ";
NameFiboUp[4]="FiboUp4 ";
NameFiboDown[4]="FiboDown4 ";
NameFiboUp[5]="FiboUp5";
NameFiboDown[5]="FiboDown5 ";
NameFiboUp[6]="FiboUp6 ";
NameFiboDown[6]="FiboDown6 ";
NameFiboUp[7]="FiboUp7 ";
NameFiboDown[7]="FiboDown7 ";
NameFiboUp[8]="FiboUp8 ";
NameFiboDown[8]="FiboDown8 ";
NameFiboUp[9]="FiboUp9 ";
NameFiboDown[9]="FiboDown9 ";
NameFiboUp[10]="FiboUp10 ";
NameFiboDown[10]="FiboDown10";
NameFiboUp[11]="FiboUp11 ";
NameFiboDown[11]="FiboDown11 ";
NameFiboUp[12]="FiboUp12 ";
NameFiboDown[12]="FiboDown12 ";
NameFiboUp[13]="FiboUp13 ";
NameFiboDown[13]="FiboDown13";
NameFiboUp[14]="FiboUp14 ";
NameFiboDown[14]= "FiboDown14";
//____________________string Массив таймфреймов______________________________
NameFibo[1]="M1";
NameFibo[2]="M5";
NameFibo[3]="M15";
NameFibo[4]="H1";
NameFibo[5]="H4";
NameFibo[6]="Da";
NameFibo[7]="We";
NameFibo[8]="Mo";
//___________________int Массив таймфреймов__________________________________________
TimeFrame[1]=1;
TimeFrame[2]=5;
TimeFrame[3]=15;
TimeFrame[4]=60;
TimeFrame[5]=240;
TimeFrame[6]=1440;
TimeFrame[7]=10080;
TimeFrame[8]=43200;
//_____________________________________________________________________________
Num[1]="1";
Num[2]="2";
Num[3]="3";
Num[4]="4";
Num[5]="5";
Num[6]="6";
Num[7]="7";
Num[8]="8";
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
//---
}
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+voidOnTick()
{
int G=0;
int UP=1; //Счётчик очерёдности типов фибоint Down=1; //Счётчик очерёдности типов фибоstring nameUP = "FiboUp";
string nameDown = "FiboDown";
double FiboDown[4][10],FiboUp[4][10]; // 2x мерный массив// Alert("ArraySize(FiboDown)= ", ArraySize(FiboDown));int Fibo_Koll = ObjectsTotal(0,0,OBJ_FIBO); //Запрос колличества объектов Fibo//_________________________________________________________if(Fibo_Koll==0) //Если нет не одного фибо выход //return; ////_________________________________________________________//// int Koll[]; //Индексация и запись в массив по порядку появления фибо в окне инструментов// int Tip[]; //Запись типа Fibo в массив по порядку появления фибо в окне инструментов//ArrayResize(Koll,Fibo_Koll); // Устанавливает новый размер в первом измерении массива Koll []//ArrayResize(Tip,Fibo_Koll); // Устанавливает новый размер в первом измерении массива Tip []// ObjectName(0,0,0,OBJ_FIBO); //Вытаскивает имя найденого фибоfor(int i=0; i < Fibo_Koll; i++)
{
G++; // Нумератор объектов из списка объектовstring n =ObjectName(0,i,0,OBJ_FIBO); //Имя для обрезки до 2х первых знаков для получения тайм-фреймаstring Name_Static =ObjectName(0,i,0,OBJ_FIBO);
//--------------------------------------------------------//----------------------------------------------------------------------------------------double Fibo_Level_0= ObjectGetDouble(
0, // идентификатор графика
n, // имя объектаOBJPROP_PRICE, // идентификатор свойства0// модификатор свойства
);
double Fibo_Level_1= ObjectGetDouble(
0, // идентификатор графика
n, // имя объектаOBJPROP_PRICE, // идентификатор свойства1// модификатор свойства
);
//------------------------------------------------------------------------------------------------------if(Fibo_Level_0>Fibo_Level_1)
{
//вызов функции расчёта уровня 78.6double Fibo_78_Up = Function_Up(Fibo_Level_0, Fibo_Level_1);
//Изменение имени объектаbool l = StringSetLength( //Устанавливает для строки указанную длину в символах 2
n, // строка2// новая длина строки
);
//-----------------------------------------------------------int N = 1;
string q;
for(int e = 1; N != 0; e++) // пока N не == 0, гоняем функцию StringCompare. сравнивая обрезанную переменную(StringSetLength) с массивом NameFibo[]
{
N= StringCompare(
n, // первая сравниваемая строка
NameFibo[e], // вторая сравниваемая строкаtrue// режим учета регистра букв при сравнении
);
q= NameFibo[e];
Frame= TimeFrame[e];
}
string New_N =Num[G];
string r= New_N+q+NameFiboUp[UP];
//--------------------------------------------------------------------
FiboUp[UP][1]=1; // Тип обектов 1 == FiboUp
FiboUp[UP][2]=UP; // Нумерация обектов FiboUp по типу
FiboUp[UP][3]=Fibo_78_Up; // 78.6%
FiboUp[UP][4]=Frame; // Тайм фрейм
FiboUp[UP][5]=0; // 50%//----------------------------------------------------------------------------------------------------------bool F =ObjectSetString(0,Name_Static,OBJPROP_NAME,r);
UP++;
}
//----------------------------------------------------------------------------------else
{
//вызов функции расчёта уровня 78.6double Fibo_78_Down = Function_Down(Fibo_Level_0, Fibo_Level_1);
//Изменение имени объектаbool l = StringSetLength( //Устанавливает для строки указанную длину в символах 2
n, // строка2// новая длина строки
);
//-----------------------------------------------------------int N = 1;
string q;
for(int e = 1; N != 0; e++) // пока N не == 0, гоняем функцию StringCompare. сравнивая обрезанную переменную(StringSetLength) с массивом NameFibo[]
{
N= StringCompare(
n, // первая сравниваемая строка
NameFibo[e], // вторая сравниваемая строкаtrue// режим учета регистра букв при сравнении
);
q= NameFibo[e];
Frame= TimeFrame[e];
}
string New_N =Num[G];
string r= New_N+q+NameFiboDown[Down];
//-------------------------------------------------------------------
FiboDown[Down][1]=2; // // Тип обектов 2 == FiboDown
FiboDown[Down][2]=Down; // Нумерация обектов по типу
FiboDown[Down][3]=Fibo_78_Down; // 78.6%
FiboDown[Down][4]=Frame; // Тайм фрейм
FiboDown[Down][5]=0; // 50%//------------------------------------------------------------------//Изменение имени объектаbool F =ObjectSetString(0,Name_Static,OBJPROP_NAME,r);
Down++;
}
}
//+------------------------------------------------------------------+ArrayPrint(
FiboUp, // выводимый массив6, // количество десятичных знаков после запятойNULL, // разделитель между значениями полей структуры0, // индекс первого выводимого элементаWHOLE_ARRAY, // количество выводимых элементовARRAYPRINT_HEADER|ARRAYPRINT_INDEX|ARRAYPRINT_ALIGN
);
ArrayPrint(
FiboDown, // выводимый массив6, // количество десятичных знаков после запятойNULL, // разделитель между значениями полей структуры0, // индекс первого выводимого элементаWHOLE_ARRAY, // количество выводимых элементовARRAYPRINT_HEADER|ARRAYPRINT_INDEX|ARRAYPRINT_ALIGN
);
}
// for(int i=0; i<ArraySize(Koll); i++)// printf("Koll[%d] = %d",i,Koll[i]);//------------------------------------------------------------------------------------------------------//+------------------------------------------------------------------+//+------------------------------------------------------------------+double Function_Up(double a, double b) // имя функции и список параметров
{
double Sum_100 = a - b; //Вычисляем 100% В пунктах от точек построения фибоdouble Sum_78 = Sum_100 * 78.6 / 100; //Вычисляем 78.6% В пунктахreturn (Sum_78 + b); // Вычисляем 78.6% в цене инструмента
}
//+------------------------------------------------------------------+double Function_Down(double a, double b) // имя функции и список параметров
{
double Sum_100 = b - a ; //Вычисляем 100% В пунктах от точек построения фибоdouble Sum_78 = Sum_100 * 21.4 / 100; //Вычисляем 78.6% В пунктахreturn (Sum_78 + a); // Вычисляем 78.6% в цене инструмента
}
//+------------------------------------------------------------------+
We go through the objects in the order of their creation with change of names to keep the order of creation in the list, and write characteristics and levels of objects in arrays in the order of their creation as in the list. The first pass of code, keeping the order of creation of objects in the list modifies the names, supplementing with characteristics for orientation when creating criteria and keeping the order in the list of objects for correct further selection by going through the order in case of change of object coordinates, and correct overwriting of arrays in the order of first filling.
The point is that I want everything I draw on the chart to be written in the name of objects, including the numbering of objects in the list, in order of creation, timeframe, Fibo level type and Fibo level type serial number, in parallel writing arrays with data of these levels in the order of objects in the list of graphic objects. Then we will create criteria for trade actions by these names, and data in arrays corresponding to the order of creation of these objects.
So far, I've found the following method. We create 4 Fibo objects in the list in the order of their creation, number them for processing according to the order of creation Launch Expert Advisor
The first pass of the code, keeping the order of objects in the list, modifies the names of objects to keep the order of their creation and record characteristics and levels in arrays in the order of creation of these objects as in the list. The first pass of code, keeping the order of objects in the list, modifies the names, adding characteristics for orientation when creating criteria and keeping the order in the object list for correct further selection by trying to change the order of objects coordinates and correctly overwriting arrays in the first pass
While on the first pass, the logic is saved)))
Everything would be much simpler if the objects would have a number in the list of objects which corresponds to the order of creation.
Nikolay Kositsin: Folks who are aware of this, have taken up sketching using CCanvas class. And I have discovered some totally unknown problem. Filled background rectangles and circles are drawn fine, but all my attempts to draw a circle have ended in complete failure. There are three variants of circles in the code and no result of drawing them on the chart. Does this code work for circles or is there something missing?
Nikolai Semko: It always worked.
You're doing something wrong.
Yes, everything works. Try this script. It draws in three algorithms Circle, CircleAA, and CircleWu circles of random radii, colour, and transparency
CircleAA is better not to use - it's a very slow algorithm.
The point is that I want everything I draw on the chart to be written in the name of objects, including the numbering of objects in the list, in order of creation, timeframe, type of Fibo level and Fibo level type serial number, in parallel writing arrays with data of these levels in the order of objects in the list of graphic objects. Then we will create criteria for trade actions by these names, and data in arrays corresponding to the order of creation of these objects.
So far, I have found the following method. We create 4 Fibo objects in the list in the order of their creation, number them for processing according to the order of creation Run the Expert Advisor
The first pass of the code, keeping the order of objects in the list, modifies the names of objects to keep the order of their creation and record characteristics and levels in arrays in the order of creation of these objects as in the list. The first pass of code, keeping the order of objects in the list, modifies the names, adding characteristics for orientation when creating criteria and keeping the order in the object list for correct further selection by trying to change the order of object coordinates and correctly overwrite the arrays in the first pass
While on the first pass, the logic is preserved)))
Your question is solved on "once". It is enough to write renaming of created objects.
/***********************OnChartEvent function************************/voidOnChartEvent(constint id, // идентификатор событияconstlong& lparam, // параметр события типа longconstdouble& dparam, // параметр события типа doubleconststring& sparam // параметр события типа string
)
{
if(id == CHARTEVENT_OBJECT_CREATE)
{
string result[]; // массив для получения строкStringSplit(sparam, ' ', result); // получим из имени созданного объекта подстрокиulong timeCreate = ObjectGetInteger(0, sparam, OBJPROP_CREATETIME); // получим время создания объектаstring newName = result[0]+" "+result[1]+" "+string(timeCreate); // сформируем новое имя объектаObjectSetString(0, sparam, OBJPROP_NAME, newName); // переименуем объект
}
}/******************************************************************/
Now each time you create a graphical object on the chart with an Expert Advisor installed, the object names will have the time of creation instead of a random number in the name and will be sorted strictly in the sequence of creation.
Hello all! Can you advise an illiterate "programmer" what to add to the code of the indicator in mql4, to superimpose the histogram on the chart of an instrument in a certain place? It is also desirable the histogram to be semi-transparent, so it does not cover the chart. In the attached file (I don't know how to attach it to the message as an image) I have shown you approximately how it should look like.
Your question is solved in a snap. It is enough to write renaming of created objects.
Now each time you create a graphical object on the chart with the Expert Advisor installed, the object names, instead of a random number, in the name will have the time of creation and will be sorted strictly in the sequence of creation.
Thanks a lot!!! Not fully read about these Event Handling Functions, simplify the life of a proger)
Got it! As the names are identical, the smallest first digit in the number is selected and it is the 4th object, then as the first 2 objects have a 4th digit, the smallest digit following the 4th of the first 2 objects is selected.
Yes, only inverse conversion can't be done. Assigning random numbers to objects is like calling the language MQL831 instead of MQL5.
In my opinion, in order to process the objects in the order of their creation manually, you have to either number the names after all of them or during the process of each of them creation and then run the robot to process and write the array keeping the numeration of creation in the names. This will allow correct sorting of objects from the list in the future through theObjectName function and others like it, in the orderof objects creation manually.
In my opinion, in order to process objects in order of creation manually, we need to either number the names after all objects have been created or in the process of each object's creation and then turn on the robot, that it processes and writes an array keeping the numbering of creation in the names. In future, this will allow to properly select objects from the list, both through the ObjectName function and others like it, in the orderof objects created manually.
Why not use ObjectGetInteger() with property identifier OBJPROP_CREATETIME?
What prevents me from using ObjectGetInteger() with property ID OBJPROP_CREATETIME ?
The idea is that I want everything I draw on the chart to be written in the name of objects, including the numbering of object creation in the list, in the order of creation, timeframe, Fibo level type and Fibo level type serial number, at the same time writing arrays with these level data in the order they are listed. Then we will create criteria for trade actions by these names and data in arrays corresponding to the order of creation of these objects.
So far, I've found this way: we create 4 Fibo objects
In the list, the order of creation is saved, number them for processing according to the order of creation
Run the Expert Advisor
We go through the objects in the order of their creation with change of names to keep the order of creation in the list,
and write characteristics and levels of objects in arrays in the order of their creation as in the list.
The first pass of code, keeping the order of creation of objects in the list modifies the names, supplementing with characteristics for orientation when creating criteria and keeping the order in the list of objects for correct further selection by going through the order in case of change of object coordinates, and correct overwriting of arrays in the order of first filling.
So far, the logic is saved on the first pass)))
The point is that I want everything I draw on the chart to be written in the name of objects, including the numbering of objects in the list, in order of creation, timeframe, Fibo level type and Fibo level type serial number, in parallel writing arrays with data of these levels in the order of objects in the list of graphic objects. Then we will create criteria for trade actions by these names, and data in arrays corresponding to the order of creation of these objects.
So far, I've found the following method. We create 4 Fibo objects in the list in the order of their creation, number them for processing according to the order of creation Launch Expert Advisor
The first pass of the code, keeping the order of objects in the list, modifies the names of objects to keep the order of their creation and record characteristics and levels in arrays in the order of creation of these objects as in the list. The first pass of code, keeping the order of objects in the list, modifies the names, adding characteristics for orientation when creating criteria and keeping the order in the object list for correct further selection by trying to change the order of objects coordinates and correctly overwriting arrays in the first pass
While on the first pass, the logic is saved)))
Everything would be much simpler if the objects would have a number in the list of objects which corresponds to the order of creation.
Folks who are aware of this, have taken up sketching using CCanvas class. And I have discovered some totally unknown problem. Filled background rectangles and circles are drawn fine, but all my attempts to draw a circle have ended in complete failure. There are three variants of circles in the code and no result of drawing them on the chart. Does this code work for circles or is there something missing?
It always worked.
Yes, everything works.
Try this script. It draws in three algorithms Circle, CircleAA, and CircleWu circles of random radii, colour, and transparency
CircleAA is better not to use - it's a very slow algorithm.
It would be a lot easier if the objects were tacitly assigned a number in the list of objects corresponding to the order in which they were created.
The point is that I want everything I draw on the chart to be written in the name of objects, including the numbering of objects in the list, in order of creation, timeframe, type of Fibo level and Fibo level type serial number, in parallel writing arrays with data of these levels in the order of objects in the list of graphic objects. Then we will create criteria for trade actions by these names, and data in arrays corresponding to the order of creation of these objects.
So far, I have found the following method. We create 4 Fibo objects in the list in the order of their creation, number them for processing according to the order of creation Run the Expert Advisor
The first pass of the code, keeping the order of objects in the list, modifies the names of objects to keep the order of their creation and record characteristics and levels in arrays in the order of creation of these objects as in the list. The first pass of code, keeping the order of objects in the list, modifies the names, adding characteristics for orientation when creating criteria and keeping the order in the object list for correct further selection by trying to change the order of object coordinates and correctly overwrite the arrays in the first pass
While on the first pass, the logic is preserved)))
Your question is solved on "once". It is enough to write renaming of created objects.
Now each time you create a graphical object on the chart with an Expert Advisor installed, the object names will have the time of creation instead of a random number in the name and will be sorted strictly in the sequence of creation.
Your question is solved in a snap. It is enough to write renaming of created objects.
Now each time you create a graphical object on the chart with the Expert Advisor installed, the object names, instead of a random number, in the name will have the time of creation and will be sorted strictly in the sequence of creation.
Thanks a lot!!! Not fully read about these Event Handling Functions, simplify the life of a proger)
Isn't the object creation time (use as ulong type) OBJPROP_CREATETIME an identifier of the object creation order?
Yes! Thank you!!!