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

 
Maxim Kuznetsov:

there are no standard APIs for this, but if you really want to, you can :-)

algorithm is about this:

- scroll through all indicators of the chart (including sub-windows) to collect the maximum information about the changed indicator (name/order number)

- save the chart template

- expand the template to find the desired indicator

- Change the desired value

- ChartApplyTemplate

- (don't forget, that all indicators and EAs will be reloaded, and probably yours will be as well, and I will have to copy files through WinAPI as well)

All in all a great pain in the neck :-)

Thanks now I understand that I have only one way through the WinAPI ! Thank you very much !

 
STARIJ:

Very simple, I do it often. The convenience is that you can assign a key to the script. For example, Ctrl-z to remove lines, Alt-z to show lines. See functions GlobalVariableSet() and GlobalVariableGet() attached. I got the idea from another resource (corrected by the moderator Artyom Trishkin).

Thank you that's just what I need !!!

 
Alexey Viktorov:

1.

OBJPROP_CREATETIME

Object creation time

datetime r/o

2.

OBJPROP_PRICE

Price coordinate

doublemodifier=number of anchor point

Thanks, but it doesn't work.

int obj_total=ObjectsTotal();
       for(int iL=0;iL<obj_total;iL++)
  {
   name=ObjectName(iL);
   if(ObjectType(name)!=OBJ_TRIANGLE) continue;
   if(StringFind(name,"321fa",0)!=-1)
     {

    time= ObjectGetInteger(0,name ,OBJPROP_CREATETIME);//
      price=ObjectGetDouble(0,name ,OBJPROP_PRICE,2);
     
     }
  }
  //===---===

I need the price of the point that is in the middle of the parameters.

Where is it wrong?

 
PolarSeaman:

Thank you, but it's not working.

I need the price of the point that's in the middle of the parameters.

Where is it wrong?

There's documentation.

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Типы объектов / OBJ_TRIANGLE
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Типы объектов / OBJ_TRIANGLE
  • www.mql5.com
//| Cоздает треугольник по заданным координатам                      |               time1=0,                            price1=0,                         time2=0,                            price2=0,                         time3=0,                            price3=0,                        width=1,           ...
 
Vitaly Muzichenko:

There is documentation

This example is in front of me, but it's not clear how to get the price of the second point.

I don't know where it takes the price from and the time the object was created is current, but the object was created 60 candles ago.

I figured out the time. We need to setOBJPROP_TIME instead ofOBJPROP_CREATETIME.

I get the price of the oldest object, but how do I get the price of the freshest one?

 
PolarSeaman:

Thank you, but it's not working.

I need the price of the point that's in the middle of the parameters.

Where is it wrong?

OBJPROP_TIME. And as a modifier, the number of the desired point. The numbers start with zero.
 
PolarSeaman:

This example is in front of me, but how to get the price of the second point is unclear.

I don't know where it takes the price from and the time the object was created is current, but the object was created 60 candles ago.

I figured out the time. We need to setOBJPROP_TIME instead ofOBJPROP_CREATETIME.

I get the price of the oldest object, but how do I get the price of the freshest one?

Select by time of construction - by the most recent.

 
PolarSeaman:

Thank you, but it's not working.

I need the price of the point that's in the middle of the parameters.

Where is it wrong?

With this formulation of the question.

Forum on trading, automated trading systems & strategy testing

Any MQL4 beginner questions, help and discussion on algorithms and codes

PolarSeaman, 2018.04.04 08:02

Hello. There are objects - triangles with names: 321fa34, 321fa53, 321fa41. How can I find out the minimum price of the freshest triangle? The price that is in the properties in the middle.

Something to understand unambiguously, is extremely difficult. turns out "What's the question, is the answer".

The freshest as I understand it, is the one created later than everyone else, not the point coordinate time. Which coordinate is in which place in the object properties depends on the order in which the triangle was created.

 
Alexey Viktorov:

Which of the coordinates will be in which place in the object properties depends on the order in which the triangle is built.

Sorry about the wording.

I figured it out, I need a point always with index 1,

Artyom Trishkin:

Select by construction time - by the most recent one.

I can find the time, but I don't know how to choose the last one.

I tried another way, loop from the other side, but for some reason I get the price of the desired point is not the first (closest to the current date), and the second object.

 int obj_total=ObjectsTotal();
      // for(int iL=0;iL<obj_total;iL++)
       for(int iL = obj_total;iL>=0;iL--)
  {
   name=ObjectName(iL);
   if(ObjectType(name)!=OBJ_TRIANGLE) continue;
   if(StringFind(name,"233123h",0)!=-1)
     {

    time= ObjectGetInteger(0,name ,OBJPROP_TIME,1);//
      price=ObjectGetDouble(0,name ,OBJPROP_PRICE,1);
     
     }
  }
  //===---===

Why?

 
PolarSeaman:

For the wording, sorry.

And then you continue to use the same wording.