Profit factor:
0.48
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
11 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.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%
EUR/USD Jul 2025 - Sep 2025
0.17
Total Trades 14
Won Trades 6
Lost trades 8
Win Rate 42.86 %
Expected payoff -117.56
Gross Profit 337.82
Gross Loss -1983.62
Total Net Profit -1645.80
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.08
Total Trades 10
Won Trades 4
Lost trades 6
Win Rate 40.00 %
Expected payoff -172.50
Gross Profit 148.00
Gross Loss -1872.99
Total Net Profit -1724.99
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
1.06
Total Trades 54
Won Trades 27
Lost trades 27
Win Rate 50.00 %
Expected payoff 2.86
Gross Profit 2937.04
Gross Loss -2782.47
Total Net Profit 154.57
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
0.55
Total Trades 10
Won Trades 5
Lost trades 5
Win Rate 50.00 %
Expected payoff -64.51
Gross Profit 779.21
Gross Loss -1424.28
Total Net Profit -645.07
-100%
-50%
0%
50%
100%

Comments