Day Trading_PAMXA

Author: Copyright � 2009, SMERJ ORG
Profit factor:
0.38
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
8 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

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%
GBP/CAD Jul 2025 - Sep 2025
0.63
Total Trades 119
Won Trades 113
Lost trades 6
Win Rate 94.96 %
Expected payoff -27.83
Gross Profit 5604.73
Gross Loss -8916.86
Total Net Profit -3312.13
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.39
Total Trades 152
Won Trades 140
Lost trades 12
Win Rate 92.11 %
Expected payoff -39.84
Gross Profit 3807.90
Gross Loss -9864.09
Total Net Profit -6056.19
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 32
Won Trades 31
Lost trades 1
Win Rate 96.88 %
Expected payoff -125217.82
Gross Profit 2607.50
Gross Loss -4009577.60
Total Net Profit -4006970.10
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.46
Total Trades 125
Won Trades 116
Lost trades 9
Win Rate 92.80 %
Expected payoff -52.29
Gross Profit 5605.00
Gross Loss -12141.30
Total Net Profit -6536.30
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 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 Jan 2025 - Jul 2025
0.38
Total Trades 368
Won Trades 341
Lost trades 27
Win Rate 92.66 %
Expected payoff -24.93
Gross Profit 5688.73
Gross Loss -14863.60
Total Net Profit -9174.87
-100%
-50%
0%
50%
100%

Comments