TakeOBJ_TREND as an example and copy it into your EA as separate functions. What do you mean by "make it not disappear"? Obtaining object time and price values:ObjectGetTimeByValue andObjectGetValueByTime.
When I call the script, the line appears visually (as in the video) and then disappears.
Change the script code. Remove the deletion of the object. Are you using the whole script from the help?
Change the script code. Remove the deletion of the object. Are you using the whole script from the help?
If you have any questions about the code, post the code and ask.
It is not clear what these numbers mean and what they set? If with time I can assume that it is bar index, then how to understand InpPrice, has int type?
input int InpDate1=35; // Дата 1-ой точки в % input int InpPrice1=60; // Цена 1-ой точки в % input int InpDate2=65; // Дата 2-ой точки в % input int InpPrice2=40; // Цена 2-ой точки в %
It is not clear what these numbers mean and what they ask?
Deciphering The explanation is given a little above:
#property description "Скрипт строит графический объект \"Трендовая линия\"." #property description "Координаты точек привязки задаются в процентах от" #property description "размеров окна графика."
and from here on this data will be used to determine the drawing points:
void OnStart() { . . . //--- определим точки для рисования линии int d1=InpDate1*(bars-1)/100; int d2=InpDate2*(bars-1)/100; int p1=InpPrice1*(accuracy-1)/100; int p2=InpPrice2*(accuracy-1)/100; //--- создадим линию тренда . . .
Deciphering The explanation is given a little above:
and from here on this data will be used to define the drawing points:
In the"OBJ_TREND" example, I think there is a lot of unnecessary data. Since I don't know this area very well I'm afraid I'll be lost for a long time.
As far as I understand the code is searched, but I already know the two points, bar indexes (my algorithm).
The only question is how to connect these two points with a line and continue it to the right up to a certain event.
There seems to be a lot of redundancy in this example. Since I don't know this area very well, I'm afraid I'll be wandering around for a long time.
As far as I understand the code is searching, but I already know the two points, index bars (my algorithm).
The only question is how to connect these two points with a line and continue it to the right up to a certain event.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I've wanted to learn howto create graphical objects for a long time, but many lines of code are confusing.
If everything is clear with calling the indicator in the Expert Advisor: calling the handle, copying values into the buffer, then what is the algorithm for constructing objects in brief?
I will start with the simplest one - drawing the trend line. Here is an examplehttps://www.mql5.com/ru/docs/constants/objectconstants/enum_object/obj_trend
Only, how to make the line appear but not disappear?
I wonder how to read the current position of this line in the EA, there are no buffers in the objects?
I want to create it in MQL4, is it much different from MQL5?