| Please update this CloseAll function into two Functions. | 
									
                                             
                    						
                                          
                                          
                                          
                                       
                                             Hi,
Please update the CloseAll function with two functions.
The two new function are:
1) ClosePositive() // This function would close all open trades that are in positive.
2) CloseNegative() // This function would close all open trades that are in negative.
Thanks
void CloseAll(int ot=-1)
{
bool cl=1;
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderType()==0 && (ot==0 || ot==-1))
{
RefreshRates();
cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,_Digits),Slip,White);
}
if(OrderType()==1 && (ot==1 || ot==-1))
{
RefreshRates();
cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,_Digits),Slip,White);
}
}
}
}
}
                                          
                                          
                                          
                                              
                                             - 
                                          		+1
 
                                                                                          - Просмотров: 1589
 
                                             - 21 апреля 2023, 17:45
 
                                                                                          - chomper
 
                                          
Понравилcя материал? Не забудьте поставить плюс и поделиться в социальной сети!
 
                                        
                                       
                                    
Комментарии (5)
на 24-е
35 AM2 Сообщений: 16665 - Андрей
35 AM2 Сообщений: 16665 - Андрей
16 chomper Автор Сообщений: 64
35 AM2 Сообщений: 16665 - Андрей
16 chomper Автор Сообщений: 64
Зарегистрируйтесь или авторизуйтесь, чтобы оставить комментарий