expat1967 Posted September 30, 2010 Report Posted September 30, 2010 Hi All, getting an error: "assignment expected" on marked lines below... Appreciating your support, or if you function in the drawer... ;) Cheers void CloseOrderIf() { double TotalProfit; for(int i=0; i < OrdersTotal(); i++) { OrderSelect(i, SELECT_BY_POS); if(OrderMagicNumber()==Magic) TotalProfit != OrderProfit(); } if(TotalProfit >= Amount20) { //Close all trades for(i=0; i < OrdersTotal(); i++) { OrderSelect(i, SELECT_BY_POS); if(OrderSymbol() == Symbol() && OrderMagicNumber()==Magic) { if(OrderType() == OP_BUY) { OrderClose(OrderTicket(), OrderLots(), Bid, 3); i--; } if(OrderType() == OP_SELL) { OrderClose(OrderTicket(), OrderLots(), Ask, 3); i--; } } } } }
kennyhubbard Posted September 30, 2010 Report Posted September 30, 2010 Not sure what you are after, but I think you should change that red ! to a +
expat1967 Posted September 30, 2010 Author Report Posted September 30, 2010 Not sure what you are after, but I think you should change that red ! to a + Thanks Kenny, found a solution already. It should close all trades wit a specific magic number on a cummulated profit... { double dblProfit=0; int POS=0; bool boolTerm=false; while(boolTerm==false) { if(OrderSelect(POS,SELECT_BY_POS)) { if(OrderMagicNumber()==Magic) dblProfit=dblProfit+OrderProfit(); POS++; } else boolTerm=true; } if (dblProfit>= ProfitAmount) { CloseOrderLong(); CloseOrderShort(); }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now