if(getAllProfit()>10){//平仓代码};//盈利金额大于10USD平仓
- double getAllProfit()
- {
- double allNum=0;
- for(int i=0; i<OrdersTotal(); i++)
- {
- if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)
- break;
- if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGICMA)
- {
- allNum+= OrderProfit() + OrderCommission() + OrderSwap();
- }
-
- }
- return allNum;
- }
复制代码
|