Edit Your Comment
need help reqoute problem
forex_trader_8864
Tham gia từ Mar 18, 2010
127bài viết
Jul 28, 2011 at 10:49
Tham gia từ Mar 18, 2010
127bài viết
int start()
{
PipTarget=(AccountBalance())*(TargetPercent/100);
if (AccountProfit()>= PipTarget)
{
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
int type = OrderType();
bool result = false;
switch(type)
{
//Close opened long positions
case OP_BUY : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 99, Red );
break;
//Close opened short positions
case OP_SELL : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 99, Red );
break;
//Close pending orders
case OP_BUYLIMIT :
case OP_BUYSTOP :
case OP_SELLLIMIT :
case OP_SELLSTOP : result = OrderDelete( OrderTicket() );
}
if(result == false)
{
Alert('Order ' , OrderTicket() , ' failed to close. Error:' , GetLastError() );
Sleep(3000);
}
}
return(0);
{
PipTarget=(AccountBalance())*(TargetPercent/100);
if (AccountProfit()>= PipTarget)
{
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
int type = OrderType();
bool result = false;
switch(type)
{
//Close opened long positions
case OP_BUY : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 99, Red );
break;
//Close opened short positions
case OP_SELL : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 99, Red );
break;
//Close pending orders
case OP_BUYLIMIT :
case OP_BUYSTOP :
case OP_SELLLIMIT :
case OP_SELLSTOP : result = OrderDelete( OrderTicket() );
}
if(result == false)
{
Alert('Order ' , OrderTicket() , ' failed to close. Error:' , GetLastError() );
Sleep(3000);
}
}
return(0);
forex_trader_8864
Tham gia từ Mar 18, 2010
127bài viết
Jul 28, 2011 at 10:52
(đã sửa Jul 28, 2011 at 10:54)
Tham gia từ Mar 18, 2010
127bài viết
hi everyone. i need a little help here. what additional code or line should i add in case of requotes so that all trades would really close. thanks in advance.
ii hope someone would edit the code above so i wont get error 138 and have all trades close.
ii hope someone would edit the code above so i wont get error 138 and have all trades close.
forex_trader_36599
Tham gia từ May 13, 2011
1341bài viết
Jul 28, 2011 at 11:32
Tham gia từ May 13, 2011
1341bài viết
hı
use 'whıle' statement for loopıng ın close order wıth checkıng 'ıf' 'result' handle 'false'
thıs wıll solve your ıssue
regards
use 'whıle' statement for loopıng ın close order wıth checkıng 'ıf' 'result' handle 'false'
thıs wıll solve your ıssue
regards
forex_trader_8864
Tham gia từ Mar 18, 2010
127bài viết
Jul 28, 2011 at 13:03
Tham gia từ Mar 18, 2010
127bài viết
if (AccountProfit()>= PipTarget)
{
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
int type = OrderType();
bool result = false;
while (result == false)
{
switch(type)
{
//Close opened long positions
case OP_BUY : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 99, Red );
break;
//Close opened short positions
case OP_SELL : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 99, Red );
break;
//Close pending orders
case OP_BUYLIMIT :
case OP_BUYSTOP :
case OP_SELLLIMIT :
case OP_SELLSTOP : result = OrderDelete( OrderTicket() );
}
}
}
return(0);
{
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
int type = OrderType();
bool result = false;
while (result == false)
{
switch(type)
{
//Close opened long positions
case OP_BUY : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 99, Red );
break;
//Close opened short positions
case OP_SELL : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 99, Red );
break;
//Close pending orders
case OP_BUYLIMIT :
case OP_BUYSTOP :
case OP_SELLLIMIT :
case OP_SELLSTOP : result = OrderDelete( OrderTicket() );
}
}
}
return(0);
forex_trader_8864
Tham gia từ Mar 18, 2010
127bài viết
Jul 28, 2011 at 13:04
Tham gia từ Mar 18, 2010
127bài viết
hi steve
will the above code solve the re-quote issue?
will the above code solve the re-quote issue?
forex_trader_36599
Tham gia từ May 13, 2011
1341bài viết
Jul 28, 2011 at 13:05
Tham gia từ May 13, 2011
1341bài viết
that should work
ıt wıll loop untıl 'result' ıs true
ıt wıll loop untıl 'result' ıs true
forex_trader_36599
Tham gia từ May 13, 2011
1341bài viết
Jul 28, 2011 at 13:07
Tham gia từ May 13, 2011
1341bài viết
ıf you have anyother ıssues drop me messege
forex_trader_8864
Tham gia từ Mar 18, 2010
127bài viết
forex_trader_36599
Tham gia từ May 13, 2011
1341bài viết
*Nghiêm cấm sử dụng cho mục đích thương mại và spam, nếu vi phạm có thể dẫn đến việc chấm dứt tài khoản.
Mẹo: Đăng ảnh/url youtube sẽ tự động được nhúng vào bài viết của bạn!
Mẹo: Dùng @ để tự động điền tên người dùng tham gia vào cuộc thảo luận này.