Day Trading

Profit factor:
0.69
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 strategy
Indicators Used
Stochastic oscillatorMomentum indicatorMACD HistogramParabolic Stop and Reverse system
3 Views
0 Downloads
0 Favorites
Day Trading
//+------------------------------------------------------------------+
//|                                                  Day Trading.mq4 |
//|                               Copyright © 2005, NazFunds Company |
//|                                          http://www.nazfunds.com |
//+------------------------------------------------------------------+

extern double TakeProfit = 25;
extern double Lots = 1;
extern double TrailingStop = 0;
extern double StopLoss = 50;

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
  double rsi1_1, rsi1_0;
  double stoc2d_1, stoc2d_0, stoc2k_1, stoc2k_0;
  double MacdCurrent, MacdPrevious, SignalCurrent;
  double sar1_1, sar1_0;
  double mom3_1, mom3_0;
  int cnt, ticket, total;
  
// 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
stoc2d_1=iStochastic(NULL,0,10,7,3,MODE_SMA,NULL,MODE_SIGNAL,1);
stoc2d_0=iStochastic(NULL,0,10,7,3,MODE_SMA,NULL,MODE_SIGNAL,0);
stoc2k_1=iStochastic(NULL,0,10,7,3,MODE_SMA,NULL,MODE_MAIN,1);
stoc2k_0=iStochastic(NULL,0,10,7,3,MODE_SMA,NULL,MODE_MAIN,0);
mom3_1=iMomentum(NULL,0,14,PRICE_OPEN,1);
mom3_0=iMomentum(NULL,0,14,PRICE_OPEN,0);
MacdCurrent=iMACD(NULL,0,12,26,9,PRICE_TYPICAL,MODE_MAIN,0);
MacdPrevious=iMACD(NULL,0,12,26,9,PRICE_TYPICAL,MODE_MAIN,1);
SignalCurrent=iMACD(NULL,0,12,26,9,PRICE_TYPICAL,MODE_SIGNAL,0);
sar1_1 =iSAR(NULL,0,0.02,0.2,1);
sar1_0 =iSAR(NULL,0,0.02,0.2,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(sar1_0 <= Ask && sar1_1>sar1_0 && mom3_0<100 && MacdCurrent>SignalCurrent && stoc2k_0<=20)
   {
   ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point,0,0,Green);
   if(ticket>0)
   Print("Day Trading Buying : ", Symbol());
   {
   if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
   } 
   return(0);
   }
   
// check for short position (SELL) possibility
   if(sar1_0 >= Ask && sar1_1<sar1_0 && mom3_0>100 && MacdCurrent<SignalCurrent && stoc2k_0>=20)
   {
   ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Point,0,0,Red);
   if(ticket>0)
   Print("Day Trading 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(sar1_0 >= Ask && sar1_1<sar1_0 && mom3_0>100 && MacdCurrent<SignalCurrent && 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(sar1_0<=Ask && sar1_1>sar1_0 && mom3_0<100 && MacdCurrent>SignalCurrent && 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);
   }
   
//+------------------------------------------------------------------+

Profitability Reports

USD/CAD Oct 2024 - Jan 2025
0.03
Total Trades 10
Won Trades 8
Lost trades 2
Win Rate 80.00 %
Expected payoff -457.38
Gross Profit 143.88
Gross Loss -4717.65
Total Net Profit -4573.77
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.00
Total Trades 1
Won Trades 0
Lost trades 1
Win Rate 0.00 %
Expected payoff -5853.00
Gross Profit 0.00
Gross Loss -5853.00
Total Net Profit -5853.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
2.04
Total Trades 31
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 12.32
Gross Profit 750.00
Gross Loss -368.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%

Comments