How do I close all orders at total profit in pips?

 
Could someone please advise how to close all orders at a total profit in pips?
 
khasan kayumov:
Can someone please tell me how to close all orders at total profit in pips?

Orders can only be deleted.

 

How do I calculate profit in pips?

Before you delete
 
Evgeny Belyaev:

Orders can only be deleted.


In MT4 they can be closed as there are not only pending orders but also market orders )) In MT5 orders are pending and market orders are position.

 
khasan kayumov:

How do I calculate profit in pips?

Before deleting

Select each order and calculate the OrderProfit() + OrderSwap() + OrderCommision(). The obtained amount should be compared to the specified target in the deposit currency.

 
Ihor Herasko:

In MT4 you can close them as there are not only pending but also market orders )) In MT5 orders are pending and market orders are position.


So the market if I trade through MT4 is different from MT5?

Order(fr.ordre- order, order, fromlat.ordo- row, order) - an instruction, an order.

Position- thelocation of something

Французский язык — Википедия
Французский язык — Википедия
  • ru.wikipedia.org
Самоназвание: Официальный статус: Регулирующая организация: Общее число говорящих: Рейтинг: Статус: Классификация Категория: Письменность: Языковые коды ГОСТ 7.75–97: ISO 639-1: ISO 639-2: ISO 639-3: Код IETF: Один из шести официальных и рабочих языков ООН. Французский язык является официальным языком большого числа...
 
Evgeny Belyaev:

So the market if I trade through MT4 is different from the MT5 market?

Order(fr.ordre- order, order, fromlat.ordo- row, order) - an instruction, an order.

It is not the market that is different, only the terminology. Before the launch of MT5, there were only orders, market and pending orders in MT4. With the introduction of MT5, the terms were divided into an order/order, then a deal - order execution and as a result of a deal an existing position in the market...

 
Alexey Viktorov:

Before the launch of MT5 in MT4 there were only orders, market orders and pending orders.

I trade on the market, not on MT, MT is just an application where the names of the functions are not correctly defined. Position - buy, sell, defender, striker.

Order - order to place, buy, sell, defender, striker, midfielder...

Deal...

 
Evgeny Belyaev:

I trade on the market, not on MT, MT is just an application which does not correctly define the name of the functions. Position - buy, set, defender, striker...

Order - order to place, buy, sell, defender, striker, midfielder...

Deal...


then trade and don't talk.

 
Dmitry Fedoseev:

then trade and don't talk.


Oh, yeah?

I place an order and it is rejected by the server, I get error 130.

What do I do when there is no position and nothing to close? I can only delete. What should I do or I am doing something wrong?

 
khasan kayumov:
Please advise how to close all orders at the total profit in pips?

Need a global variable, let it be called CloseAll.

1. If CloseAll=false, then loop through all orders and sum up their profit in the auxiliary variable.

2. Compare the calculated profit with the set value, if it is more or equal, we set CloseAll=true.

If CloseAll=true - close all orders, if closing is successful, set CloseAll=false. If there were errors, then CloseAll=true, on the next tick we will close again.

Reason: