Day Trading_PAMXA

Author: Copyright � 2009, SMERJ ORG
Profit factor:
0.40
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt Closes Orders by itself It can change open orders parameters, due to possible stepping strategyChecks for the total of closed orders
Indicators Used
Bill Williams Awesome oscillatorMovement directional indexStochastic oscillator
10 Views
0 Downloads
0 Favorites
Day Trading_PAMXA
//+------------------------------------------------------------------+
//|                                            Day Trading_PAMXA.mq4 |
//|                                      Copyright © 2009, SMERJ ORG |
//|                                            http://smerj.ucoz.org |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, SMERJ ORG"
#property link      "http://smerj.ucoz.org"

extern double TakeProfit = 25;
extern double Lots = 0;
extern double TrailingStop = 0;
extern double StopLoss = 50;
extern   bool     UseMM = true;
extern   bool     MicroAcct = false;
extern   double   Risk = 30;
double   var_96 = 0;
string   var_240 = "";

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
  double stoc2k_0;
  double AO;
  double adx_0, adx_1;
  int cnt, ticket, total;

//server Time

Comment(var_240,"\nServer Time = ",TimeToStr(TimeCurrent(),TIME_MINUTES));
 
// initial data checks
   if(Bars<10)
     {
      Print("bars less than 10");
      return(0);  
     }
   if(TakeProfit<10)
     {
      Print("TakeProfit less than 10");
      return(0);
     }
     
// to simplify the coding and speed up access

AO=iAO(NULL,0,150);
adx_0=iADX(NULL,0,14,PRICE_TYPICAL,MODE_SIGNAL,0);
adx_1=iADX(NULL,0,14,PRICE_TYPICAL,MODE_SIGNAL,1);
stoc2k_0=iStochastic(NULL,0,5,3,3,MODE_SMA,NULL,MODE_MAIN,0);

// identifying open orders
   total=OrdersTotal();
   if(total<1)
   {
   if(AccountFreeMargin()<(1000*Lots))
   {
   Print("We have no money. Free Margin = ", AccountFreeMargin());
   return(0);  
   }
   
// check for long position (BUY) possibility
   if(AO<0 && adx_0 >= Ask && adx_1<adx_0 && stoc2k_0<20)
   {
   ticket=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,0,Ask+TakeProfit*Point,0,0,Green);
   if(ticket>0)
   Print("Day Trading_PAMXA Buying : ", Symbol());
   {
   if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
   } 
   return(0);
   }
   
// check for short position (SELL) possibility
   if(AO>0 && adx_0 >= Ask && adx_1<adx_0 && stoc2k_0>20)
   {
   ticket=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,0,Bid-TakeProfit*Point,0,0,Red);
   if(ticket>0)
   Print("Day Trading_PAMXA Selling : ", Symbol());
   {
   if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
   }
   return(0);
   }
   return(0);
   }
   
// control of open orders
   for(cnt=0;cnt<total;cnt++)
   {
   OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
   if(OrderType()<=OP_SELL && 
   OrderSymbol()==Symbol())
   {
   if(OrderType()==OP_BUY)
   {

// long positions
   if(AO>0 && adx_0 >= Ask && adx_1<adx_0 && stoc2k_0>70)
   {
      OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet);
   return(0);
   }

// check for trailing stop
   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

// short positions
   {
   if(AO<0 && adx_0 >= Ask && adx_1<adx_0 && stoc2k_0<35)
      {
   OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);
   return(0);
   }

// check for trailing stop
   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);
   }
   
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+

double LotsOptimized()
{
if (UseMM == false) return(Lots);

double lots = Lots;
int    ordtotal = OrdersHistoryTotal();
int    losscnt = 0;
double var_LotsOptimized_16 = 0;
int    digits = 1;

if (MarketInfo(Symbol(),MODE_LOTSTEP) == 1.0) digits = 1;
if (MicroAcct == true) digits = 2;

lots = NormalizeDouble(AccountFreeMargin() * Risk / 100.0 / 1000.0,digits);

if (var_96 > 0.0)
   {
   for (int i = ordtotal - 1; i >= 0; i--)
      {
      if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY) == 0)
         {
         Print("Error in history!");
         break;
         }
      if ((OrderSymbol() != Symbol()) || (OrderType() > OP_SELL)) continue;
      if (OrderProfit() > 0.0) break;
      if (OrderProfit() < 0.0) losscnt++;
      }
   if (losscnt > 1) lots = NormalizeDouble(lots - lots * losscnt / var_96,1);
   }

if ((lots < 0.1) && (MicroAcct == false)) lots = 0.1;
if ((lots < 0.01) && (MicroAcct == true)) lots = 0.01;
if (lots > 50.0) lots = 50;
return(lots);
}

Profitability Reports

NZD/USD Jul 2025 - Sep 2025
0.80
Total Trades 202
Won Trades 176
Lost trades 26
Win Rate 87.13 %
Expected payoff -15.85
Gross Profit 12560.00
Gross Loss -15762.70
Total Net Profit -3202.70
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.70
Total Trades 248
Won Trades 227
Lost trades 21
Win Rate 91.53 %
Expected payoff -26.60
Gross Profit 15382.50
Gross Loss -21980.10
Total Net Profit -6597.60
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.11
Total Trades 113
Won Trades 79
Lost trades 34
Win Rate 69.91 %
Expected payoff -84.60
Gross Profit 1128.19
Gross Loss -10688.41
Total Net Profit -9560.22
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.38
Total Trades 228
Won Trades 201
Lost trades 27
Win Rate 88.16 %
Expected payoff -36.96
Gross Profit 5170.94
Gross Loss -13598.50
Total Net Profit -8427.56
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 56
Won Trades 53
Lost trades 3
Win Rate 94.64 %
Expected payoff -71421.93
Gross Profit 4232.50
Gross Loss -4003860.80
Total Net Profit -3999628.30
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.80
Total Trades 202
Won Trades 177
Lost trades 25
Win Rate 87.62 %
Expected payoff -15.45
Gross Profit 12443.10
Gross Loss -15564.60
Total Net Profit -3121.50
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 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/CHF Jul 2025 - Sep 2025
0.41
Total Trades 111
Won Trades 98
Lost trades 13
Win Rate 88.29 %
Expected payoff -68.49
Gross Profit 5324.98
Gross Loss -12927.65
Total Net Profit -7602.67
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.69
Total Trades 126
Won Trades 116
Lost trades 10
Win Rate 92.06 %
Expected payoff -18.94
Gross Profit 5394.43
Gross Loss -7780.48
Total Net Profit -2386.05
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.66
Total Trades 159
Won Trades 146
Lost trades 13
Win Rate 91.82 %
Expected payoff -35.43
Gross Profit 10787.50
Gross Loss -16421.30
Total Net Profit -5633.80
-100%
-50%
0%
50%
100%

Comments