Author:
Profit factor:
0.32
Orders Execution
Checks for the total of open ordersIt can change open orders parameters, due to possible stepping strategyIt automatically opens orders when conditions are reached
Indicators Used
Moving average indicatorMACD HistogramMovement directional index
1 Views
0 Downloads
0 Favorites
iliaaz_EA
/*

*********************************************************************
          
                        Iliaazshareef EA
             http://www.forex-tsd.com/metatrader-4/
                  
*********************************************************************

*/

#property copyright ""
#property link      "http://www.forex-tsd.com/metatrader-4/"

extern int        stopLoss=25;
extern int        takeProfit=200;
extern int        maxLots = 1;
extern double     Lots = 1;
extern int        trailingStop=5;
extern double     macdLevel = 0.00040;
extern int        adxLevel = 22;
extern int        trailingStopStart = 200;

int init() {

   Print ("---- Initializing ----");
   
   return(0);
   
}

int start() {
   
   int total, i;
   double l, ma1, ma2, macdLine, macdHist, adx;
   
   total=OrdersTotal();
   
   ma1 = iMA(NULL,0,24,0,MODE_EMA,PRICE_HIGH,0);
   ma2 = iMA(NULL,0,24,0,MODE_EMA,PRICE_LOW,0);
   macdLine = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1);
	macdHist = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,1);
   adx = iADX(NULL,0,14,PRICE_CLOSE,MODE_MAIN,0);
      
   for (i=0;i<total;i++){

      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
   
      if (OrderSymbol()==Symbol() && OrderType()==OP_SELL) {
         
         if ((OrderOpenPrice()-Low[1] >= trailingStopStart*Point) || (macdHist > 0 && High[0] > ma1)) {
               
               OrderModify(OrderTicket(),OrderOpenPrice(),Ask+5*Point,0,0,White);
               
         }
   
      }
      
      if (OrderSymbol()==Symbol() && OrderType()==OP_BUY){
         
         if ((High[1]-OrderOpenPrice() >= trailingStopStart*Point) || (macdHist < 0 && Low[0] < ma2)) {
               
               OrderModify(OrderTicket(),OrderOpenPrice(),Bid-5*Point,0,0,White);
               
         }
      
      }
   
   }
   
   if (total < maxLots) {
	   
	   if (Open[0] > ma1 && macdHist > macdLevel && adx > adxLevel) {
	     
	     placeLongTrade();
	     
	   } else if (Open[0] < ma2 && macdHist < -macdLevel && adx < adxLevel) {
	     
	     placeShortTrade();
	     
	   }
	   
	}

   return(0);

}

void placeLongTrade () {

   double ticket;

   ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-stopLoss*Point,Ask+takeProfit*Point,"",16384,0,Blue);
    
   if(ticket>0) {
      if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
   } else {
      Print("Error opening BUY order : ",GetLastError()); 
      return(0); 
   }

}

void placeShortTrade () {
   
   double ticket;

   ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+stopLoss*Point,Bid-takeProfit*Point,"",16384,0,Red);
  
   if(ticket>0) {
      if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
   } else {
      Print("Error opening SELL order : ",GetLastError());  
      return(0);   
   }

}

Profitability Reports

NZD/USD Oct 2024 - Jan 2025
0.20
Total Trades 497
Won Trades 20
Lost trades 477
Win Rate 4.02 %
Expected payoff -19.80
Gross Profit 2392.00
Gross Loss -12232.00
Total Net Profit -9840.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.44
Total Trades 625
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -13.23
Gross Profit 6613.00
Gross Loss -14881.00
Total Net Profit -8268.00
-100%
-50%
0%
50%
100%

Comments