fxsol平台 发表于 2011-11-24 08:19:01

请教:此加仓写法有何不对?

初学编程,写了一段加仓的代码,但是运行时发现,加仓正常,不正常的是,只要没有单子,必开一买单。而卖出和卖出的加仓都正常。
看了很久看不出是哪里出错了,请各位高手给予指点,谢谢!

void openorders() {
if(lastopensellprice - Bid > Pips*gi_176*Point) {
    OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, Bid + ST* Point * gi_176, Bid - TP * gi_176 * Point, \"\", magic, 0, Green);
}

if(Ask - lastopenbuyprice > Pips*gi_176*Point) {
    OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, Ask - ST* Point * gi_176, Ask + TP * gi_176 * Point, \"\", magic, 0, Black);
}
}

void countorders() {
l_count_0 = 0;
l_count_1 = 0;
lastopenbuyprice = 0;
lastopensellprice = 0;
for(int i = 0;i < OrdersTotal();i++) {
   OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
   if(OrderSymbol() == Symbol() && OrderMagicNumber() == magic) {
       if(OrderType() == OP_BUY) {
         l_count_0++;
         lastopenbuyprice = OrderOpenPrice();
         }
       if(OrderType() == OP_SELL) {
         l_count_1++;
         lastopensellprice = OrderOpenPrice();
      }
      }
    }
}

q826418559 发表于 2012-11-22 00:02:14

i love you

where 发表于 2012-11-22 01:12:18

不错,看看。

nothing 发表于 2012-11-22 01:12:18

加油啊!!!!顶哦!!!!!

lramr 发表于 2012-11-22 02:18:00

支持一下吧

wax87etz 发表于 2012-11-22 02:18:00

不错,看看。

music 发表于 2012-11-22 02:18:00

回帖是种美德.

悟空小宝 发表于 2012-11-22 02:18:00

晕不信啊

天道无名 发表于 2012-11-22 02:18:00

楼主good

他们 发表于 2012-11-22 02:18:00

不错的东西持续关注
页: [1] 2 3
查看完整版本: 请教:此加仓写法有何不对?