ArtificialIntelligence

Profit factor:
0.66
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt can change open orders parameters, due to possible stepping strategy
Indicators Used
Bill Williams Accelerator/Decelerator oscillator
13 Views
0 Downloads
0 Favorites
ArtificialIntelligence
//+------------------------------------------------------------------+
//|                                       ArtificialIntelligence.mq4 |
//|                               Copyright © 2006, Yury V. Reshetov |
//|                                         http://reshetov.xnet.uz/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Yury V. Reshetov ICQ:282715499  http://reshetov.xnet.uz/"
#property link      "http://reshetov.xnet.uz/"
//---- input parameters
extern int    x1 = 135;
extern int    x2 = 127;
extern int    x3 = 16;
extern int    x4 = 93;
// StopLoss level
extern double sl = 85;
extern double lots = 1;
extern int MagicNumber = 888;
static int prevtime = 0;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   if(Time[0] == prevtime) 
       return(0);
   prevtime = Time[0];
   int spread = 3;
//----
   if(IsTradeAllowed()) 
     {
       RefreshRates();
       spread = MarketInfo(Symbol(), MODE_SPREAD);
     } 
   else 
     {
       prevtime = Time[1];
       return(0);
     }
   int ticket = -1;
// check for opened position
   int total = OrdersTotal();   
//----
   for(int i = 0; i < total; i++) 
     {
       OrderSelect(i, SELECT_BY_POS, MODE_TRADES); 
       // check for symbol & magic number
       if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) 
         {
           int prevticket = OrderTicket();
           // long position is opened
           if(OrderType() == OP_BUY) 
             {
               // check profit 
               if(Bid > (OrderStopLoss() + (sl * 2  + spread) * Point)) 
                 {               
                   if(perceptron() < 0) 
                     { // reverse
                       ticket = OrderSend(Symbol(), OP_SELL, lots * 2, Bid, 3, 
                                          Ask + sl * Point, 0, "AI", MagicNumber, 0, Red); 
                       Sleep(30000);
                       //----
                       if(ticket < 0) 
                           prevtime = Time[1];
                       else 
                           OrderCloseBy(ticket, prevticket, Blue);   
                     } 
                   else 
                     { // trailing stop
                       if(!OrderModify(OrderTicket(), OrderOpenPrice(), Bid - sl * Point, 
                          0, 0, Blue)) 
                         {
                           Sleep(30000);
                           prevtime = Time[1];
                         }
                     }
                 }  
               // short position is opened
             } 
           else 
             {
               // check profit 
               if(Ask < (OrderStopLoss() - (sl * 2 + spread) * Point)) 
                 {
                   if(perceptron() > 0) 
                     { // reverse
                       ticket = OrderSend(Symbol(), OP_BUY, lots * 2, Ask, 3, 
                                          Bid - sl * Point, 0, "AI", MagicNumber, 0, Blue); 
                       Sleep(30000);
                       //----
                       if(ticket < 0) 
                           prevtime = Time[1];
                       else 
                           OrderCloseBy(ticket, prevticket, Blue);   
                     } 
                   else 
                     { // trailing stop
                       if(!OrderModify(OrderTicket(), OrderOpenPrice(), Ask + sl * Point, 
                          0, 0, Blue)) 
                         {
                           Sleep(30000);
                           prevtime = Time[1];
                         }
                     }
                 }  
             }
           // exit
           return(0);
         }
     }
// check for long or short position possibility
   if(perceptron() > 0) 
     { //long
       ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, 3, Bid - sl * Point, 0, "AI", 
                          MagicNumber, 0, Blue); 
       //----
       if(ticket < 0) 
         {
           Sleep(30000);
           prevtime = Time[1];
         }
     } 
   else 
     { // short
       ticket = OrderSend(Symbol(), OP_SELL, lots, Bid, 3, Ask + sl * Point, 0, "AI", 
                          MagicNumber, 0, Red); 
       if(ticket < 0) 
         {
           Sleep(30000);
           prevtime = Time[1];
         }
     }
//--- exit
   return(0);
  }
//+------------------------------------------------------------------+
//| The PERCEPTRON - a perceiving and recognizing function           |
//+------------------------------------------------------------------+
double perceptron() 
  {
   double w1 = x1 - 100;
   double w2 = x2 - 100;
   double w3 = x3 - 100;
   double w4 = x4 - 100;
   double a1 = iAC(Symbol(), 0, 0);
   double a2 = iAC(Symbol(), 0, 7);
   double a3 = iAC(Symbol(), 0, 14);
   double a4 = iAC(Symbol(), 0, 21);
   return(w1 * a1 + w2 * a2 + w3 * a3 + w4 * a4);
  }
//+------------------------------------------------------------------+


Profitability Reports

