Edit Your Comment
need help reqoute problem
forex_trader_8864
Mar 18, 2010 부터 멤버
게시물127
Jul 28, 2011 at 10:49
Mar 18, 2010 부터 멤버
게시물127
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
Mar 18, 2010 부터 멤버
게시물127
Jul 28, 2011 at 10:52
(편집됨 Jul 28, 2011 at 10:54)
Mar 18, 2010 부터 멤버
게시물127
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_8864
Mar 18, 2010 부터 멤버
게시물127
Jul 28, 2011 at 13:03
Mar 18, 2010 부터 멤버
게시물127
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);
*상업적 사용 및 스팸은 허용되지 않으며 계정이 해지될 수 있습니다.
팁: 이미지/유튜브 URL을 게시하면 게시물에 자동으로 삽입됩니다!
팁: @기호를 입력하여 이 토론에 참여하는 사용자 이름을 자동으로 완성합니다.