ordercloseby() function

 

can some one explain to me what exactly the Ordercloseby() function does, am having hard time to code it into my robot.

Does it close and order and then opens an opposite one, or...it just closes an order depending on the opposite one.

what exactly do the parameters of this function mean???

OrderCloseBy(ticket, opposite, Color)

Especially "ticket"and "opposite".

thanks..

 
  1. It "just closes an order depending on the opposite one" thus saving one spread vs. close and then open an opposite one.
  2. Not permitted on some brokers.
  3. Hedging not permitted for US traders.
 
whroeder1:
  1. It "just closes an order depending on the opposite one" thus saving one spread vs. close and then open an opposite one.
  2. Not permitted on some brokers.
  3. Hedging not permitted for US traders.
How does it save spread?
 
The book says (between Figures 95 and 96):
However, if we use in this situation the function OrderCloseBy() intended for opposite closing of orders, the economic output will be better (as compared to the preceding alternative) by the amount proportional to the cost of one order's spread
 

Hello Byakatonda Denis ,

I also have difficulty with this code.

I have a EA moving average,  I would like an order to be closed as soon as an opponent opens and I can not insert into my EA.

You did it?

Reason: