Profit factor:
0.81
Orders Execution
Checks for the total of open orders
8 Views
0 Downloads
0 Favorites
NailLong
//+------------------------------------------------------------------+
//|                                                        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  20081723

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

//ïîäñ÷åò òåêóùåãî êîëè÷åñòâà îòêðûòûõ ïîçèöèé íà ïîêóïêó
int CalcNumLongs()
{
   int nLongs = 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_BUY) nLongs++;
   }
   return (nLongs);
}

//ïîïûòêà îòêðûòü íîâûé îðäåð
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_BUY) {                                      
         found = true; //...íàøëè ïîñëåäíèé îòêðûòûé îðäåð íà ïîêóïêó     
         break;
      }
   }
    
   if (!found) {
      Print ("Îøèáêà: íå ñìîãëè íàéòè îæèäàåìîãî îòêðûòîãî îðäåðà íà ïîêóïêó: ", GetLastError()); 
      return;   
   }
        
   //åñëè óáûòîê ïðåâûøàåò çíà÷åíèå ïåðåìåííîé OpenT, îòêðûâàåì îðäåð íà ïîêóïêó
   if (OrderProfit() <= OpenT) {      
      double Min = Close[ArrayMinimum(Close, N_MaxBar, 1)]; 
      Print (Bid, " ", Min - Delta * Point);
      res = OrderSend (Symbol(), OP_BUY, Lot, Ask, 3, Min - Delta * Point, Ask + TakeProfit * Point, "", MAGICNUM, 0, Blue);
      if (res == 0) {         
         Print ("Îøèáêà îòêðûòèÿ îðäåðà íà ïîêóïêó: ",GetLastError()); 
         return;
      }        
   }        
}

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

Profitability Reports

USD/CAD Oct 2024 - Jan 2025
3.06
Total Trades 46
Won Trades 41
Lost trades 5
Win Rate 89.13 %
Expected payoff 16.76
Gross Profit 1145.06
Gross Loss -374.22
Total Net Profit 770.84
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
1.40
Total Trades 75
Won Trades 59
Lost trades 16
Win Rate 78.67 %
Expected payoff 8.97
Gross Profit 2346.10
Gross Loss -1673.10
Total Net Profit 673.00
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
1.37
Total Trades 22
Won Trades 18
Lost trades 4
Win Rate 81.82 %
Expected payoff 6.04
Gross Profit 494.83
Gross Loss -361.95
Total Net Profit 132.88
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
1.31
Total Trades 243
Won Trades 157
Lost trades 86
Win Rate 64.61 %
Expected payoff 6.11
Gross Profit 6250.80
Gross Loss -4765.70
Total Net Profit 1485.10
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
1.28
Total Trades 25
Won Trades 19
Lost trades 6
Win Rate 76.00 %
Expected payoff 4.76
Gross Profit 551.89
Gross Loss -432.77
Total Net Profit 119.12
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
1.20
Total Trades 117
Won Trades 73
Lost trades 44
Win Rate 62.39 %
Expected payoff 2.85
Gross Profit 1978.20
Gross Loss -1645.09
Total Net Profit 333.11
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
1.08
Total Trades 33
Won Trades 24
Lost trades 9
Win Rate 72.73 %
Expected payoff 2.71
Gross Profit 1164.75
Gross Loss -1075.32
Total Net Profit 89.43
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
1.04
Total Trades 129
Won Trades 71
Lost trades 58
Win Rate 55.04 %
Expected payoff 0.52
Gross Profit 1924.38
Gross Loss -1856.97
Total Net Profit 67.41
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
1.03
Total Trades 36
Won Trades 26
Lost trades 10
Win Rate 72.22 %
Expected payoff 1.11
Gross Profit 1248.50
Gross Loss -1208.41
Total Net Profit 40.09
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.92
Total Trades 21
Won Trades 14
Lost trades 7
Win Rate 66.67 %
Expected payoff -2.27
Gross Profit 560.00
Gross Loss -607.60
Total Net Profit -47.60
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.91
Total Trades 60
Won Trades 41
Lost trades 19
Win Rate 68.33 %
Expected payoff -2.02
Gross Profit 1163.30
Gross Loss -1284.69
Total Net Profit -121.39
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.89
Total Trades 435
Won Trades 301
Lost trades 134
Win Rate 69.20 %
Expected payoff -2.38
Gross Profit 8022.53
Gross Loss -9059.84
Total Net Profit -1037.31
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
0.87
Total Trades 240
Won Trades 158
Lost trades 82
Win Rate 65.83 %
Expected payoff -2.74
Gross Profit 4565.42
Gross Loss -5222.01
Total Net Profit -656.59
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.84
Total Trades 22
Won Trades 15
Lost trades 7
Win Rate 68.18 %
Expected payoff -4.99
Gross Profit 562.90
Gross Loss -672.70
Total Net Profit -109.80
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.77
Total Trades 82
Won Trades 50
Lost trades 32
Win Rate 60.98 %
Expected payoff -4.85
Gross Profit 1299.80
Gross Loss -1697.65
Total Net Profit -397.85
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.76
Total Trades 85
Won Trades 57
Lost trades 28
Win Rate 67.06 %
Expected payoff -5.71
Gross Profit 1504.65
Gross Loss -1990.38
Total Net Profit -485.73
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.75
Total Trades 73
Won Trades 46
Lost trades 27
Win Rate 63.01 %
Expected payoff -8.09
Gross Profit 1808.40
Gross Loss -2398.70
Total Net Profit -590.30
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.74
Total Trades 67
Won Trades 43
Lost trades 24
Win Rate 64.18 %
Expected payoff -9.14
Gross Profit 1720.00
Gross Loss -2332.60
Total Net Profit -612.60
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
0.72
Total Trades 340
Won Trades 228
Lost trades 112
Win Rate 67.06 %
Expected payoff -7.00
Gross Profit 6171.11
Gross Loss -8550.46
Total Net Profit -2379.35
-100%
-50%
0%
50%
100%
USD/CAD Jan 2025 - Jul 2025
0.67
Total Trades 205
Won Trades 100
Lost trades 105
Win Rate 48.78 %
Expected payoff -6.61
Gross Profit 2811.14
Gross Loss -4167.11
Total Net Profit -1355.97
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.64
Total Trades 23
Won Trades 14
Lost trades 9
Win Rate 60.87 %
Expected payoff -13.69
Gross Profit 560.00
Gross Loss -874.80
Total Net Profit -314.80
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.63
Total Trades 54
Won Trades 34
Lost trades 20
Win Rate 62.96 %
Expected payoff -10.45
Gross Profit 971.37
Gross Loss -1535.71
Total Net Profit -564.34
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.62
Total Trades 23
Won Trades 14
Lost trades 9
Win Rate 60.87 %
Expected payoff -14.93
Gross Profit 560.00
Gross Loss -903.50
Total Net Profit -343.50
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
0.59
Total Trades 147
Won Trades 90
Lost trades 57
Win Rate 61.22 %
Expected payoff -20.33
Gross Profit 4248.70
Gross Loss -7237.26
Total Net Profit -2988.56
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.34
Total Trades 88
Won Trades 43
Lost trades 45
Win Rate 48.86 %
Expected payoff -38.40
Gross Profit 1720.00
Gross Loss -5099.60
Total Net Profit -3379.60
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.27
Total Trades 32
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -40.12
Gross Profit 480.00
Gross Loss -1763.80
Total Net Profit -1283.80
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.21
Total Trades 24
Won Trades 8
Lost trades 16
Win Rate 33.33 %
Expected payoff -50.57
Gross Profit 320.00
Gross Loss -1533.60
Total Net Profit -1213.60
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
0.03
Total Trades 69
Won Trades 50
Lost trades 19
Win Rate 72.46 %
Expected payoff -824.96
Gross Profit 2000.00
Gross Loss -58921.90
Total Net Profit -56921.90
-100%
-50%
0%
50%
100%
EUR/USD Jan 2025 - Jul 2025
0.02
Total Trades 51
Won Trades 38
Lost trades 13
Win Rate 74.51 %
Expected payoff -1867.56
Gross Profit 1520.00
Gross Loss -96765.80
Total Net Profit -95245.80
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 7
Won Trades 6
Lost trades 1
Win Rate 85.71 %
Expected payoff -15037.60
Gross Profit 240.00
Gross Loss -105503.20
Total Net Profit -105263.20
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 7
Won Trades 5
Lost trades 2
Win Rate 71.43 %
Expected payoff -15055.96
Gross Profit 200.00
Gross Loss -105591.70
Total Net Profit -105391.70
-100%
-50%
0%
50%
100%

Comments