escapeforalpari

Profit factor:
0.14
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
Miscellaneous
It plays sound alerts
1 Views
0 Downloads
0 Favorites
escapeforalpari
//+------------------------------------------------------------------+
//|                                                      robotic.mq4 |
//|                                    Copyright © 2008, OGUZ BAYRAM |
//|                                            es_cape77@hotmail.com |
//+------------------------------------------------------------------+

extern double lTakeProfit = 10;
extern double sTakeProfit = 10;
extern double lTrailingStop = 20;
extern double sTrailingStop = 10;
extern color clOpenBuy = Green;
extern color clCloseBuy = Aqua;
extern color clOpenSell = Red;
extern color clCloseSell = Violet;
extern color clModiBuy = Blue;
extern color clModiSell = Red;
extern string Name_Expert = "Robotic";
extern int Slippage = 1;
extern bool UseSound = false;
extern string NameFileSound = "Alert.wav";
extern double Lots = 0.2;


void deinit() {
   Comment("");
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start(){
   if(Bars<50){
      Print("bars less than 50");
      return(0);
   }
   if(lTakeProfit<0.5){
      Print("TakeProfit less than 0.5");
      return(0);
   }
   if(sTakeProfit<0.5){
      Print("TakeProfit less than 0.5");
      return(0);
   }

   double diClose0=iClose(NULL,5,0);
   double diMA1=iMA(NULL,5,5,0,MODE_SMA,PRICE_OPEN,1);
   double diClose2=iClose(NULL,5,0);
   double diMA3=iMA(NULL,5,4,0,MODE_SMA,PRICE_OPEN,1);

   if(AccountFreeMargin()<(1000*Lots)){
      Print("We have no money. Free Margin = ", AccountFreeMargin());
      return(0);
   }
   if (!ExistPositions()){

      if ((diClose0<diMA1)){
         OpenBuy();
         return(0);
      }

      if ((diClose2>diMA3)){
         OpenSell();
         return(0);
      }
   }
   TrailingPositionsBuy(lTrailingStop);
   TrailingPositionsSell(sTrailingStop);
   return (0);
}

bool ExistPositions() {
for (int i=200; i<OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==Symbol()) {
return(True);
}
} 
} 
return(false);
}
void TrailingPositionsBuy(int trailingStop) { 
   for (int i=200; i<OrdersTotal(); i++) { 
      if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { 
         if (OrderSymbol()==Symbol()) { 
            if (OrderType()==OP_BUY) { 
               if (Bid-OrderOpenPrice()>trailingStop*Point) { 
                  if (OrderStopLoss()<Bid-trailingStop*Point) 
                     ModifyStopLoss(Bid-trailingStop*Point); 
               } 
            } 
         } 
      } 
   } 
} 
void TrailingPositionsSell(int trailingStop) { 
   for (int i=200; i<OrdersTotal(); i++) { 
      if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { 
         if (OrderSymbol()==Symbol()) { 
            if (OrderType()==OP_SELL) { 
               if (OrderOpenPrice()-Ask>trailingStop*Point) { 
                  if (OrderStopLoss()>Ask+trailingStop*Point || 
OrderStopLoss()==0)  
                     ModifyStopLoss(Ask+trailingStop*Point); 
               } 
            } 
         } 
      } 
   } 
} 
void ModifyStopLoss(double ldStopLoss) { 
   bool fm;
   fm = OrderModify(OrderTicket(),OrderOpenPrice
(),ldStopLoss,OrderTakeProfit(),0,CLR_NONE); 
   if (fm && UseSound) PlaySound(NameFileSound); 
} 

void OpenBuy() { 
   double ldLot, ldStop, ldTake; 
   string lsComm; 
   ldLot = GetSizeLot(); 
   ldStop = 0; 
   ldTake = GetTakeProfitBuy(); 
   lsComm = GetCommentForOrder(); 
   OrderSend(Symbol
(),OP_BUY,ldLot,Ask,Slippage,ldStop,ldTake,lsComm,0,0,clOpenBuy); 
   if (UseSound) PlaySound(NameFileSound); 
} 
void OpenSell() { 
   double ldLot, ldStop, ldTake; 
   string lsComm; 

   ldLot = GetSizeLot(); 
   ldStop = 0; 
   ldTake = GetTakeProfitSell(); 
   lsComm = GetCommentForOrder(); 
   OrderSend(Symbol
(),OP_SELL,ldLot,Bid,Slippage,ldStop,ldTake,lsComm,0,0,clOpenSell); 
   if (UseSound) PlaySound(NameFileSound); 
} 
string GetCommentForOrder() { return(Name_Expert); } 
double GetSizeLot() { return(Lots); } 
double GetTakeProfitBuy() { return(Ask+lTakeProfit*Point); } 
double GetTakeProfitSell() { return(Bid-sTakeProfit*Point); } 

Profitability Reports

USD/CHF Jul 2025 - Sep 2025
0.00
Total Trades 91
Won Trades 0
Lost trades 91
Win Rate 0.00 %
Expected payoff -9.95
Gross Profit 0.00
Gross Loss -905.83
Total Net Profit -905.83
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.05
Total Trades 211
Won Trades 28
Lost trades 183
Win Rate 13.27 %
Expected payoff -3.79
Gross Profit 39.69
Gross Loss -840.16
Total Net Profit -800.47
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.00
Total Trades 102
Won Trades 0
Lost trades 102
Win Rate 0.00 %
Expected payoff -23.71
Gross Profit 0.00
Gross Loss -2418.26
Total Net Profit -2418.26
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.06
Total Trades 184
Won Trades 67
Lost trades 117
Win Rate 36.41 %
Expected payoff -7.76
Gross Profit 86.92
Gross Loss -1515.05
Total Net Profit -1428.13
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.22
Total Trades 319
Won Trades 184
Lost trades 135
Win Rate 57.68 %
Expected payoff -4.09
Gross Profit 368.00
Gross Loss -1672.60
Total Net Profit -1304.60
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.17
Total Trades 399
Won Trades 198
Lost trades 201
Win Rate 49.62 %
Expected payoff -4.93
Gross Profit 396.00
Gross Loss -2362.40
Total Net Profit -1966.40
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.72
Total Trades 827
Won Trades 634
Lost trades 193
Win Rate 76.66 %
Expected payoff -0.43
Gross Profit 938.48
Gross Loss -1294.61
Total Net Profit -356.13
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.04
Total Trades 256
Won Trades 55
Lost trades 201
Win Rate 21.48 %
Expected payoff -11.66
Gross Profit 110.00
Gross Loss -3094.80
Total Net Profit -2984.80
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.12
Total Trades 169
Won Trades 44
Lost trades 125
Win Rate 26.04 %
Expected payoff -3.82
Gross Profit 88.00
Gross Loss -732.80
Total Net Profit -644.80
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.00
Total Trades 108
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -4.65
Gross Profit 0.00
Gross Loss -502.60
Total Net Profit -502.60
-100%
-50%
0%
50%
100%

Comments