I need a code base for orders management

MQL5 Asesores Expertos Sripts

Tarea técnica

Dears Sirs,

I need a code base for orders management and, that it has a counter of how many orders have opened in the buy mode and how many orders have opened in the sell mode. I’ll put an example as if it were operating in the WDO, however can be any asset or currency.

I will explain here taking into account that the EA works with buying in two moving average. It buys in the fast and also in the slow moving average when the fast moving average is above the slow one and sells in the fast and also in the slow moving average when the fast moving average is below the slow one.

Below is the related to the order management that I need, the values ​​just only to exemplify.

He always enter  with 3 contracts and makes 3 different partial exits (PE). The PE1 with 5 points, PE2 with 10 points and the finally PE3 with 35 point. The stop with 10 points and the break even  when does the PE2 in any position.

Let us assume then that the dollar hit the fast moving average and has an executed  buy in 3280. It already puts sell orders PE1 in 3285, the PE2 in 3290 and PE3 in 3315 and places a SELL STOP of the 3 contracts in 3270. Then the dollar goes up a bit and goes to 3287 That is, already took the PE1. So EA has to cancel the old SELL STOP 3 contracts and put another SELL STOP 2 contracts in the same 3270. And the counter of open orders, shows that there is 1 buy order.

Then the dollar back and fall and enters the slow moving average slow with a purchase of 3 contracts in 3275. So will put a PE1 in 3280, PE2 in 3285 and PE3 in 3310. So let's say the dollar rises enough and goes up to 3300 . Now the counter open orders shows 2 purchases.

With the dollar in 3300, the first purchase would have done two PE and triggered the break even. Soon one would be left SELL STOP 1 contract in 3280 and RP3 1 contract in 3315. The second purchase also would have done two PE and triggered the Break Even. Soon one would be left SELL STOP 1 contract in 3275 and PE3,  1 contract in 3310.

Let's say now that the dollar is the middle side (laterally)  and after a while it drop slightly and the moving average reversed. Now the slow moving average is down the fast one.  And yet there are 2 open SELL STOP and also the two PE3. And with that, the dollar goes up a bit and hits the fast moving average and  gives a sale in 3300. At that time the EA sell 3 contracts and put the PE1 in 3295, the PE2 in 3290 and PE3 in 3265, and BUY STOP 3 contracts in 3310. Now the counter open orders shows 2 purchases and 1 sale.

That is, the trades are made and controlled independently. It can be bought and give sells or unlike each open trade and has to be independently controlled. There will not have STOP, or TAKE PROFIT. The stop will be controlled through SELL orders or BUY STOP how many contracts have open trade and that the TAKE PROFIT will be controlled through SELL and BUY LIMIT orders. And the open orders counter only decreases when that open trade is reset, either by achieving the 3 PE or  hit the SELL or BUY STOP.

Regardless of being buy or sell, the EA has to treat each trade as one.

Han respondido

1
Desarrollador 1
Evaluación
(2463)
Proyectos
3101
66%
Arbitraje
77
48% / 14%
Caducado
340
11%
Libre

Información sobre el proyecto

Presupuesto