Profit factor:
0.73
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
Moving average indicator
6 Views
0 Downloads
0 Favorites
amer
//+------------------------------------------------------------------+
//|                                                         amer.mq4 |
//|                                                             Olek |
//|                                                                  |
//+------------------------------------------------------------------+
extern double Lots = 0.1;
extern int TrailingStop = 50;
extern int StopLoss=50;
extern int TakeProfit = 200;
extern int per = 700;
extern int vremya = 0;
extern int DayWeek = 2;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   double Mov1= 0, Mov2=0;
   int cnt, ticket, total;
   
   Mov1= iMA(0,0,per,0,0,0,1);
   Mov2= iMA(0,0,per,0,0,0,2);

   int  h=0; 

int       hour0=0; 
int       hour1=0; 
int       hour2=0; 
int       hour3=0; 
int       hour4=0; 
int       hour5=0; 
int       hour6=0; 
int       hour7=0; 
int       hour8=0; 
int       hour9=0; 
int       hour10=0; 
int       hour11=0; 
int       hour12=0; 
int       hour13=0; 
int       hour14=0; 
int       hour15=0; 
int       hour16=0; 
int       hour17=0; 
int       hour18=0; 
int       hour19=0; 
int       hour20=0; 
int       hour21=0; 
int       hour22=0; 
int       hour23=0; 

if (DayOfWeek() == 1)  {hour0=1;hour1=1;hour2=1;hour3=0;hour4=1;hour5=1;hour6=0;hour7=0;hour8=1;hour9=1;hour10=1;hour11=1; 
             hour12=0;hour13=1;hour14=0;hour15=1;hour16=1;hour17=1;hour18=0;hour19=0;hour20=0;hour21=0;hour22=0;hour23=1;} 
else   if (DayOfWeek() == 2)  {hour0=1;hour1=1;hour2=1;hour3=0;hour4=1;hour5=1;hour6=0;hour7=0;hour8=1;hour9=1;hour10=1;hour11=1; 
             hour12=0;hour13=1;hour14=0;hour15=1;hour16=1;hour17=1;hour18=0;hour19=0;hour20=0;hour21=0;hour22=0;hour23=1;} 
else   if (DayOfWeek() == 3)  {hour0=1;hour1=1;hour2=1;hour3=0;hour4=1;hour5=1;hour6=0;hour7=0;hour8=1;hour9=1;hour10=1;hour11=1; 
             hour12=0;hour13=1;hour14=0;hour15=1;hour16=1;hour17=1;hour18=0;hour19=0;hour20=0;hour21=0;hour22=0;hour23=1;} 
else   if (DayOfWeek() == 4)  {hour0=1;hour1=1;hour2=1;hour3=0;hour4=1;hour5=1;hour6=0;hour7=0;hour8=0;hour9=0;hour10=0;hour11=0; 
             hour12=0;hour13=0;hour14=0;hour15=0;hour16=0;hour17=0;hour18=0;hour19=0;hour20=0;hour21=0;hour22=0;hour23=1;} 
else   if (DayOfWeek() == 5)  {hour0=1;hour1=1;hour2=1;hour3=0;hour4=1;hour5=1;hour6=0;hour7=0;hour8=1;hour9=1;hour10=0;hour11=0; 
             hour12=0;hour13=0;hour14=0;hour15=0;hour16=0;hour17=0;hour18=0;hour19=0;hour20=0;hour21=0;hour22=0;hour23=0;} 
  
       if(Hour()== 0) h=hour0; 
