Profit factor:
1.94
Orders Execution
Checks for the total of open orders
6 Views
1 Downloads
0 Favorites
NailShort
//+------------------------------------------------------------------+
//|                                                        Gerat.mq4 |
//|                                      Copyright © 2009, Nail_Saby |
//|                                            http://gerat.ucoz.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, http://gerat.ucoz.ru/"
#property link      "gerat.ru@mailru"

#define MAGICNUM  20084379

extern double OpenT = -50;
extern double Lot = 0.1;
extern int    N_MaxBar = 10;
extern double TakeProfit = 400;
extern double Delta = 1000;

//ïîäñ÷åò òåêóùåãî êîëè÷åñòâà îòêðûòûõ ïîçèöèé íà ïðîäàæó
int CalcNumShorts()
{
   int nShorts = 0;
   for (int i = 0; i < OrdersTotal(); i++) {
      int res = OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if (res == 0) {
         Print ("Îøèáêà ïðè âûáîðå îðäåðà: ", GetLastError()); 
         return;
      }
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MAGICNUM 
            && OrderType() == OP_SELL) nShorts++;
   }
   return (nShorts);
}

//ïîïûòêà îòêðûòü íîâûé îðäåð
void CheckForOpen()
{  
   bool found = false;
   //ïîèñê ïîñëåäíåãî îòêðûòîãî îðäåðà íà ïðîäàæó   
   
   for (int i = OrdersTotal() - 1; i >= 0; i--) {
      int res = OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if (res == 0) {
         Print ("Îøèáêà ïðè âûáîðå îðäåðà: ", GetLastError()); 
         return;
      }
      if (OrderMagicNumber() == MAGICNUM && 
            OrderSymbol() == Symbol() && OrderType() == OP_SELL) {                                      
         found = true; //...íàøëè ïîñëåäíèé îòêðûòûé îðäåð íà ïðîäàæó      
         break;
      }
   }
    
   if (!found) {
      Print ("Îøèáêà: íå ñìîãëè íàéòè îæèäàåìîãî îòêðûòîãî îðäåðà íà ïðîäàæó: ", GetLastError()); 
      return;   
   }
        
   //åñëè óáûòîê ïðåâûøàåò çíà÷åíèå ïåðåìåííîé OpenT, îòêðûâàåì îðäåð íà ïðîäàæó
   if (OrderProfit() <= OpenT) {
      //Print (OrderProfit());
      double Max = Close[ArrayMaximum(Close, N_MaxBar, 1)]; 
      Print (Bid, " ", Max + Delta * Point);
      res = OrderSend (Symbol(), OP_SELL, Lot, Bid, 3, Max + Delta * Point, Bid - TakeProfit * Point, "", MAGICNUM, 0, Red);
      if (res == 0) {         
         Print ("Îøèáêà îòêðûòèÿ îðäåðà íà ïðîäàæó: ",GetLastError()); 
         return;
      }        
   }        
}

void start()
{
   //ïðîâåðêà íåîáõîäèìûõ óñëîâèé äëÿ òîðãîâëè
   if (Bars < N_MaxBar || IsTradeAllowed() == false) return;
   
   //åñëè íåò îòêðûòûõ ïîçèöèé, îòêðûâààåì ïîçèöèþ íà ïðîäàæó
   if (CalcNumShorts() == 0) {
      double Max = Close[ArrayMaximum(Close, N_MaxBar, 1)]; 
      Print (Bid, " ", Max + Delta * Point);
      int res = OrderSend (Symbol(), OP_SELL, Lot, Bid, 3, Max + Delta * Point, Bid - TakeProfit * Point, "", MAGICNUM, 0, Red);
      if (res == 0) {         
         Print ("Îøèáêà îòêðûòèÿ îðäåðà íà ïðîäàæó: ",GetLastError()); 
         return;
      }      
   }
   else CheckForOpen();
   return;
}

Profitability Reports

NZD/USD Oct 2024 - Jan 2025
27.24
Total Trades 24
Won Trades 23
Lost trades 1
Win Rate 95.83 %
Expected payoff 35.86
Gross Profit 893.40
Gross Loss -32.80
Total Net Profit 860.60
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
6.99
Total Trades 31
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 31.19
Gross Profit 1128.30
Gross Loss -161.40
Total Net Profit 966.90
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
1.69
Total Trades 169
Won Trades 114
Lost trades 55
Win Rate 67.46 %
Expected payoff 12.89
Gross Profit 5353.14
Gross Loss -3175.15
Total Net Profit 2177.99
-100%
-50%
0%
50%
100%
USD/CAD Jan 2025 - Jul 2025
1.32
Total Trades 143
Won Trades 110
Lost trades 33
Win Rate 76.92 %
Expected payoff 5.20
Gross Profit 3084.51
Gross Loss -2340.78
Total Net Profit 743.73
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
1.18
Total Trades 351
Won Trades 249
Lost trades 102
Win Rate 70.94 %
Expected payoff 2.98
Gross Profit 6721.61
Gross Loss -5676.56
Total Net Profit 1045.05
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
1.18
Total Trades 21
Won Trades 15
Lost trades 6
Win Rate 71.43 %
Expected payoff 4.42
Gross Profit 600.00
Gross Loss -507.10
Total Net Profit 92.90
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
1.17
Total Trades 81
Won Trades 60
Lost trades 21
Win Rate 74.07 %
Expected payoff 2.78
Gross Profit 1562.81
Gross Loss -1337.57
Total Net Profit 225.24
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
1.13
Total Trades 81
Won Trades 61
Lost trades 20
Win Rate 75.31 %
Expected payoff 2.23
Gross Profit 1610.23
Gross Loss -1429.42
Total Net Profit 180.81
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
1.10
Total Trades 79
Won Trades 59
Lost trades 20
Win Rate 74.68 %
Expected payoff 2.71
Gross Profit 2353.00
Gross Loss -2138.80
Total Net Profit 214.20
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
1.02
Total Trades 35
Won Trades 25
Lost trades 10
Win Rate 71.43 %
Expected payoff 0.72
Gross Profit 1213.24
Gross Loss -1187.90
Total Net Profit 25.34
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
1.00
Total Trades 33
Won Trades 23
Lost trades 10
Win Rate 69.70 %
Expected payoff -0.14
Gross Profit 1110.16
Gross Loss -1114.88
Total Net Profit -4.72
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.96
Total Trades 53
Won Trades 38
Lost trades 15
Win Rate 71.70 %
Expected payoff -0.75
Gross Profit 1079.21
Gross Loss -1119.01
Total Net Profit -39.80
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.95
Total Trades 73
Won Trades 48
Lost trades 25
Win Rate 65.75 %
Expected payoff -1.42
Gross Profit 1920.00
Gross Loss -2023.40
Total Net Profit -103.40
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.86
Total Trades 54
Won Trades 37
Lost trades 17
Win Rate 68.52 %
Expected payoff -3.22
Gross Profit 1056.86
Gross Loss -1230.47
Total Net Profit -173.61
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.82
Total Trades 101
Won Trades 66
Lost trades 35
Win Rate 65.35 %
Expected payoff -4.01
Gross Profit 1795.20
Gross Loss -2200.68
Total Net Profit -405.48
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.80
Total Trades 113
Won Trades 64
Lost trades 49
Win Rate 56.64 %
Expected payoff -3.84
Gross Profit 1715.04
Gross Loss -2148.41
Total Net Profit -433.37
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.79
Total Trades 84
Won Trades 47
Lost trades 37
Win Rate 55.95 %
Expected payoff -6.11
Gross Profit 1880.00
Gross Loss -2393.40
Total Net Profit -513.40
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.79
Total Trades 24
Won Trades 16
Lost trades 8
Win Rate 66.67 %
Expected payoff -7.06
Gross Profit 626.20
Gross Loss -795.60
Total Net Profit -169.40
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.77
Total Trades 25
Won Trades 17
Lost trades 8
Win Rate 68.00 %
Expected payoff -8.06
Gross Profit 657.10
Gross Loss -858.70
Total Net Profit -201.60
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
0.76
Total Trades 289
Won Trades 165
Lost trades 124
Win Rate 57.09 %
Expected payoff -5.28
Gross Profit 4761.01
Gross Loss -6286.44
Total Net Profit -1525.43
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.74
Total Trades 487
Won Trades 264
Lost trades 223
Win Rate 54.21 %
Expected payoff -4.95
Gross Profit 6913.86
Gross Loss -9323.57
Total Net Profit -2409.71
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
0.69
Total Trades 80
Won Trades 51
Lost trades 29
Win Rate 63.75 %
Expected payoff -11.68
Gross Profit 2040.00
Gross Loss -2974.10
Total Net Profit -934.10
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
0.67
Total Trades 206
Won Trades 131
Lost trades 75
Win Rate 63.59 %
Expected payoff -12.66
Gross Profit 5240.00
Gross Loss -7847.30
Total Net Profit -2607.30
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.59
Total Trades 24
Won Trades 15
Lost trades 9
Win Rate 62.50 %
Expected payoff -12.39
Gross Profit 437.00
Gross Loss -734.46
Total Net Profit -297.46
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
0.51
Total Trades 101
Won Trades 59
Lost trades 42
Win Rate 58.42 %
Expected payoff -22.48
Gross Profit 2360.00
Gross Loss -4630.00
Total Net Profit -2270.00
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.43
Total Trades 43
Won Trades 21
Lost trades 22
Win Rate 48.84 %
Expected payoff -18.09
Gross Profit 593.52
Gross Loss -1371.24
Total Net Profit -777.72
-100%
-50%
0%
50%
100%
EUR/USD Jan 2025 - Jul 2025
0.12
Total Trades 137
Won Trades 33
Lost trades 104
Win Rate 24.09 %
Expected payoff -72.79
Gross Profit 1320.00
Gross Loss -11292.10
Total Net Profit -9972.10
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.01
Total Trades 99
Won Trades 3
Lost trades 96
Win Rate 3.03 %
Expected payoff -101.10
Gross Profit 120.00
Gross Loss -10129.30
Total Net Profit -10009.30
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.01
Total Trades 98
Won Trades 3
Lost trades 95
Win Rate 3.06 %
Expected payoff -102.59
Gross Profit 120.00
Gross Loss -10173.60
Total Net Profit -10053.60
-100%
-50%
0%
50%
100%

Comments