A question for MQL connoisseurs - page 5

 
Rita:

ObjectCreate(name, OBJ_TRIANGLE, WindowFind(WindowExpertName(), Time[-1],vertex1_price,

Time[-5],vertex2_price,

Time[-7],vertex3_price, );

//--------------------------------------------------------------------------------------------------------------------------

I have set coordinates of triangle nodes by time (for example - by time of opening of future bars). The rest is not quite clear to me. It is not price that is displayed on the scale of the indicator window. It is the gradation of indicator values.

I need to "put" a triangle with rigidly fixed tops, regardless of the price.

And preferably, it should be rigidly fixed in the right (or lower) corner.

And I don't understand how to set the coordinates of its vertices - along the vertical axis of the indicator scale :


.... ... No answer from the experts...

Apparently, I have to take into account that it is impossible to draw the triangle in the indicator window using MQL.
 
Rita:
Apparently, we have to take into account that it is impossible to draw a triangle in the indicator window using MQL.
What was the initial task?
 

The initial task is like this.

I was told to do this. If price lines of indicator instruments on zero bar are converging,

i.e. abs. on (Symbol1[0]-Symbol2[0]) < ( Symbol1[1] - Symbol2[1])

then the triangle should be drawn with the right angle - see Fig.

If lines diverge, then the point is to the left.

I have written down the conditions. But I can't draw the triangle...

 

The price should be set in indicator units and the time as usual.

But it will still be attached to the chart, not to the screen.

If it is difficult to understand what price coordinates should be set, the algorithm is as follows:

If the indicator is auto-scaled, we define the number of bars in the window, calculate the minimum and maximum of indicator values in this interval and use them as base points.

If the indicator is with fixed scale, the coordinates are set by constants.

 
Rita:

Time is an array, it has no negative elements.

The future time can be set like this: Time[0]+X*Period()*60.

Vertically, the values on the scale of the indicator are set.

 

I see. Thank you all.

It's easier to write in words - "convergence or divergence" than to bother with a triangle ... -

 
Rita:

.... ... no answer from the experts...

Apparently, I have to take into account that it is impossible to draw a triangle in the indicator window using MQL.


Maybe the arrows are better

ObjectCreate("DevIM0", OBJ_ARROW, window, Time[0]+5500, 0);
ObjectSet("DevIM0", OBJPROP_ARROWCODE, 232);
ObjectSet("DevIM0", OBJPROP_WIDTH, 4);

 

put a label in the corner in Wingdings 2 font and don't bother...

 
Thanks. You could try the arrows as well.
 
Rita:
Thank you. We could try the arrows as well.


ObjectCreate("DevIM0", OBJ_TRIANGLE, window, Time[0]+5500, 0,Time[0]+8500, 30,Time[0]+8500, -1*30);

Triangle's not bad either.

Reason: