HELP about use of OrderClosePrice()

[Deleted]  

Hello,  I have found an expert where the parameter OrderClosePrice()  is included into an OrderModify and an OrderClose logic.

The codelines are the following:

OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderClosePrice()-TakeProfit*Point -TrailingStop*Point,0,Purple);

OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Blue);

I suppouse that this use of parameter OrderClosePrice() is not correct , but I am not sure. In you opinion it  is a coding error or it make any sense?

the ea source code is here :

 https://www.mql5.com/en/forum/129566

Thank you.

Simon Gniadkowski
17391
Simon Gniadkowski  
maxxmax:

Hello,  I have found an expert where the parameter OrderClosePrice()  is included into an OrderModify and an OrderClose logic.

The codelines are the following:

OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderClosePrice()-TakeProfit*Point -TrailingStop*Point,0,Purple);

OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),slippage,Blue);

I suppouse that this use of parameter OrderClosePrice() is not correct , but I am not sure. In you opinion it  is a coding error or it make any sense?

OrderClosePrice() is the price at which an Order that is closed was closed at.  When applied to an open Order it is the price that the Order would need to be closed at if it were closed at that moment,   so for a Buy it is  Bid,  for a Sell it is Ask.  Using OrderClosePrice() means that the same line of code can be used for Buy and Sell Orders without needed to determine the type.
joshatt
342
joshatt  
Wonderful !!! Good to learn this.