Need help for Hedge EA with 2 MagicNumbers

 

Hi guys,

I need your coding help. I want to open a hedge by open 4 postions at same time:

MagicNumber_1: buy EURUSD and sell USDCHF ß(Hedgepair 1)

and at the same time

MagicNumber_2: sell EURUSD and buy USDCHF ß(Hedgepair 2)

Now I want to close each Hedgepair when the profit of a Hedgepair reaches a defined takeprofit.

Please check the attached EAs. I need the code of the CloseSpecificMagicNo EA for both MagicNumbers in the OpenHedge EA.

Who can help?

Best regards.

 
jimbofx7:

Hi guys,

I need your coding help. I want to open a hedge by open 4 postions at same time:

MagicNumber_1: buy EURUSD and sell USDCHF ß(Hedgepair 1)

and at the same time

MagicNumber_2: sell EURUSD and buy USDCHF ß(Hedgepair 2)

Now I want to close each Hedgepair when the profit of a Hedgepair reaches a defined takeprofit.

Please check the attached EAs. I need the code of the CloseSpecificMagicNo EA for both MagicNumbers in the OpenHedge EA.

Who can help?

Best regards.


something like this? Send me the proceeds of your best trade over the next month!
 
serpentsnoir:

something like this? Send me the proceeds of your best trade over the next month!

Hi serpentsnoir,

many thanks. But I think the EA only check the profit of one magic number pair:

"...

extern int MagicNumber=1000;

..."



"...

if(OrderMagicNumber()==MagicNumber) dblProfit=dblProfit+OrderProfit();

..."


But I want to check the profit of each magic number pair. Do you know what I mean?


Kind regards,

 

ah, i think i see... looking forward to that big payback! Let me know if this hits the spot.

 
serpentsnoir:

ah, i think i see... looking forward to that big payback! Let me know if this hits the spot.

Hi serpentsnoir,

if two pairs with same Magic No. close in Profit these pairs where not open again because of


int start()
{
if(OrdersTotal()>0)
{
startLookingForProfits(MagicNumber_1);
startLookingForProfits(MagicNumber_2);
}
else
startLookingForTrades();


How can I let the closed pairs open again if trade condition are given?


Kind regards


Reason: