Orders selecting by magic number(code piece only)

MQL5 Experts Integration

Job finished

Execution time 5 hours
Feedback from customer
10/10 . Very fast programing,great english. Good programer and even more good person, very helpfull. Recomend to everybody !
Feedback from employee
Very helpful and good communication.

Specification

Hello,

ok so my EA is working perfect but only when its operating alone. What i need is to indentify the trades made by every EA using unique magic number becouse there is no other way. So i need the peace of code with all the needed doubles if you use ones.. sorry i cannot give you my code to work on. My ea opening trades in standart way by using magic number in ordersend and before that i put it in tickets ofcourse, like in example bellow. The EA is going to work with diferend parameters in diferend pairs. The most important for me is "close all" function wich now uses all the trades wich is in acc wich is not good. i use equity stop by indentifying when to close the trades.i put some example also to better explain. So i need if conditions are happen for closing i need to do it by selecting only trades the ones that this EA made, but not as it is now (while orders is > 0) .


extern double MagicNumber=132;
int ticket;




if(x > x && ok == true && x == 0)                                        
    {
      ticket = OrderSend(Symbol(),OP_BUY, Lot,Ask,Slippage,0,0," buy",MagicNumber,0,Blue);
      OrderModify(ticket,OrderOpenPrice(),Ask-StopLoss*Point*platform_digital,Ask+TakeProfit*Point*platform_digital,0);//Modify it!
    }

{
    
if(x < x && ok == true && x == 0)                 
    {                          
      ticket = OrderSend(Symbol(),OP_SELL,Lot,Bid,Slippage,0,0," sell",MagicNumber,0,Red);
      OrderModify(ticket,OrderOpenPrice(),Bid+StopLoss*Point*platform_digital,Bid-TakeProfit*Point*platform_digital,0);//Modify it!
    }  
   }
  }
 }
} 


if(AccountEquity() >= EquityStop) // CLOSE !!!
{
while(OrdersTotal()>0)
{
OrderSelect(0,SELECT_BY_POS);
if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),999,Red);
if(OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),999,Orange);
if(OrderType()==OP_BUYSTOP||OrderType()==OP_SELLSTOP||OrderType()==OP_BUYLIMIT||OrderType()==OP_SELLLIMIT) OrderDelete(OrderTicket());



}
 }


One more thing, i put the ordersmax protection using very primityve algorythm, so i need fix for that also. i think it would be best to count the orders using ticket but i am not sure if the int ticket will not be the sum of all the ea runing becouse all of them have the same code. The problem is that if i limit one order per bar, and using on multiple charts and they need to open at the same time it couses the problem, other EA's will not enter becouse of restriction :


//OrderMax protection

extern double MaxOpenOrders = 1;
double o = OrdersTotal();

{
if(o >= MaxOpenOrders)
ok = false;

if(o == 0 &&  AccountEquity() <= EquityStop)   // to turn it on again if the profit has been reached with 1 order and all is closed allready
ok = true;

}


Anybody can help me?

please take this job and give me your skype, i will contact you if you really can do this.

Responded

1
Developer 1
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
2
Developer 2
Rating
(82)
Projects
150
29%
Arbitration
9
44% / 11%
Overdue
46
31%
Free
3
Developer 3
Rating
(63)
Projects
80
28%
Arbitration
17
12% / 76%
Overdue
48
60%
Free
4
Developer 4
Rating
(564)
Projects
844
73%
Arbitration
15
53% / 13%
Overdue
193
23%
Working
5
Developer 5
Rating
(73)
Projects
257
53%
Arbitration
16
50% / 38%
Overdue
83
32%
Free
6
Developer 6
Rating
(164)
Projects
218
50%
Arbitration
6
17% / 67%
Overdue
11
5%
Free

Project information

Budget
10 - 20 USD
Deadline
from 1 to 8 day(s)