Profit factor:
0.51
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
6 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/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%
USD/CAD Jan 2025 - Jul 2025
1.67
Total Trades 75
Won Trades 43
Lost trades 32
Win Rate 57.33 %
Expected payoff 31.75
Gross Profit 5930.13
Gross Loss -3548.66
Total Net Profit 2381.47
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
0.89
Total Trades 63
Won Trades 35
Lost trades 28
Win Rate 55.56 %
Expected payoff -8.48
Gross Profit 4454.68
Gross Loss -4988.94
Total Net Profit -534.26
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
0.02
Total Trades 7
Won Trades 2
Lost trades 5
Win Rate 28.57 %
Expected payoff -250.71
Gross Profit 30.00
Gross Loss -1785.00
Total Net Profit -1755.00
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
0.00
Total Trades 140
Won Trades 0
Lost trades 140
Win Rate 0.00 %
Expected payoff -68.75
Gross Profit 0.00
Gross Loss -9625.33
Total Net Profit -9625.33
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.02
Total Trades 4
Won Trades 1
Lost trades 3
Win Rate 25.00 %
Expected payoff -46.66
Gross Profit 3.34
Gross Loss -189.96
Total Net Profit -186.62
-100%
-50%
0%
50%
100%

Comments