USD/CHF Jul 2025 - Sep 2025
1.44
Total Trades 59
Won Trades 24
Lost trades 35
Win Rate 40.68 %
Expected payoff 50.84
Gross Profit 9857.22
Gross Loss -6857.87
Total Net Profit 2999.35
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
1.15
Total Trades 776
Won Trades 195
Lost trades 581
Win Rate 25.13 %
Expected payoff 17.66
Gross Profit 104845.00
Gross Loss -91140.00
Total Net Profit 13705.00
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
1.02
Total Trades 506
Won Trades 149
Lost trades 357
Win Rate 29.45 %
Expected payoff 1.20
Gross Profit 35592.84
Gross Loss -34983.93
Total Net Profit 608.91
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
1.00
Total Trades 83
Won Trades 26
Lost trades 57
Win Rate 31.33 %
Expected payoff -0.05
Gross Profit 12684.65
Gross Loss -12688.86
Total Net Profit -4.21
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.96
Total Trades 71
Won Trades 24
Lost trades 47
Win Rate 33.80 %
Expected payoff -2.96
Gross Profit 4906.00
Gross Loss -5116.00
Total Net Profit -210.00
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.88
Total Trades 380
Won Trades 107
Lost trades 273
Win Rate 28.16 %
Expected payoff -8.99
Gross Profit 26268.29
Gross Loss -29684.51
Total Net Profit -3416.22
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
0.76
Total Trades 212
Won Trades 55
Lost trades 157
Win Rate 25.94 %
Expected payoff -28.32
Gross Profit 18705.52
Gross Loss -24708.42
Total Net Profit -6002.90
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.73
Total Trades 164
Won Trades 47
Lost trades 117
Win Rate 28.66 %
Expected payoff -26.86
Gross Profit 11651.00
Gross Loss -16056.00
Total Net Profit -4405.00
-100%
-50%
0%
50%
100%
USD/CAD Jan 2025 - Jul 2025
0.69
Total Trades 332
Won Trades 73
Lost trades 259
Win Rate 21.99 %
Expected payoff -21.09
Gross Profit 15433.69
Gross Loss -22433.97
Total Net Profit -7000.28
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.69
Total Trades 134
Won Trades 39
Lost trades 95
Win Rate 29.10 %
Expected payoff -22.40
Gross Profit 6576.83
Gross Loss -9578.65
Total Net Profit -3001.82
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.68
Total Trades 203
Won Trades 56
Lost trades 147
Win Rate 27.59 %
Expected payoff -37.26
Gross Profit 16327.00
Gross Loss -23890.00
Total Net Profit -7563.00
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
0.68
Total Trades 456
Won Trades 103
Lost trades 353
Win Rate 22.59 %
Expected payoff -18.65
Gross Profit 17692.01
Gross Loss -26196.60
Total Net Profit -8504.59
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.68
Total Trades 416
Won Trades 108
Lost trades 308
Win Rate 25.96 %
Expected payoff -23.14
Gross Profit 20045.28
Gross Loss -29670.65
Total Net Profit -9625.37
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.67
Total Trades 152
Won Trades 40
Lost trades 112
Win Rate 26.32 %
Expected payoff -36.57
Gross Profit 11204.00
Gross Loss -16762.00
Total Net Profit -5558.00
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
0.66
Total Trades 250
Won Trades 68
Lost trades 182
Win Rate 27.20 %
Expected payoff -29.21
Gross Profit 14350.00
Gross Loss -21652.00
Total Net Profit -7302.00
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.66
Total Trades 101
Won Trades 28
Lost trades 73
Win Rate 27.72 %
Expected payoff -75.34
Gross Profit 14961.00
Gross Loss -22570.00
Total Net Profit -7609.00
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.64
Total Trades 163
Won Trades 39
Lost trades 124
Win Rate 23.93 %
Expected payoff -48.48
Gross Profit 13990.00
Gross Loss -21892.00
Total Net Profit -7902.00
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.63
Total Trades 244
Won Trades 65
Lost trades 179
Win Rate 26.64 %
Expected payoff -34.93
Gross Profit 14267.00
Gross Loss -22790.00
Total Net Profit -8523.00
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.60
Total Trades 191
Won Trades 47
Lost trades 144
Win Rate 24.61 %
Expected payoff -43.23
Gross Profit 12378.00
Gross Loss -20635.00
Total Net Profit -8257.00
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.59
Total Trades 250
Won Trades 62
Lost trades 188
Win Rate 24.80 %
Expected payoff -32.00
Gross Profit 11392.48
Gross Loss -19393.47
Total Net Profit -8000.99
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
0.55
Total Trades 215
Won Trades 51
Lost trades 164
Win Rate 23.72 %
Expected payoff -36.05
Gross Profit 9419.73
Gross Loss -17170.65
Total Net Profit -7750.92
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
0.52
Total Trades 192
Won Trades 51
Lost trades 141
Win Rate 26.56 %
Expected payoff -50.14
Gross Profit 10357.00
Gross Loss -19983.00
Total Net Profit -9626.00
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.49
Total Trades 235
Won Trades 67
Lost trades 168
Win Rate 28.51 %
Expected payoff -41.08
Gross Profit 9093.50
Gross Loss -18747.05
Total Net Profit -9653.55
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.48
Total Trades 271
Won Trades 59
Lost trades 212
Win Rate 21.77 %
Expected payoff -35.52
Gross Profit 8960.66
Gross Loss -18586.56
Total Net Profit -9625.90
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.46
Total Trades 120
Won Trades 35
Lost trades 85
Win Rate 29.17 %
Expected payoff -66.67
Gross Profit 6792.14
Gross Loss -14792.85
Total Net Profit -8000.71
-100%
-50%
0%
50%
100%
EUR/USD Jan 2025 - Jul 2025
0.45
Total Trades 155
Won Trades 37
Lost trades 118
Win Rate 23.87 %
Expected payoff -51.97
Gross Profit 6611.00
Gross Loss -14666.00
Total Net Profit -8055.00
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
0.43
Total Trades 128
Won Trades 29
Lost trades 99
Win Rate 22.66 %
Expected payoff -70.62
Gross Profit 6926.00
Gross Loss -15965.00
Total Net Profit -9039.00
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.30
Total Trades 141
Won Trades 26
Lost trades 115
Win Rate 18.44 %
Expected payoff -65.98
Gross Profit 4037.27
Gross Loss -13340.52
Total Net Profit -9303.25
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.27
Total Trades 114
Won Trades 35
Lost trades 79
Win Rate 30.70 %
Expected payoff -80.99
Gross Profit 3344.30
Gross Loss -12577.46
Total Net Profit -9233.16
-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%

Comments