Features of the mql4 language, subtleties and techniques - page 23

 
fxsaber:

Yes.

I see. So I haven't forgotten everything yet...

Well, it's a good pattern. Why look for other options?

 
Artyom Trishkin:

why look for other options?

Usually, I'm far from optimal solutions.

 
fxsaber:

I am usually far from optimal solutions.

Well, it is usually suggested to close with a counter limit order. Moving a TakeProfit position instead of setting a limit order, and then closing with a counter limit or alternating closes is more optimal.

 
Artyom Trishkin:

Well, it is usually suggested to close with a counter limit order. Moving the TakeProfit position instead of setting a limit order, and then closing with a counter limit or alternating closes is more optimal.

When I said optimality, I didn't mean technical execution, but the final closing price level.

 
fxsaber:

When I said optimality, I was referring to the final closing price level, not the technical execution.

I cannot figure it out: transfer of take may close the position at the specified price or with a positive slippage, or may not close at all. How should I deal with it?

 
Artyom Trishkin:

I have no idea: transfer of take may close the position at the specified price or with a positive slippage, or may not close it at all. How is it solved?

By cycling and increasing MaxSpread. How to change its value is the question.

 
Artyom Trishkin:

or it may not close at all

That's why I asked, sometimes it doesn't close at takei, just at the level of the spread, it will wiggle back and forth

the only thing i can suggest is that if i move the order frequently by modifying it, it may trigger sometime


but if we use an opposite pending order and close it throughOrderCloseBy() when the pending order opens - slippage will be on both orders? .... the only thing is to leave at least a minimum lot in the market, otherwise OrderCloseBy() will not work (this seems to be how OrderCloseBy works, no one has mentioned it for ages)

 
fxsaber:

By cycling and increasing MaxSpread. How to change its value is the question.

By one point per cycle.

 
Igor Makanu:

That's why I asked, sometimes it won't close at takei, just at the level of spread, it will wiggle back and forth

the only thing i can suggest is that if i move the order frequently by modifying it, it may trigger sometime


but if we use an opposite pending order and close it throughOrderCloseBy() when the pending order opens - slippage will be on both orders? .... the only thing is to leave at least a minimum lot in the market, otherwise OrderCloseBy() will not work (this seems to be how OrderCloseBy works, no one has mentioned it for ages)

The opposite limit order - the same Take. A stop order is a stop. What is the difference then?

On the exchange, there is an aggressive stop-limit - you can put it inside the spread or at the current or worst price. There is no such thing in forex.

 
Igor Makanu:

That's why I asked, sometimes it doesn't close at takei, just at the level of the spread, it will wiggle back and forth

the only thing i can suggest is that if i move the order frequently by modifying it, it may trigger sometime


but if we use an opposite pending order and close it throughOrderCloseBy() when the pending order opens - slippage will be on both orders? .... the only thing is to leave at least minimal lot in the market, otherwise OrderCloseBy() will not work (this seems to be how OrderCloseBy works, no one has mentioned it for ages)

A CloseBy-order works so that the position with the larger volume of the two counter-orders remains in the market.