Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1193

 
jamalhan2016:
Hello, do i need some help? What should I do to transfer an account from mql4 to mql5?

it is necessary to open an mt5 account and transfer money from that account to an mt5 account (with your broker)

 
Koldun Zloy:

You can't from a DLL. Forget about it. You can't, that's all!

It's a shame and strange that I learned how to program in 3 years, but mql is the same as it is now. This is certainly not a priority, but slowly (very slowly and slowly) this issue should be studied.

 
Stanislav Korotky:

This is some antiquity (another server is mentioned). More than once this year, last time a month ago on MetaQuotes-Demo a new demo account was created normally.

Also, if the server is removed why is it shown and pinged in the account opening wizard? The jam happens only on the last step.

I opened an account in the mobile terminal. At first I had to login mql5 account in the terminal and then demo account was added. It took me an hour to add it, but it worked.
 
Valeriy Yastremskiy:
I opened an account in the mobile terminal. At first I had to authorize my mql5 account in the terminal and then the demo account was added. It took me an hour to add it, but it worked.

It's working fine (instantly) on my PC now.

 
Where mql4 creates arrays, can the size of the mql4 array be changed by third party means (other programming languages)?
 
Hello!

This may be a primitive topic, but no matter how many times I searched, I couldn't find any answer.

Can you please advise how to programmatically find objects of a certain type on a chart (e.g. 4-5) that were manually set earlier and save their names, coordinates and other properties in the buffer for further use in the EA?

Or, what would be easier, how to read the name, coordinates and other properties of a graphical object into the program buffer or a simple set of variables immediately after its placing with the mouse on the chart?
It is assumed that the properties of this object can be adjusted manually or by the mouse, and then this data is recorded as the final data for further use in the EA.
 
vladmirad:
Hello!

I may be bringing up a primitive, trivial topic, but as much as I've looked around, I haven't found an answer.

Can you advise how to find manually set objects of a certain type on a chart (e.g. 4-5) and save their names, coordinates and other properties in the buffer for further use in the EA?

Or, what would be easier, how to read the name, coordinates and other properties of a graphical object into the program buffer or a simple set of variables immediately after its placing with the mouse on the chart?
It is assumed that the properties of this object can be adjusted manually or by the mouse, and then this data is recorded as the final data for further use in the EA.

Study - MQL4 Reference Guide / Graphic Objects / ObjectFind() searches for an object with the specified name, ObjectGet() returns properties (e.g. price of lines of endpoints), ObjectSet() changes properties. Again, the object must have a name, there are many functions that work with objects. And of course you have to calculate them correctly through the loop, it's not a quick thing to do. I don't know if you can return the name of the object, in fact, the name is given by the user and it can be saved in an array and copied later to reduce the load.

 
vladmirad:
Hello!

This might be a primitive topic, but I haven't found any answer.

Can you please advise how to programmatically find objects of a certain type on a chart (e.g. 4-5) that were manually set earlier and save their names, coordinates and other properties in the buffer for further use in the EA?

Or, what would be easier, how to read the name, coordinates and other properties of a graphical object into the program buffer or a simple set of variables immediately after its placing with the mouse on the chart?
It is assumed that the properties of this object can be adjusted manually or by the mouse, and then this data is recorded as the final data for further use in the EA.
Hello.
Start by monitoring the state of the chart in OnChartEvent() https://www.mql5.com/ru/docs/event_handlers/onchartevent
There are a few events that you need:
CHARTEVENT_OBJECT_CREATE Create a graphical object
CHARTEVENT_OBJECT_CHANGE Change the properties of a graphical object using the properties dialog
CHARTEVENT_OBJECT_DELETE Delete graphical object
https://www.mql5.com/ru/docs/constants/chartconstants/enum_chartevents
Log all parameters in the OnChartEvent() handler and see their values when you add/modify/delete graphical objects. This will give you direction where to go.
 
vladmirad:
Hello!

I may be raising a primitive obsolete topic, but how many times I searched, I couldn't find an answer.

How can I find manually set objects of a certain type on a chart (e.g. 4-5) and save their names, coordinates and other properties in the buffer for further use in the EA?

Or, what would be easier, how to read the name, coordinates and other properties of a graphical object into the program buffer or a simple set of variables immediately after its placing with the mouse on the chart?
It is assumed that the properties of this object can be adjusted manually or by the mouse, and then this data is recorded as the final data for further use in the EA.

You can find and log objects of a given type with their coordinates as follows:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart(){
  int total = ObjectsTotal(0, subwin, type);
  int i = 0;
  string name;
  datetime time1, time2;
  double price1, price2;
  for(; i < total; i++) {
    name = ObjectName(0, i, subwin, type);
    Print("Object: \"", name, "\"");
    time1 = (datetime)ObjectGetInteger(0, name, OBJPROP_TIME, 0);
    time2 = (datetime)ObjectGetInteger(0, name, OBJPROP_TIME, 1);
    price1 = ObjectGetDouble(0, name, OBJPROP_PRICE, 0);
    price2 = ObjectGetDouble(0, name, OBJPROP_PRICE, 1);
    Print("Time1: ", TimeToString(time1), "; Price1: ", DoubleToString(price1, Digits()), "; Time2: ", TimeToString(time2), "; Price2: ", DoubleToString(price2, Digits()), ".");
  }
}

You can save any data to a file. And in the Expert Advisor, make a loader that will add the appropriate objects, and then load data from the file into them. But you at least sketch a source code for your specific task and publish it here.

Files:
ObjGet.mq5  4 kb
 
Seric29:

Study - MQL4 Reference Guide / Graphic Objects / ObjectFind() searches for an object with the specified name, ObjectGet() returns properties (e.g. price of lines of endpoints), ObjectSet() changes properties. Again, the object must have a name. There are many functions that work with objects. And of course you have to calculate them correctly through the loop, it's not a quick thing to do. I don't know if you can return the name of the object, in fact the name is given by the user and it can be saved in an array and copied later to reduce the load.

Thanks for the advice, I am aware of these functions.
But how can we use them to automatically detect an object on a chart and read its parameters, if we don't know its name a priori?
When drawing an object on a chart with a mouse, the system gives its name.

Of course, it is not difficult to organize the manual input of all of the necessary data of the object from its table of properties, but then why the automation?
And I do not know how to pass the name of the object to the EA programmatically, and then all of the functions you have mentioned above can be activated...

Reason: