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
11 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 Jul 2025 - Sep 2025
0.93
Total Trades 90
Won Trades 39
Lost trades 51
Win Rate 43.33 %
Expected payoff -0.17
Gross Profit 206.21
Gross Loss -221.65
Total Net Profit -15.44
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.60
Total Trades 118
Won Trades 45
Lost trades 73
Win Rate 38.14 %
Expected payoff -2.14
Gross Profit 386.39
Gross Loss -638.86
Total Net Profit -252.47
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.73
Total Trades 82
Won Trades 37
Lost trades 45
Win Rate 45.12 %
Expected payoff -0.73
Gross Profit 165.69
Gross Loss -225.72
Total Net Profit -60.03
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.06
Total Trades 60
Won Trades 10
Lost trades 50
Win Rate 16.67 %
Expected payoff -11.14
Gross Profit 46.40
Gross Loss -715.00
Total Net Profit -668.60
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
1.03
Total Trades 106
Won Trades 52
Lost trades 54
Win Rate 49.06 %
Expected payoff 0.09
Gross Profit 338.70
Gross Loss -329.40
Total Net Profit 9.30
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.33
Total Trades 146
Won Trades 50
Lost trades 96
Win Rate 34.25 %
Expected payoff -3.21
Gross Profit 233.25
Gross Loss -701.22
Total Net Profit -467.97
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.21
Total Trades 234
Won Trades 71
Lost trades 163
Win Rate 30.34 %
Expected payoff -3.43
Gross Profit 218.79
Gross Loss -1021.86
Total Net Profit -803.07
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
2.09
Total Trades 145
Won Trades 70
Lost trades 75
Win Rate 48.28 %
Expected payoff 3.62
Gross Profit 1005.40
Gross Loss -480.00
Total Net Profit 525.40
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.77
Total Trades 69
Won Trades 35
Lost trades 34
Win Rate 50.72 %
Expected payoff -0.73
Gross Profit 164.00
Gross Loss -214.20
Total Net Profit -50.20
-100%
-50%
0%
50%
100%
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%

Comments