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--; } } } } } Quote
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 + Quote
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(); } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.