Orders Execution
Checks for the total of open ordersIt Closes Orders by itself
Miscellaneous
It plays sound alertsIt issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
Close_v1

void start(){
double WinPrice=WindowPriceOnDropped();
if(WinPrice==0){all();return;}
PlaySound("tick.wav");
bool a = false;
double s=9999999;
int Ticket; 
double b = AccountBalance();
for(int i=0;i<OrdersTotal();i++)
{//+-----------------------------------------------------------------------------------------+for
 OrderSelect(i,SELECT_BY_POS);
 if(OrderSymbol()!= Symbol())continue;
 a=true;
 double OpPr = OrderOpenPrice();
 double r = MathAbs(WinPrice-OpPr);
 if(i==0){s=r;Ticket=OrderTicket();continue;}
 if(r<s){s=r;Ticket=OrderTicket();}
}//+----------------------------------------------------------------------------------------+for 
 if(a==false){Alert("Íåò îðäåðîâ");return;}
 OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES);
 double Lots = OrderLots();
 double Price;
 if(OrderType()==1)Price=NormalizeDouble(Ask,Digits);else Price=NormalizeDouble(Bid,Digits); 
//+-----------------------------------------------------------------------------------------+
 if(OrderType()<2)OrderClose(Ticket,Lots,Price,3);else OrderDelete(Ticket);
//+-----------------------------------------------------------------------------------------+
 int error = GetLastError();
 if(error==0&&a==true){Alert("PROFIT :   ",AccountBalance()-b);return;}
 if(error==6){Alert("Íåò ñâÿçè");return;}
 if(error==132){Alert("Ðûíîê çàêðûò");return;}
 if(error!=0){Alert("Îøèáêà  "+error);return;}
 PlaySound("ok.wav");
 return;}
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ+
 void all(){
PlaySound("tick.wav");
bool s = false;
double b = AccountBalance();
int i;
for(;i<OrdersTotal();i++)
{//+-----------------------------------------------------------------------------------------+for
 OrderSelect(i,SELECT_BY_POS);
 if(OrderSymbol()!= Symbol())continue;
 s=true;
 int Ticket = OrderTicket();
 double Lots = OrderLots();
 double Price;
 if(OrderType()==1)Price=NormalizeDouble(Ask,Digits);else Price=NormalizeDouble(Bid,Digits); 
//+-------------------------------------------------------------------------------------------+
 if(OrderType()<2)OrderClose(Ticket,Lots,Price,3);else OrderDelete(Ticket);
//+-------------------------------------------------------------------------------------------+
  if(GetLastError()==6){Alert("Íåò ñâÿçè");return;}
  if(GetLastError()==132){Alert("Ðûíîê çàêðûò");return;}
  RefreshRates();
  i--;
 }//+----------------------------------------------------------------------------------------+for
 if(s)Alert("PROFIT :   ",AccountBalance()-b);else Alert("Íåò îðäåðîâ");
 PlaySound("ok.wav");
 return;}
 //ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---