第一次发帖。发一段统计空单利润的函数
- double Function_BuyPos_Profits()
- {
- double buypos_profits = 0;
- for(int i = 0; i < OrdersTotal(); i++)
- {
- if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == true)
- {
- if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicMA)
- {
- if(OrderType() == OP_BUY)
- {
- buypos_profits += OrderProfit() + OrderCommission() + OrderSwap();
- }
- }
- }
- }
- return(buypos_profits);
- }
复制代码
|