mt4函数今日盈亏统计mq4代码
double 今日盈亏()
{
double profit = 0;
int i,hstTotal=OrdersHistoryTotal();
for(i=0;i<hstTotal;i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==TRUE)
{
if(OrderType()>1) continue;
if(TimeToStr(TimeCurrent(),TIME_DATE) == TimeToStr(OrderCloseTime(),TIME_DATE))
{
profit += OrderProfit() + OrderSwap() + OrderCommission();
}
}
}
return(profit);
}