Profit factor:
0.46
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedChecks for the total of closed orders
Indicators Used
DeMarker indicator
Miscellaneous
It sends emails
15 Views
0 Downloads
0 Favorites
MoneyRain
//+------------------------------------------------------------------+
//|                                                    MoneyRain.mq4 |
//|                               Copyright © 2008, Yury V. Reshetov |
//|                               http://bigforex.biz/load/2-1-0-172 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Yury V. Reshetov http://bigforex.biz/load/2-1-0-172"
#property link      "http://bigforex.biz/load/2-1-0-172"

//---- input parameters
extern int       p = 10;
extern double    tp = 50;
extern double    sl = 50;
extern double    lots = 1;
extern int       losseslimit = 1000000;
extern bool      fastoptimize = true;
extern int       mn = 888;
static int       prevtime = 0;
static int       losses = 0;


//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   if (Time[0] == prevtime) return(0);
   prevtime = Time[0];
   
   if (! IsTradeAllowed()) {
      prevtime = Time[1];
      MathSrand(TimeCurrent());
      Sleep(30000 + MathRand());
   }
//----
   int total = OrdersTotal();
   for (int i = 0; i < total; i++) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == mn) {
         return(0);
      } 
   }
   
   int ticket = -1;
   
   double lt = getLots();
   if (losses >= losseslimit) {
      SendMail(WindowExpertName() + " Too many losses", "Chart " + Symbol());
      return(0);
   }
   
   if (iDeMarker(Symbol(), 0, p, 0) > 0.5) {
      RefreshRates();
      ticket = OrderSend(Symbol(), OP_BUY, lt, Ask, 1, Bid - sl * Point, Bid + tp * Point, WindowExpertName(), mn, 0, Blue); 
      if (ticket < 0) {
         Sleep(30000);
         prevtime = Time[1];
      }
   } else {
      ticket = OrderSend(Symbol(), OP_SELL, lt, Bid, 1, Ask + sl * Point, Ask - tp * Point, WindowExpertName(), mn, 0, Red); 
      RefreshRates();
      if (ticket < 0) {
         Sleep(30000);
         prevtime = Time[1];
      }
   }
//-- Exit --
   return(0);
}
//+--------------------------- getLots ----------------------------------+

double getLots() {

   if (IsOptimization() && fastoptimize) {
      return(lots);
   }
  
   losses = 0;
   int profits = 0;
   double lossesvolume = 0;
   double minlot = MarketInfo(Symbol(), MODE_MINLOT);
   int round = MathAbs(MathLog(minlot) / MathLog(10.0)) + 0.5;
   double result = lots;
   int total = OrdersHistoryTotal();
   double spread = MarketInfo(Symbol(), MODE_SPREAD);
   for (int i = 0; i < total; i++) {
      OrderSelect(i, SELECT_BY_POS, MODE_HISTORY);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == mn) {
         if (OrderProfit() > 0) {
            if (lossesvolume > 0.5 && profits < 1) {
               result = lots * lossesvolume * (sl + spread) / (tp - spread);
            } else {
               result = lots;
            }
            losses = 0;
            if (profits > 1) {
               lossesvolume = 0;
            }
            profits++;
         } else {
            result = lots;
            losses++;
            lossesvolume = lossesvolume + OrderLots() / lots;
            profits = 0;
         }
      }
   }
   result = NormalizeDouble(result, round);
   double maxlot = MarketInfo(Symbol(), MODE_MAXLOT);
   if (result > maxlot) {
      result = maxlot;
   }
   if (result < minlot) {
      mn = mn + 1;
   }
   RefreshRates();
   return(result);
}


Profitability Reports

GBP/USD Jul 2025 - Sep 2025
0.44
Total Trades 22
Won Trades 13
Lost trades 9
Win Rate 59.09 %
Expected payoff -29.44
Gross Profit 515.20
Gross Loss -1162.85
Total Net Profit -647.65
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.00
Total Trades 94
Won Trades 0
Lost trades 94
Win Rate 0.00 %
Expected payoff -102.68
Gross Profit 0.00
Gross Loss -9651.74
Total Net Profit -9651.74
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.53
Total Trades 14
Won Trades 7
Lost trades 7
Win Rate 50.00 %
Expected payoff -42.65
Gross Profit 676.90
Gross Loss -1274.00
Total Net Profit -597.10
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.47
Total Trades 36
Won Trades 15
Lost trades 21
Win Rate 41.67 %
Expected payoff -57.66
Gross Profit 1806.87
Gross Loss -3882.46
Total Net Profit -2075.59
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.66
Total Trades 40
Won Trades 23
Lost trades 17
Win Rate 57.50 %
Expected payoff -17.98
Gross Profit 1376.72
Gross Loss -2095.84
Total Net Profit -719.12
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.56
Total Trades 18
Won Trades 10
Lost trades 8
Win Rate 55.56 %
Expected payoff -33.82
Gross Profit 759.72
Gross Loss -1368.44
Total Net Profit -608.72
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.00
Total Trades 67
Won Trades 0
Lost trades 67
Win Rate 0.00 %
Expected payoff -146.93
Gross Profit 0.00
Gross Loss -9844.00
Total Net Profit -9844.00
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.54
Total Trades 15
Won Trades 10
Lost trades 5
Win Rate 66.67 %
Expected payoff -20.74
Gross Profit 370.00
Gross Loss -681.03
Total Net Profit -311.03
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.06
Total Trades 6
Won Trades 3
Lost trades 3
Win Rate 50.00 %
Expected payoff -79.33
Gross Profit 30.37
Gross Loss -506.32
Total Net Profit -475.95
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.02
Total Trades 5
Won Trades 1
Lost trades 4
Win Rate 20.00 %
Expected payoff -48.76
Gross Profit 3.95
Gross Loss -247.74
Total Net Profit -243.79
-100%
-50%
0%
50%
100%

Comments