Profit factor:
0.45
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

USD/JPY Jul 2025 - Sep 2025
0.29
Total Trades 25
Won Trades 13
Lost trades 12
Win Rate 52.00 %
Expected payoff -70.11
Gross Profit 728.69
Gross Loss -2481.48
Total Net Profit -1752.79
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.38
Total Trades 10
Won Trades 7
Lost trades 3
Win Rate 70.00 %
Expected payoff -47.28
Gross Profit 284.03
Gross Loss -756.86
Total Net Profit -472.83
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.05
Total Trades 9
Won Trades 2
Lost trades 7
Win Rate 22.22 %
Expected payoff -96.13
Gross Profit 44.11
Gross Loss -909.25
Total Net Profit -865.14
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.78
Total Trades 54
Won Trades 26
Lost trades 28
Win Rate 48.15 %
Expected payoff -20.71
Gross Profit 3905.55
Gross Loss -5024.04
Total Net Profit -1118.49
-100%
-50%
0%
50%
100%
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%

Comments