ArtificialIntelligence_Right

Profit factor:
0.59
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_Right
//+------------------------------------------------------------------+
//|                                 ArtificialIntelligence_Right.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 = total - 1; i >= 0; 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

GBP/USD Jul 2025 - Sep 2025
0.62
Total Trades 284
Won Trades 90
Lost trades 194
Win Rate 31.69 %
Expected payoff -33.89
Gross Profit 15540.00
Gross Loss -25166.00
Total Net Profit -9626.00
-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%
GBP/AUD Jul 2025 - Sep 2025
0.38
Total Trades 222
Won Trades 57
Lost trades 165
Win Rate 25.68 %
Expected payoff -43.41
Gross Profit 5831.43
Gross Loss -15469.53
Total Net Profit -9638.10
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.85
Total Trades 534
Won Trades 169
Lost trades 365
Win Rate 31.65 %
Expected payoff -11.87
Gross Profit 36681.00
Gross Loss -43022.00
Total Net Profit -6341.00
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.90
Total Trades 262
Won Trades 97
Lost trades 165
Win Rate 37.02 %
Expected payoff -7.32
Gross Profit 17968.00
Gross Loss -19885.00
Total Net Profit -1917.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/CAD Oct 2024 - Jan 2025
0.74
Total Trades 443
Won Trades 139
Lost trades 304
Win Rate 31.38 %
Expected payoff -14.16
Gross Profit 17828.56
Gross Loss -24102.51
Total Net Profit -6273.95
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.67
Total Trades 263
Won Trades 85
Lost trades 178
Win Rate 32.32 %
Expected payoff -31.76
Gross Profit 17326.00
Gross Loss -25680.00
Total Net Profit -8354.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.88
Total Trades 551
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -9.85
Gross Profit 38966.00
Gross Loss -44394.00
Total Net Profit -5428.00
-100%
-50%
0%
50%
100%

Comments