Questions from a "dummy" - page 15

 
Yedelkin:
Additional question: is there any elegant way to save information when passing double <-> long?
Copying simple structures https://www.mql5.com/ru/docs/basis/types/casting#casting_structure
Документация по MQL5: Основы языка / Типы данных / Приведение типов
Документация по MQL5: Основы языка / Типы данных / Приведение типов
  • www.mql5.com
Основы языка / Типы данных / Приведение типов - Документация по MQL5
 
stringo:

All 64. In fact. Don't cling to a signed or unsigned type.

The best thing is to see for yourself. Then the question is closed once and for all.

Yes. I already wrote that I forgot about type conversion.

and already checked everything. The sign is not lost. everything is ok.

 
Oops! Same thing as the second example from Metadriver! ...That's how important the emphasis is on the seemingly already read.
 
sergeev:

Check PositionClose in the CTrade class.
I am sure it will be the same as yours. The only conclusion is that there is no other way.

But I support your request. I ask developers to consider this variant.

Add TRADE_ACTION_CLOSE operation type - closing of a position for a specified symbol in its volume at the current price.

That would be ideal! Seconded.

For the rest of the forum I will briefly outline the problem again.

With the existing system of accounting of deals/orders and closing methods in MQL5, there is always a non-zero probability that the SL/TP position closed from the market will not actually close, and the opposite position will be opened.

The closer the market is to the SL/TP position, the higher this probability is, making a close out of the market with a close SL/TP impossible (since a SL/TP close can occur during the sending of a new market order to close)

The existing solutions are not satisfactory

a) if we remove SL/TP before the order is closed, it first takes time and in case of a connection failure, the position will remain in the market without a stop, etc.

b) waiting for triggering of SL/TP is also not an option, because we might need to exit earlier.

I understand that the introduction of the new accounting system imposes certain restrictions, but when the usability of a product is totally sacrificed for the sake of the concept, the masses are unlikely to be interested in it :(

Dear developers, what do you advise to use for a GUARANTEED exit from the market (price is not important) ? When requesting to close in MQL4, I can be sure that the position will be closed, or the Expert Advisor will get an error code and will continue trying.

 
Yedelkin:

Done! In the cipher, replace line 14 with L.l = 4548887299649496524

............

Score! ;)

 
From the reference:
PositionClose
...
Примечание

Успешное окончание работы метода PositionClose(...)
не всегда означает успешное совершение торговой операции.
Необходимо проверять результат выполнения торгового запроса
(код возврата торгового сервера) вызовом метода ResultRetcode().

Fair warning.

***

No such warning could be found on manual position closing, but in Trading at the time of closing a counter ...

For a position to be guaranteed to close, will the slippage increase depending on volatility? Or what? Is it such a "hello to pip traders"?

I support the question to developers.

 

Silent, it's not about slippage and return code checking there.

The problem is that in order to close a position, you need to explicitly send a request to open a new position, but in the opposite direction.

The trade server sees this request exactly as an opening of a new position. It is not trained to understand that we actually want to close an existing position.

From the point of view of netting it is sort of correct, but then it is impossible to GUARANTEEDLY close a position with SL/TP from the market. No matter how far apart this SL/TP is, we cannot be sure that while we are preparing a new order (to close it) the price will catch our SL/TP and the position will close by itself. And our new order will work out and open an opposite position.

I believe the only way out, as sergeev suggested, is to teach the server to distinguish a request to open a new position from closing an existing one by implementing a new checkbox of"TRADE_ACTION_CLOSE" operation type.

But maybe the developers have their own variant?

 
Doesn't anyone have a solution?
 
Cron:
Doesn't anyone have a solution?
There are solutions, but they will hardly satisfy you... For example, to remove SL/TP and then according to the algorithm... You said it yourself:"From the netting point of view it seems correct, but then it is impossible to GUARANTEEDly close a position from the market...".
 
Yedelkin:
There are some solutions, but they do not suit you. For example, removing SL/TP and so on according to algorithm... You have stated yourself:"From netting point of view it seems correct, but then it is impossible to GUARANTEEDly close position from market...".

Yes, removing SL/TP is a waste of time plus the risk of being left in the market without a stop in case of connectivity problems.

I think, however, that"TRADE_ACTION_CLOSE" could be added for convenience of many users working in DC. [ And for example to disable this type of operation where netting is important? (FORTS, RTS)].

Without some steps towards user there is no sense for many clients of brokerage companies to switch to MT5. Having some experience in programming I still faced some difficulties when porting an EA from MQL4 to MQL5. But all of them were solved one way or another except this SL/TP problem and closing from the market.

I don't want to teach developers what they know better than me, but I want to mention that chasing a universal product for exchanges and brokerage companies to the detriment of userfriendly will lead to lower demand for the product and many people will stay on MT4 :(

Reason: