inpossibilium nulla obligatio est

Author: Huisman84Copyright � 2006, MetaQuotes Software Corp.
Profit factor:
0.64
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt Closes Orders by itself
Indicators Used
Moving average indicator
9 Views
0 Downloads
0 Favorites
inpossibilium nulla obligatio est
//+------------------------------------------------------------------+
//|                                          supreme 1st version.mq4 |
//|             Huisman84Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Huisman84Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

extern double Prots = 20;
extern double StopLoss = 800;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
  double MAFcurrent, MAFprevious;
  double MAScurrent, MASprevious;
  double Lots;
  int cnt, ticket, total;
  
//----
  if (Bars<100)
    {
   Print("bars less than 100");
   return(0);
    }
  
//----
   MAFcurrent=iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,0);
   MAFprevious=iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,1);
   MAScurrent=iMA(NULL,0,25,0,MODE_SMA,PRICE_CLOSE,0);
   MASprevious=iMA(NULL,0,25,0,MODE_SMA,PRICE_CLOSE,1);
   Lots = 0.5;

   
   total=OrdersTotal();
   if(total<1) 
     {
      // no opened orders identified
      if(AccountFreeMargin()<(1000*Lots))
        {
         Print("We have no money. Free Margin = ", AccountFreeMargin());
         return(0);  
        }
      // check for long position (BUY) possibility  
      if(MAFcurrent>MAScurrent && MAFprevious<MASprevious)
        {
         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,0,"supreme",16384,0,Green);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
           }
         else Print("orderSend failed with error #", GetLastError());
         return(0);
        }
      // check for short position (SELL) possibility
      if(MAFcurrent<MAScurrent && MAFprevious>MASprevious)
        {
         ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,0,"supreme",16384,0,Red);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
           }
         else Print("orderSend failed with error #", GetLastError());
         return(0);
        }
      return(0);
     }  // exit market correctly...
       for(cnt=0;cnt<total;cnt++)
         {
          OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
          if(OrderType()<=OP_SELL &&   // check for opened position 
             OrderSymbol()==Symbol())  // check for symbol
            {
             if(OrderType()==OP_BUY)   // long position is opened
               {
                // should it be closed?  
                if(MAFcurrent<MAScurrent && MAFprevious>MASprevious)
                    {
                     OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position
                     return(0); // exit
                    }
               }
              else // go to short position
               {
                  // should it be closed?
                if(MAFcurrent>MAScurrent && MAFprevious<MASprevious)
                  {
                   OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position
                   return(0); // exit
                  }
               }
            }         
         }         
       return(0);
  }




Profitability Reports

GBP/USD Jul 2025 - Sep 2025
1.20
Total Trades 176
Won Trades 48
Lost trades 128
Win Rate 27.27 %
Expected payoff 8.45
Gross Profit 8861.00
Gross Loss -7374.50
Total Net Profit 1486.50
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
1.02
Total Trades 145
Won Trades 48
Lost trades 97
Win Rate 33.10 %
Expected payoff 1.08
Gross Profit 8019.96
Gross Loss -7864.08
Total Net Profit 155.88
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.95
Total Trades 139
Won Trades 41
Lost trades 98
Win Rate 29.50 %
Expected payoff -1.64
Gross Profit 4291.00
Gross Loss -4518.50
Total Net Profit -227.50
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.73
Total Trades 82
Won Trades 27
Lost trades 55
Win Rate 32.93 %
Expected payoff -12.75
Gross Profit 2816.00
Gross Loss -3861.50
Total Net Profit -1045.50
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.66
Total Trades 161
Won Trades 40
Lost trades 121
Win Rate 24.84 %
Expected payoff -17.19
Gross Profit 5363.88
Gross Loss -8131.57
Total Net Profit -2767.69
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.61
Total Trades 87
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -20.70
Gross Profit 2843.50
Gross Loss -4644.00
Total Net Profit -1800.50
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.60
Total Trades 168
Won Trades 41
Lost trades 127
Win Rate 24.40 %
Expected payoff -14.73
Gross Profit 3771.00
Gross Loss -6246.00
Total Net Profit -2475.00
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.60
Total Trades 165
Won Trades 35
Lost trades 130
Win Rate 21.21 %
Expected payoff -21.78
Gross Profit 5338.41
Gross Loss -8931.51
Total Net Profit -3593.10
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.60
Total Trades 154
Won Trades 42
Lost trades 112
Win Rate 27.27 %
Expected payoff -13.05
Gross Profit 3016.79
Gross Loss -5026.69
Total Net Profit -2009.90
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.56
Total Trades 94
Won Trades 23
Lost trades 71
Win Rate 24.47 %
Expected payoff -41.61
Gross Profit 5072.50
Gross Loss -8984.00
Total Net Profit -3911.50
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.48
Total Trades 89
Won Trades 25
Lost trades 64
Win Rate 28.09 %
Expected payoff -29.40
Gross Profit 2447.29
Gross Loss -5064.31
Total Net Profit -2617.02
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.30
Total Trades 164
Won Trades 27
Lost trades 137
Win Rate 16.46 %
Expected payoff -58.26
Gross Profit 4000.31
Gross Loss -13554.38
Total Net Profit -9554.07
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.04
Total Trades 42
Won Trades 6
Lost trades 36
Win Rate 14.29 %
Expected payoff -230.92
Gross Profit 436.50
Gross Loss -10135.00
Total Net Profit -9698.50
-100%
-50%
0%
50%
100%

Comments