else   if(Hour()== 1) h=hour1; 
else   if(Hour()== 2) h=hour2; 
else   if(Hour()== 3) h=hour3; 
else   if(Hour()== 4) h=hour4; 
else   if(Hour()== 5) h=hour5; 
else   if(Hour()== 6) h=hour6; 
else   if(Hour()== 7) h=hour7; 
else   if(Hour()== 8) h=hour8; 
else   if(Hour()== 9) h=hour9; 
else   if(Hour()== 10) h=hour10; 
else   if(Hour()== 11) h=hour11; 
else   if(Hour()== 12) h=hour12; 
else   if(Hour()== 13) h=hour13; 
else   if(Hour()== 14) h=hour14; 
else   if(Hour()== 15) h=hour15; 
else   if(Hour()== 16) h=hour16; 
else   if(Hour()== 17) h=hour17; 
else   if(Hour()== 18) h=hour18; 
else   if(Hour()== 19) h=hour19; 
else   if(Hour()== 20) h=hour20; 
else   if(Hour()== 21) h=hour21; 
else   if(Hour()== 22) h=hour22; 
else   if(Hour()== 23) h=hour23;    

if(  h==1 ) 

   total=OrdersTotal();
   if(total<1 && Hour() == vremya && DayOfWeek()>= DayWeek) 
     {
      
      if( Mov1 < Mov2 )
        {
         ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+StopLoss*Point,Bid-TakeProfit*Point,"",12,0,Red);
         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); 
        }
      
      if(Mov1 > Mov2 )
        {
         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-StopLoss*Point,Ask+TakeProfit*Point,"",12,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); 
        }
      return(0);
     }
      
   for(cnt=0;cnt<total;cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELL &&   
         OrderSymbol()==Symbol())  
        {
         if(OrderType()==OP_BUY)   
           {
            
            if(TrailingStop>0)  
              {                 
               if(Bid-OrderOpenPrice()>Point*TrailingStop)
                 {
                  if(OrderStopLoss()<Bid-Point*TrailingStop)
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
                     return(0);
                    }
                 }
              }
           }
         else 
           {
            
            if(TrailingStop>0)  
              {                 
               if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
                 {
                  if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
                     return(0);
                    }
                 }
              }
           }
        }
     }
   return(0);
  }

Profitability Reports

USD/JPY Jan 2025 - Jul 2025
1.08
Total Trades 252
Won Trades 118
Lost trades 134
Win Rate 46.83 %
Expected payoff 0.18
Gross Profit 610.23
Gross Loss -564.06
Total Net Profit 46.17
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
0.61
Total Trades 353
Won Trades 183
Lost trades 170
Win Rate 51.84 %
Expected payoff -1.43
Gross Profit 801.13
Gross Loss -1306.92
Total Net Profit -505.79
-100%
-50%
0%
50%
100%
USD/CAD Jan 2025 - Jul 2025
0.61
Total Trades 223
Won Trades 103
Lost trades 120
Win Rate 46.19 %
Expected payoff -1.03
Gross Profit 357.04
Gross Loss -586.54
Total Net Profit -229.50
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
0.79
Total Trades 190
Won Trades 99
Lost trades 91
Win Rate 52.11 %
Expected payoff -0.67
Gross Profit 490.80
Gross Loss -618.80
Total Net Profit -128.00
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
0.49
Total Trades 287
Won Trades 127
Lost trades 160
Win Rate 44.25 %
Expected payoff -2.40
Gross Profit 654.40
Gross Loss -1344.00
Total Net Profit -689.60
-100%
-50%
0%
50%
100%
GBP/CAD Jan 2025 - Jul 2025
0.49
Total Trades 500
Won Trades 208
Lost trades 292
Win Rate 41.60 %
Expected payoff -1.83
Gross Profit 878.87
Gross Loss -1792.36
Total Net Profit -913.49
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.42
Total Trades 651
Won Trades 235
Lost trades 416
Win Rate 36.10 %
Expected payoff -2.36
Gross Profit 1093.74
Gross Loss -2632.07
Total Net Profit -1538.33
-100%
-50%
0%
50%
100%
EUR/USD Jan 2025 - Jul 2025
1.79
Total Trades 307
Won Trades 148
Lost trades 159
Win Rate 48.21 %
Expected payoff 2.65
Gross Profit 1847.20
Gross Loss -1033.50
Total Net Profit 813.70
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
0.85
Total Trades 168
Won Trades 88
Lost trades 80
Win Rate 52.38 %
Expected payoff -0.49
Gross Profit 454.00
Gross Loss -536.00
Total Net Profit -82.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%

Comments