Orders Execution
Miscellaneous
0
Views
0
Downloads
0
Favorites
Profitability Reports
GBP/CAD
Oct 2024 - Jan 2025
0.00 %
Total Trades
0
Won Trades
0
Lost trades
0
Win Rate
0.0 %
Expected payoff
0.00
Gross Profit
0.00
Gross Loss
0.00
Total Net Profit
0.00
-100%
-50%
0%
50%
100%
GBP/USD
Oct 2024 - Jan 2025
0.00 %
Total Trades
0
Won Trades
0
Lost trades
0
Win Rate
0.0 %
Expected payoff
0.00
Gross Profit
0.00
Gross Loss
0.00
Total Net Profit
0.00
-100%
-50%
0%
50%
100%
_KeelOver
//+------------------------------------------------------------------+
//| _KeelOver.mq4 |
//| "ÑÊÐÈÏÒÛ ÄËß ËÅÍÈÂÎÃÎ" |
//| ÏÅÐÅÂÎÐÎÒ: Ñêðèïò çàêðûâàåò âñå îòêðûòûå ïîçèöèè |
//| è îòêðûâàåò îäíó íà ðàçíèöó ñóìì ëîòîâ Buy è Sell |
//| ÂÍÈÌÀÍÈÅ: åñëè ñóììû ëîòîâ Buy è Sell ðàâíû - âñå |
//| ïîçèöèè ïðîñòî áóäóò çàêðûòû |
//| Bookkeeper, 2006, yuzefovich@gmail.com |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
#property show_inputs // Åñëè åñòü æåëàíèå ìåíÿòü ýêñòåðíû â ïðîöåññå
//----
extern int DistSL = 35; // StopLoss â ïóíêòàõ
extern int DistTP = 35; // TakeProfit â ïóíêòàõ
extern int Slippage = 7; // Ïðîñêàëüçûâàíèå
extern bool StopLoss = true; // Ñòàâèòü èëè íåò
extern bool TakeProfit = true; // Ñòàâèòü èëè íåò
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void start()
{
int Total, i, Pos, ticket, MinLotDgts;
bool Result;
double MinLot = MarketInfo(Symbol(), MODE_MINLOT);
double SL = 0, TP = 0, Stake, BuyLots = 0, SellLots = 0;
Total = OrdersTotal();
if(Total > 0) // Åñëè åñòü îðäåðà
{
for(i = Total - 1; i >= 0; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == true)
{
Pos = OrderType();
Stake = OrderLots();
if((OrderSymbol() == Symbol()) &&
(Pos == OP_BUY || Pos == OP_SELL)) // Ñìîòðèì òîëüêî îòêðûòûå Buy è Sell
{ // â àêòèâíîì îêíå
if(Pos == OP_BUY)
{
BuyLots = BuyLots + Stake; // Ñóììèðóåì Ëîòû îòêðûòûõ Buy
Result = OrderClose(OrderTicket(), OrderLots(), Bid , Slippage);
if(Result != true)
Alert("KeelOver: CloseBuyError = ", GetLastError());
}
else
{
SellLots = SellLots + Stake; // Ñóììèðóåì Ëîòû îòêðûòûõ Sell
Result = OrderClose(OrderTicket(), OrderLots(), Ask , Slippage);
if(Result != true)
Alert("KeelOver: CloseSellError = ", GetLastError());
}
}
}
}
if(MinLot < 0.1)
MinLotDgts = 2;
else
{
if(MinLot < 1.0)
MinLotDgts = 1;
else
MinLotDgts = 0;
}
Stake = NormalizeDouble(BuyLots - SellLots, MinLotDgts);
if(Stake != 0) // Åñëè åñòü ÷òî ïåðåâîðà÷èâàòü
{
if(Stake > 0) // ïðîäàæåé
{
RefreshRates();
if(StopLoss == true)
SL = NormalizeDouble(Ask + DistSL*Point, Digits);
if(TakeProfit == true)
TP = NormalizeDouble(Bid - 2*DistTP*Point, Digits);
ticket = OrderSend(Symbol(), OP_SELL, Stake, Bid , Slippage, SL, TP, "");
if(ticket <= 0)
Alert("KeelOver: OpenSellError: ", GetLastError());
}
else // ïîêóïêîé
{
Stake = -Stake;
RefreshRates();
if(StopLoss == true)
SL = NormalizeDouble(Bid - DistSL*Point, Digits);
if(TakeProfit == true)
TP = NormalizeDouble(Ask + 2*DistTP*Point, Digits);
ticket = OrderSend(Symbol(), OP_BUY, Stake, Ask , Slippage, SL, TP, "");
if(ticket <= 0)
Alert("KeelOver: OpenBuyError: ", GetLastError());
}
}
else
Alert("KeelOver: BuyLots = SellLots");
}
return;
}
//+------------------------------------------------------------------+
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
---