Orders Execution
Miscellaneous
0
Views
0
Downloads
0
Favorites
Profit_Loss_Final
//+------------------------------------------------------------------+
//| Ïðèáûëü è óáûòîê.mq4 |
//| VadimVP |
//| poluyan@fxmail.ru |
//| |
//| Ñêðèïò ïîêàæåò êàêîâà áóäåò âàøà ïðèáûëü èëè óáûòîê |
//| åñëè ñðàáîòàþò âñå TakeProfit èëè StopLoss íà îòêðûòûõ |
//| â äàííûé ìîìåíò îðäåðàõ (ñóììàðíî ïî âñåì èíñòðóìåíòàì) |
//| |
//|  ðàñ÷åòå ó÷àñòâóþò òîëüêî òå îðäåðà, ó êîòîðûõ óðîâíè |
//| TakeProfit è(èëè) StopLoss çàäàíû (íå ðàâíû íóëþ). |
//| |
//| èíôîðìàöèÿ âûâîäèòüñÿ â äèàëîãîâîì îêíå (Alert) |
//+------------------------------------------------------------------+
#property copyright "VadimVP"
#property link "poluyan@fxmail.ru"
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int i=0;
double lots=0;
int kollots=0;
double sums=0;
double sump=0;
int ks=0;
int kp=0;
int nets=0;
int netp=0;
for(i=0; i<OrdersTotal(); i++)
{
if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;kollots=kollots+1;if(OrderStopLoss()<=0) nets=nets+1; if(OrderTakeProfit()<=0) netp=netp+1;
if((OrderType()==OP_BUY) && (OrderStopLoss()>0)){ ks=ks+1;sums=sums+(OrderLots()*(((OrderOpenPrice()-OrderStopLoss())/MarketInfo(OrderSymbol(),11))*MarketInfo(OrderSymbol(),16)));}
if((OrderType()==OP_BUY)&&(OrderTakeProfit()>0)){kp=kp+1; sump=sump+(OrderLots()*(((OrderTakeProfit()-OrderOpenPrice())/MarketInfo(OrderSymbol(),11))*MarketInfo(OrderSymbol(),16)));}
if((OrderType()==OP_SELL) && (OrderStopLoss()>0)){ks=ks+1;sums=sums+(OrderLots()*(((OrderStopLoss()-OrderOpenPrice())/MarketInfo(OrderSymbol(),11))*MarketInfo(OrderSymbol(),16)));}
if((OrderType()==OP_SELL)&&(OrderTakeProfit()>0)){kp=kp+1;sump=sump+(OrderLots()*(((OrderOpenPrice()-OrderTakeProfit())/MarketInfo(OrderSymbol(),11))*MarketInfo(OrderSymbol(),16)));}
if((OrderType()==OP_BUY)){lots=lots+OrderLots();}
if((OrderType()==OP_SELL)){lots=lots-OrderLots();}
}
string msg1="Âîçìîæåí óáûòîê: "+ DoubleToStr(sums,2)+" "+AccountCurrency() + " ( "+ DoubleToStr((100*sums/AccountBalance()),1) +"%ÄÅÏÎ ), èëè ïðèáûëü: "+DoubleToStr(sump,2)+" "+AccountCurrency()+" ( "+ DoubleToStr((100*sump/AccountBalance()),1) +"%ÄÅÏÎ)";
string msg2="Îðäåðà ñ óñòàíîâëåííûì StopLoss: "+ ks+" øòóê (èç "+kollots+" )";
string msg3="Îðäåðà ñ óñòàíîâëåííûì TakeProfit: "+ kp +" øòóê (èç "+kollots+" )";
string msg4="Îáùèé (ñóììàðíûé) ëîò: "+ DoubleToStr(lots,2);
string msg5="Âíèìàíèå! Íå óñòàíîâëåí StopLoss ó "+ nets+" îðäåðîâ!!!";
string msg6="Âíèìàíèå! Íå óñòàíîâëåí TakeProfit ó "+ netp+" îðäåðîâ!!!";string msg7="Êîëè÷åñòâî îòêðûòûõ îðäåðîâ: "+ kollots+" øòóê";
Alert("**********************************************************");
Alert(msg2);
Alert(msg3);
if(nets>0) Alert(msg5);
if(netp>0) Alert(msg6);
Alert(msg7);
Alert(msg4);
Alert(msg1);
return(0);
}
//the end **********************************************************************************************************************************
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---