Close All Open Order of ONE currency Pairs
5 replies
Truong Cao Xuan
5 years ago #238327
Can someone please help me with a custome function to do that:
IF: Total TP in money of all OPEN orders for ONE currency pairs > 0
THEN: Close all OPEN order for that currency pairs
Thanks!
coensio
5 years ago #238328
Are you behind some firewall without access to google.com ? 🙂
Just make two loops through your open orders and then:
In loop1() function:
if(OrderSymbol()==Symbol())
TotalSymbolProfit=OrderProfit()+OrderSwap()+OrderCommission();
After first loop1() check if total profit is >0 then call loop2().
if(TotalSymbolProfit>0) loop2();
in loop2() function:
if(OrderSymbol()==Symbol())
OrderClose(OrderTicket(),OrderLots(),etc…);
Gr
Chris
This is a false statement.
tomas262
5 years ago #238343
Hello,
also the built-in Open P/L function can be used to obtain P/L for all order in a specific currency. Just set magic = 0
Let us know if you need some more help with the custom function
Truong Cao Xuan
5 years ago #239188
Truong Cao Xuan
5 years ago #239189
Hello, also the built-in Open P/L function can be used to obtain P/L for all order in a specific currency. Just set magic = 0 Let us know if you need some more help with the custom function
So, I often open trading with 2 -3 currency pair at same time
Open P/L function If set magic =0 it will return sum of open P/L for all active orders NOT FOR ONE CURRENCY PAIR.
tomas262
5 years ago #239199
Viewing 5 replies - 1 through 5 (of 5 total)