我正试图弄清楚如何在买入后立即开出卖单,这是行不通的。谁能说出为什么无法打开?
if (LongSetup == True)
{
int OrderOpenBuy = OrderSend(Symbol(),
OP_BUY,
BuyLotsToTrade,
Ask,
10,
Ask-100*Point(),
Ask+100*Point(),
"Buy Order",
MagicNo,
0,
clrAzure);
int PositionIndex; //
int TotalNumberOfOrders = OrdersTotal();
bool OrderClosed = false;
// close the buy order
for(PositionIndex=TotalNumberOfOrders-1; PositionIndex>0; PositionIndex -- )
{
if ( !OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES) ) continue;
if ( OrderMagicNumber() == MagicNo
&& OrderSymbol() == Symbol()
&& (OrderType() == OP_BUY
|| OrderType() == OP_SELL));
{
OrderClosed = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 0, clrNONE);
if(OrderClosed == true)
{
//open sell order
int OrderOpenSell = OrderSend (Symbol(),
OP_SELL,
SellLotToTrade,
Bid,
10,
Bid+100*Point(),
Bid-100*Point(),
"Sell Order",
0,
0,
clrRosyBrown);
}
}
}
}
还有更多我应该做的事情,或者我想念的是什么?