Author: Alksnis Gatis
Profit factor:
0.37
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt Closes Orders by itself
Indicators Used
MACD Histogram
9 Views
0 Downloads
0 Favorites
AG
//+------------------------------------------------------------------+
//|                                                           AG.mq4 |
//|                                                    Alksnis Gatis |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Alksnis Gatis"
#property link      "http://www.metaquotes.net"

extern double     Lots=     1;
extern double     F_EMA=   15;
extern double     S_EMA=   18;
extern double     SMA=     30;
extern double     ORDER=   10;
extern int        chk=      0;
//+------------------------------------------------------------------+
//|          expert start making money - sometimes                   |
//+------------------------------------------------------------------+
int start()
  {
   int  ticket, total;
   double SAR,SA;
   SAR=iMACD(Symbol(),0,F_EMA,S_EMA,SMA,PRICE_WEIGHTED,MODE_MAIN,1);
   SA=iMACD(Symbol(),0,F_EMA,S_EMA,SMA,PRICE_WEIGHTED,MODE_SIGNAL,1);
   double SAR1,SA1;
   SAR1=iMACD(Symbol(),0,S_EMA*2,F_EMA*2,SMA*2,PRICE_WEIGHTED,MODE_MAIN,1);
   SA1=iMACD(Symbol(),0,S_EMA*2,F_EMA*2,SMA*2,PRICE_WEIGHTED,MODE_SIGNAL,1);
  
   
   total=OrdersTotal();
   if(total<ORDER)
     {
      if(AccountFreeMargin()<(1000*Lots))
        {
         Print("NO MONEY = ", AccountFreeMargin());
         return(0);
        }
     
        {
         chk=1;
         Print("OK OK OK OK OK!");
        }
      if(chk==1)
        {
//------------------ OPEN SEEL ---------------------//
      if((SAR<SA)&&(SA>0)&&(SAR1<SA1)&&(SA1>0))
           {
            ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,
            "SAR position:",16385,0,Red);
            if(ticket<1)
              {
               if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)==False)
                  Print("OPEN SELL ORDER :  ",OrderOpenPrice());
              }
            else
              {
               Print("-----ERROR-----  opening SEEL order : ",GetLastError());
               return(0);
              }
           }
//------------------ OPEN BUY ---------------------//
         if((SAR>SA)&&(SA<0)&&(SAR1>SA1)&&(SA1<0))
           {
            ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,
            "SAR position:",16385,0,Blue);
            if(ticket<1)
              {
               if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)==False)
                  Print("OPEN BUY ORDER ",OrderOpenPrice());
              }
            else
              {
               Print("-----ERROR-----  opening BUY order : ",GetLastError());
               return(0);
              }
           }
        }
      return(0);
     }
 //------------------ CLOSE BUY ---------------------//
     {
      OrderSelect(SELECT_BY_POS, MODE_TRADES);
         if(OrderType()==OP_BUY && OrderSymbol()==Symbol()) 
            if((SAR1<SA1)&&(SA>0))
              {
               OrderClose(OrderTicket(),OrderLots(),Bid,3,Black); // OUT
               return(0); 
 //------------------ CLOSE SELL --------------------//       
              }
        OrderSelect(SELECT_BY_POS, MODE_TRADES);
          if(OrderType()==OP_SELL && OrderSymbol()==Symbol())
           if((SAR1>SA1)&&(SA<0))
              {
               OrderClose(OrderTicket(),OrderLots(),Ask,3,White); // OUT
               return(0);
              }
           
           }
  return(0);
  }
//+-------------------- GAME OWER --------------------------------+

Profitability Reports

