How to draw a line between an order open and close time?

 

I tried all of the objects listed: https://docs.mql4.com/constants/objects and even tried a triangle with 2 points in the same spot but it doesn't work.

The code looks like this:

for(int z = 0; z < OrdersHistoryTotal(); z++) {
      OrderSelect(z, SELECT_BY_POS, MODE_HISTORY);
      if (OrderSymbol() == Symbol()){
         ObjectCreate("stop"+z, OBJ_XYZ, 0, OrderOpenTime(), OrderOpenPrice(), OrderCloseTime(), OrderClosePrice());
      }
}

OBJ_XYZ is every object I tried. Maybe someone has an idea.

 
Biertago:

I tried all of the objects listed: http://OrderClosePrice and even tried a triangle with 2 points in the same spot but it doesn't work.

The code looks like this:

OBJ_XYZ is every object I tried. Maybe someone has an idea.


Do it with OBJ_TREND
 

I'm not an expert, but I don't think you should quote a post if it is above yours. Secondly, I've edited my post because it had bad link and as you can see I tried all of those.

Your answer is wrong because OBJ_TREND doesn't stop at close point and it goes into infinity.

 
Biertago:

I'm not an expert, but I don't think you should quote a post if it is above yours. Secondly, I've edited my post because it had bad link and as you can see I tried all of those.

Your answer is wrong because OBJ_TREND doesn't stop at close point and it goes into infinity.

One should quote the post when the post is directed at a specific poster, for example this post to you.

A trend line only goes to infinity if OBJPROP_RAY = true, make OBJPROP_RAY = false and it goes from point 1 to point 2


Then you can do stuff like this . . .

 
Simon Gniadkowski:

One should quote the post when the post is directed at a specific poster, for example this post to you.

A trend line only goes to infinity if OBJPROP_RAY = true, make OBJPROP_RAY = false and it goes from point 1 to point 2


Then you can do stuff like this . . .

would you mind sharing the code you used above, i was just wondering whats the most efficient way of doing this. and when to execute/call such function. this seems native to backtesting. isnt there a switch to turn this on when going live? TIA