Can any One Help, I need a Function that can close Profit with Lose Trades

 

Hello coders :)

I am seeking help :) PLEASE , I am using a Grid EA , 

I need To solve this situation :

I have 100 Buy Open Order (30 Profit and 70 Order in Lose) and I have 50 Sell Order Sell all of them is in Profit 

the Total Profit for the 30 Buy Order is 300 USD

the Total Profit for the 50 Sell Order is 1000 USD

I need To have 2 separate function can do the following :

Function 1

I need a Function where By EA will close all sell Position (1000 USD profit )  then and starts from the highest Buy Order in loss and start to Close them One which equals the 1000 USD or less

Function 2

I need a Function where By EA will close Profit buy Position (300 USD profit )  then and starts from the highest Buy Order in loss and start to Close them One which equals the 300 USD or less


I found already some functions that can close lose Profit vs Lose positions in pairs , the Problem that this function mostly use Partial close to match profit and lose also , I can't select from the oldest orders

the function i need is to close Bulk Orders vs Bulk Orders  

 

I really appreciate if anyone can Help 

Important Note : Please if you have any kind of negative comment Please Keep it to yourself :) 

 

 
Ahmed Tawfik:

Hello coders :)

I am seeking help :) PLEASE , I am using a Grid EA , 

I need To solve this situation :

I have 100 Buy Open Order (30 Profit and 70 Order in Lose) and I have 50 Sell Order Sell all of them is in Profit 

the Total Profit for the 30 Buy Order is 300 USD

the Total Profit for the 50 Sell Order is 1000 USD

I need To have 2 separate function can do the following :

Function 1

I need a Function where By EA will close all sell Position (1000 USD profit )  then and starts from the highest Buy Order in loss and start to Close them One which equals the 1000 USD or less

Function 2

I need a Function where By EA will close Profit buy Position (300 USD profit )  then and starts from the highest Buy Order in loss and start to Close them One which equals the 300 USD or less


I found already some functions that can close lose Profit vs Lose positions in pairs , the Problem that this function mostly use Partial close to match profit and lose also , I can't select from the oldest orders

the function i need is to close Bulk Orders vs Bulk Orders  

 

I really appreciate if anyone can Help 

Important Note : Please if you have any kind of negative comment Please Keep it to yourself :) 

 

Take a look at the Freelance section, it's awesome if you want something done

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • www.mql5.com
Add one indicator to HedgeWoel EA Robot to buy and trade when symbol shows. May select to buy more then one time if same symbol shows before opposite comes. Buy Sell trades close at first opposite symbol. Make two MA's filter trading, if selected in EA: when one MA is over other, only Buy trades. Sell trades only when smaller is under larger MA...
 
Dears , I need Some Help Here 
 
Ahmed Tawfik:
Dears , I need Some Help Here 

Hi, I don't think you will get help here for free. Regards Greg