USD/CHF Jan 2025 - Jul 2025
1.40
Total Trades 164
Won Trades 67
Lost trades 97
Win Rate 40.85 %
Expected payoff 202.76
Gross Profit 116759.01
Gross Loss -83507.11
Total Net Profit 33251.90
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
1.28
Total Trades 190
Won Trades 85
Lost trades 105
Win Rate 44.74 %
Expected payoff 68.61
Gross Profit 59173.59
Gross Loss -46137.31
Total Net Profit 13036.28
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
1.24
Total Trades 96
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 90.52
Gross Profit 45031.00
Gross Loss -36341.00
Total Net Profit 8690.00
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
1.09
Total Trades 123
Won Trades 59
Lost trades 64
Win Rate 47.97 %
Expected payoff 15.88
Gross Profit 24743.00
Gross Loss -22790.00
Total Net Profit 1953.00
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
0.91
Total Trades 108
Won Trades 48
Lost trades 60
Win Rate 44.44 %
Expected payoff -57.89
Gross Profit 64393.00
Gross Loss -70645.00
Total Net Profit -6252.00
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.85
Total Trades 73
Won Trades 40
Lost trades 33
Win Rate 54.79 %
Expected payoff -85.64
Gross Profit 34474.85
Gross Loss -40726.42
Total Net Profit -6251.57
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.69
Total Trades 62
Won Trades 22
Lost trades 40
Win Rate 35.48 %
Expected payoff -125.04
Gross Profit 17105.17
Gross Loss -24857.90
Total Net Profit -7752.73
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.57
Total Trades 31
Won Trades 13
Lost trades 18
Win Rate 41.94 %
Expected payoff -213.77
Gross Profit 8700.00
Gross Loss -15327.02
Total Net Profit -6627.02
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.49
Total Trades 42
Won Trades 11
Lost trades 31
Win Rate 26.19 %
Expected payoff -196.64
Gross Profit 8059.00
Gross Loss -16318.00
Total Net Profit -8259.00
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
0.49
Total Trades 63
Won Trades 23
Lost trades 40
Win Rate 36.51 %
Expected payoff -131.03
Gross Profit 7876.00
Gross Loss -16131.00
Total Net Profit -8255.00
-100%
-50%
0%
50%
100%
EUR/USD Jan 2025 - Jul 2025
0.48
Total Trades 20
Won Trades 10
Lost trades 10
Win Rate 50.00 %
Expected payoff -337.90
Gross Profit 6183.00
Gross Loss -12941.00
Total Net Profit -6758.00
-100%
-50%
0%
50%
100%
USD/CAD Jan 2025 - Jul 2025
0.27
Total Trades 52
Won Trades 22
Lost trades 30
Win Rate 42.31 %
Expected payoff -144.24
Gross Profit 2723.12
Gross Loss -10223.49
Total Net Profit -7500.37
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.20
Total Trades 26
Won Trades 6
Lost trades 20
Win Rate 23.08 %
Expected payoff -288.72
Gross Profit 1825.23
Gross Loss -9331.94
Total Net Profit -7506.71
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
0.05
Total Trades 31
Won Trades 1
Lost trades 30
Win Rate 3.23 %
Expected payoff -297.90
Gross Profit 492.00
Gross Loss -9727.00
Total Net Profit -9235.00
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.04
Total Trades 10
Won Trades 1
Lost trades 9
Win Rate 10.00 %
Expected payoff -663.40
Gross Profit 294.00
Gross Loss -6928.00
Total Net Profit -6634.00
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.02
Total Trades 12
Won Trades 1
Lost trades 11
Win Rate 8.33 %
Expected payoff -625.46
Gross Profit 142.82
Gross Loss -7648.38
Total Net Profit -7505.56
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.02
Total Trades 30
Won Trades 10
Lost trades 20
Win Rate 33.33 %
Expected payoff -266.77
Gross Profit 177.00
Gross Loss -8180.00
Total Net Profit -8003.00
-100%
-50%
0%
50%
100%
USD/CHF Oct 2024 - Jan 2025
0.00
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
0.00
Total Trades 10
Won Trades 0
Lost trades 10
Win Rate 0.00 %
Expected payoff -500.57
Gross Profit 0.00
Gross Loss -5005.72
Total Net Profit -5005.72
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.00
Total Trades 10
Won Trades 0
Lost trades 10
Win Rate 0.00 %
Expected payoff -802.00
Gross Profit 0.00
Gross Loss -8020.00
Total Net Profit -8020.00
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 10
Won Trades 0
Lost trades 10
Win Rate 0.00 %
Expected payoff -676.70
Gross Profit 0.00
Gross Loss -6767.00
Total Net Profit -6767.00
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.00
Total Trades 10
Won Trades 0
Lost trades 10
Win Rate 0.00 %
Expected payoff -625.28
Gross Profit 0.00
Gross Loss -6252.80
Total Net Profit -6252.80
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.00
Total Trades 10
Won Trades 0
Lost trades 10
Win Rate 0.00 %
Expected payoff -500.30
Gross Profit 0.00
Gross Loss -5003.00
Total Net Profit -5003.00
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 21
Won Trades 3
Lost trades 18
Win Rate 14.29 %
Expected payoff -452051.63
Gross Profit 809.00
Gross Loss -9493893.00
Total Net Profit -9493084.00
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.00
Total Trades 11
Won Trades 1
Lost trades 10
Win Rate 9.09 %
Expected payoff -568.88
Gross Profit 31.23
Gross Loss -6288.96
Total Net Profit -6257.73
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.00
Total Trades 10
Won Trades 0
Lost trades 10
Win Rate 0.00 %
Expected payoff -625.50
Gross Profit 0.00
Gross Loss -6255.00
Total Net Profit -6255.00
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.00
Total Trades 10
Won Trades 0
Lost trades 10
Win Rate 0.00 %
Expected payoff -551.05
Gross Profit 0.00
Gross Loss -5510.48
Total Net Profit -5510.48
-100%
-50%
0%
50%
100%

Comments