|
if(Profit()>账户净值达到多少金额全部平仓)
{
buystate=false;
sellstate=false;
ObjectSetString(0,"@买",OBJPROP_TEXT,"禁止买单");
ObjectSetString(0,"@卖",OBJPROP_TEXT,"禁止卖单");
closeall();
}
}
double Profit()
{
double a=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==魔术号)
{
a=a+OrderProfit()+OrderCommission()+OrderSwap();
}
}
}
return(a);
} |
|