Universum_3.0

Profit factor:
0.49
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
Universum_3.0
//+------------------------------------------------------------------+
//|                                                 Universum_v3.mq4 |
//|                               Copyright © 2008, Yury V. Reshetov |
//|                               http://bigforex.biz/load/2-1-0-170 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Yury V. Reshetov http://bigforex.biz/load/2-1-0-170"
#property link      "http://bigforex.biz/load/2-1-0-170"

//---- 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;
   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);
   double k = (tp + sl) / (tp - spread);
   for (int i = 0; i < total; i++) {
      OrderSelect(i, SELECT_BY_POS, MODE_HISTORY);
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == mn) {
         if (OrderProfit() > 0) {
            result = lots;
            losses = 0;
         } else {
            result = result * k;
            losses++;
         }
      }
   }
   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/CAD Oct 2024 - Jan 2025
0.41
Total Trades 24
Won Trades 16
Lost trades 8
Win Rate 66.67 %
Expected payoff -40.11
Gross Profit 682.35
Gross Loss -1644.94
Total Net Profit -962.59
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.59
Total Trades 40
Won Trades 23
Lost trades 17
Win Rate 57.50 %
Expected payoff -37.32
Gross Profit 2132.90
Gross Loss -3625.70
Total Net Profit -1492.80
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.56
Total Trades 28
Won Trades 15
Lost trades 13
Win Rate 53.57 %
Expected payoff -49.34
Gross Profit 1733.08
Gross Loss -3114.72
Total Net Profit -1381.64
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.40
Total Trades 23
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -61.69
Gross Profit 939.80
Gross Loss -2358.72
Total Net Profit -1418.92
-100%
-50%
0%
50%
100%

Comments