我正在尝试修改订单,但我一直在修改订单时出错!,错误#130。我正在使用 ECN 经纪商,因此我需要修改订单以设置止损/止盈。我做错了什么?
int digits = MarketInfo( Symbol(), MODE_DIGITS );
if ( digits == 2 || digits == 3 ) pipdigits = 0.01;
else if ( digits == 4 || digits == 5 ) pipdigits = 0.0001;
selltakeprofit = Ask + ( takeprofit * pipdigits );
sellstoploss = Ask - ( stoploss * pipdigits );
ticket = OrderSend( Symbol(), OP_SELL, lotsize, Ask, 100, 0, 0, 0, 0, 0, CLR_NONE );
if ( ticket < 0 )
{
Print( "venda Order send failed with error #", GetLastError() );
Print( "stop loss = ", sellstoploss );
}
else
{
Print( "Order send sucesso!!" );
Print( "Balance = ", AccountBalance() );
Print( "Equity = ", AccountEquity() );
bool res = OrderModify( ticket, 0, sellstoploss, selltakeprofit, 0 );
if ( res == false )
{
Print( "Error modifying order!, error#", GetLastError() );
Print( "sellstoploss ", sellstoploss );
Print( "selltakeprofit ", selltakeprofit );
Print( "StopLevel ", StopLevel );
Print( "Ask ", Ask );
}
else
{
Print( "Order modified successfully" );
}
}