Author: Copyright � 2005, NazFunds Company
Profit factor:
0.26
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It can change open orders parameters, due to possible stepping strategyIt automatically opens orders when conditions are reached
Indicators Used
MACD HistogramStochastic oscillatorParabolic Stop and Reverse systemMomentum indicator
Miscellaneous
It issuies visual alerts to the screen
9 Views
0 Downloads
0 Favorites
DayTrading
//+------------------------------------------------------------------+
//|                                                   DayTrading.mq4 |
//|                               Copyright © 2005, NazFunds Company |
//|                                          http://www.nazfunds.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, NazFunds Company"
#property link      "http://www.nazfunds.com"
// A reliable expert, use it on 5 min charts with 20/pips profit limit. 
// Do not place any stop loss. No worries, check the results 
extern double lots         = 1.0;           
extern double trailingStop = 15;            // trail stop in points
extern double takeProfit   = 20;            // recomended  no more than 20
extern double stopLoss     = 0;             // do not use s/l
extern double slippage     = 3;
// EA identifier. Allows for several co-existing EA with different values
extern string nameEA       = "DayTrading";  
//----
double macdHistCurrent, macdHistPrevious, macdSignalCurrent, macdSignalPrevious;
double stochHistCurrent, stochHistPrevious, stochSignalCurrent, stochSignalPrevious;
double sarCurrent, sarPrevious, momCurrent, momPrevious;
double realTP, realSL;
bool isBuying = false, isSelling = false, isClosing = false;
int cnt, ticket;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init() 
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit() 
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start() 
  {
// Check for invalid bars and takeprofit
   if(Bars < 200) 
     {
       Print("Not enough bars for this strategy - ", nameEA);
       return(-1);
     }
// Calculate indicators' value  
   calculateIndicators();                       
// Control open trades
   int totalOrders = OrdersTotal();
   int numPos = 0;
// scan all orders and positions...
   for(cnt = 0; cnt < totalOrders; cnt++) 
     {        
       // the next line will check for ONLY market trades, not entry orders
       OrderSelect(cnt, SELECT_BY_POS); 
       // only look for this symbol, and only orders from this EA        
       if(OrderSymbol() == Symbol() && OrderType() <= OP_SELL && OrderComment() == nameEA) 
         {   
           numPos++;
           // Check for close signal for bought trade
           if(OrderType() == OP_BUY)  
             {           
               if(isSelling || isClosing) 
                 {
                   // Close bought trade
                   OrderClose(OrderTicket(),OrderLots(),Bid,slippage,Violet);   
                   prtAlert("Day Trading: Closing BUY order");
                 }         
               // Check trailing stop
               if(trailingStop > 0) 
                 {             
                   if(Bid-OrderOpenPrice() > trailingStop*Point) 
                     {
                       if(OrderStopLoss() < (Bid - trailingStop*Point))
                           OrderModify(OrderTicket(), OrderOpenPrice(), 
                                       Bid-trailingStop*Point,OrderTakeProfit(),0,Blue);
                     }
                 }
             } 
           else 
             // Check sold trade for close signal
             {                              
               if(isBuying || isClosing) 
                 {
                   OrderClose(OrderTicket(), OrderLots(), Ask, slippage, Violet);
                   prtAlert("Day Trading: Closing SELL order");
                 } 
               if(trailingStop > 0) 
                 // Control trailing stop
                 {             
                   if(OrderOpenPrice() - Ask > trailingStop*Point) 
                     {
                       if(OrderStopLoss() == 0 || OrderStopLoss() > Ask + trailingStop*Point)
                           OrderModify(OrderTicket(), OrderOpenPrice(), 
                                       Ask + trailingStop*Point, OrderTakeProfit(),
                                       0, Red);
                     }           
                 } 
             }
         }
     }
   // If there is no open trade for this pair and this EA
   if(numPos < 1) 
     {   
       if(AccountFreeMargin() < 1000*lots) 
         {
           Print("Not enough money to trade ", lots, " lots. Strategy:", nameEA);
           return(0);
         }
       // Check for BUY entry signal
       if(isBuying && !isSelling && !isClosing) 
         {  
           if(stopLoss > 0)
               realSL = Ask - stopLoss * Point;
           if(takeProfit > 0)
               realTP = Ask + takeProfit * Point;
           // Buy
           ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, slippage, realSL, realTP, 
                    nameEA, 16384,0,Red);  
           if(ticket < 0)
               Print("OrderSend (",nameEA,") failed with error #", GetLastError());
           prtAlert("Day Trading: Buying"); 
         }
       // Check for SELL entry signal
       if(isSelling && !isBuying && !isClosing) 
         {  
           if(stopLoss > 0)
               realSL = Bid + stopLoss * Point;
           if(takeProfit > 0)
               realTP = Bid - takeProfit * Point;
           // Sell
           ticket = OrderSend(Symbol(), OP_SELL, lots, Bid, slippage, realSL, realTP, 
                              nameEA, 16384, 0, Red); 
           if(ticket < 0)
               Print("OrderSend (",nameEA,") failed with error #", GetLastError());
           prtAlert("Day Trading: Selling"); 
         }
     }
   return(0);
  }
//+------------------------------------------------------------------+
//|  Calculate indicators' value                                     |
//+------------------------------------------------------------------+
void calculateIndicators() 
  { 
   macdHistCurrent     = iMACD(NULL, 0, 12, 26, 9, PRICE_OPEN, MODE_MAIN, 0);   
   macdHistPrevious    = iMACD(NULL, 0, 12, 26, 9, PRICE_OPEN, MODE_MAIN, 1);   
   macdSignalCurrent   = iMACD(NULL, 0, 12, 26, 9, PRICE_OPEN, MODE_SIGNAL, 0); 
   macdSignalPrevious  = iMACD(NULL, 0, 12, 26, 9, PRICE_OPEN, MODE_SIGNAL, 1); 
   stochHistCurrent    = iStochastic(NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 0);
   stochHistPrevious   = iStochastic(NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_MAIN, 1);
   stochSignalCurrent  = iStochastic(NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0);
   stochSignalPrevious = iStochastic(NULL, 0, 5, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 1);
   // Parabolic Sar Current
   sarCurrent          = iSAR(NULL, 0, 0.02, 0.2, 0);
   // Parabolic Sar Previuos           
   sarPrevious         = iSAR(NULL, 0, 0.02, 0.2, 1);
   // Momentum Current           
   momCurrent          = iMomentum(NULL, 0, 14, PRICE_OPEN, 0);
   // Momentum Previous 
   momPrevious         = iMomentum(NULL, 0, 14, PRICE_OPEN, 1); 
   // Check for BUY, SELL, and CLOSE signal
   isBuying  = (sarCurrent <= Ask && sarPrevious > sarCurrent && momCurrent < 100 && 
                macdHistCurrent < macdSignalCurrent && stochHistCurrent < 35);
   isSelling = (sarCurrent >= Bid && sarPrevious<sarCurrent && momCurrent > 100 && 
                macdHistCurrent > macdSignalCurrent && stochHistCurrent > 60);
   isClosing = false;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void prtAlert(string str = "") 
  {
   Print(str);
   Alert(str);
//   SpeechText(str,SPEECH_ENGLISH);
//   SendMail("Subject EA",str);
  }
//+------------------------------------------------------------------+

Profitability Reports

GBP/CAD Jan 2025 - Jul 2025
2.50
Total Trades 35
Won Trades 34
Lost trades 1
Win Rate 97.14 %
Expected payoff 7.78
Gross Profit 454.28
Gross Loss -181.98
Total Net Profit 272.30
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
2.40
Total Trades 14
Won Trades 13
Lost trades 1
Win Rate 92.86 %
Expected payoff 9.29
Gross Profit 223.00
Gross Loss -93.00
Total Net Profit 130.00
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.80
Total Trades 14
Won Trades 13
Lost trades 1
Win Rate 92.86 %
Expected payoff -4.66
Gross Profit 258.34
Gross Loss -323.58
Total Net Profit -65.24
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.52
Total Trades 15
Won Trades 14
Lost trades 1
Win Rate 93.33 %
Expected payoff -17.53
Gross Profit 280.00
Gross Loss -543.00
Total Net Profit -263.00
-100%
-50%
0%
50%
100%
GBP/USD Jan 2025 - Jul 2025
0.49
Total Trades 17
Won Trades 16
Lost trades 1
Win Rate 94.12 %
Expected payoff -17.18
Gross Profit 283.00
Gross Loss -575.00
Total Net Profit -292.00
-100%
-50%
0%
50%
100%
USD/CHF Jul 2025 - Sep 2025
0.32
Total Trades 7
Won Trades 6
Lost trades 1
Win Rate 85.71 %
Expected payoff -45.77
Gross Profit 149.88
Gross Loss -470.29
Total Net Profit -320.41
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.22
Total Trades 10
Won Trades 9
Lost trades 1
Win Rate 90.00 %
Expected payoff -56.50
Gross Profit 162.00
Gross Loss -727.00
Total Net Profit -565.00
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.21
Total Trades 26
Won Trades 25
Lost trades 1
Win Rate 96.15 %
Expected payoff -48.11
Gross Profit 324.54
Gross Loss -1575.34
Total Net Profit -1250.80
-100%
-50%
0%
50%
100%
GBP/AUD Jan 2025 - Jul 2025
0.20
Total Trades 35
Won Trades 34
Lost trades 1
Win Rate 97.14 %
Expected payoff -47.55
Gross Profit 406.48
Gross Loss -2070.60
Total Net Profit -1664.12
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.20
Total Trades 17
Won Trades 15
Lost trades 2
Win Rate 88.24 %
Expected payoff -64.18
Gross Profit 281.00
Gross Loss -1372.00
Total Net Profit -1091.00
-100%
-50%
0%
50%
100%
USD/CAD Jul 2025 - Sep 2025
0.18
Total Trades 14
Won Trades 12
Lost trades 2
Win Rate 85.71 %
Expected payoff -57.81
Gross Profit 174.37
Gross Loss -983.68
Total Net Profit -809.31
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.15
Total Trades 16
Won Trades 15
Lost trades 1
Win Rate 93.75 %
Expected payoff -58.63
Gross Profit 171.11
Gross Loss -1109.21
Total Net Profit -938.10
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.08
Total Trades 8
Won Trades 7
Lost trades 1
Win Rate 87.50 %
Expected payoff -140.25
Gross Profit 101.00
Gross Loss -1223.00
Total Net Profit -1122.00
-100%
-50%
0%
50%
100%
NZD/USD Jul 2025 - Sep 2025
0.08
Total Trades 9
Won Trades 7
Lost trades 2
Win Rate 77.78 %
Expected payoff -180.22
Gross Profit 140.00
Gross Loss -1762.00
Total Net Profit -1622.00
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.05
Total Trades 36
Won Trades 29
Lost trades 7
Win Rate 80.56 %
Expected payoff -178.15
Gross Profit 353.53
Gross Loss -6766.96
Total Net Profit -6413.43
-100%
-50%
0%
50%
100%
USD/CAD Oct 2024 - Jan 2025
0.04
Total Trades 9
Won Trades 7
Lost trades 2
Win Rate 77.78 %
Expected payoff -246.38
Gross Profit 88.66
Gross Loss -2306.06
Total Net Profit -2217.40
-100%
-50%
0%
50%
100%
USD/JPY Jan 2025 - Jul 2025
0.03
Total Trades 24
Won Trades 21
Lost trades 3
Win Rate 87.50 %
Expected payoff -406.25
Gross Profit 269.14
Gross Loss -10019.19
Total Net Profit -9750.05
-100%
-50%
0%
50%
100%
GBP/AUD Jul 2025 - Sep 2025
0.02
Total Trades 16
Won Trades 11
Lost trades 5
Win Rate 68.75 %
Expected payoff -415.42
Gross Profit 145.09
Gross Loss -6791.77
Total Net Profit -6646.68
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.00
Total Trades 13
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 16.15
Gross Profit 210.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.00
Total Trades 13
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 16.15
Gross Profit 210.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
0.00
Total Trades 13
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 16.31
Gross Profit 212.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
AUD/USD Jan 2025 - Jul 2025
0.00
Total Trades 32
Won Trades 32
Lost trades 0
Win Rate 100.00 %
Expected payoff 16.62
Gross Profit 532.00
Gross Loss 0.00
Total Net Profit 532.00
-100%
-50%
0%
50%
100%
EUR/USD Jan 2025 - Jul 2025
0.00
Total Trades 27
Won Trades 27
Lost trades 0
Win Rate 100.00 %
Expected payoff 16.07
Gross Profit 434.00
Gross Loss 0.00
Total Net Profit 434.00
-100%
-50%
0%
50%
100%
NZD/USD Jan 2025 - Jul 2025
0.00
Total Trades 26
Won Trades 26
Lost trades 0
Win Rate 100.00 %
Expected payoff 15.81
Gross Profit 411.00
Gross Loss 0.00
Total Net Profit 411.00
-100%
-50%
0%
50%
100%
USD/CAD Jan 2025 - Jul 2025
0.00
Total Trades 35
Won Trades 35
Lost trades 0
Win Rate 100.00 %
Expected payoff 11.35
Gross Profit 397.12
Gross Loss 0.00
Total Net Profit 397.12
-100%
-50%
0%
50%
100%
USD/CHF Jan 2025 - Jul 2025
0.00
Total Trades 30
Won Trades 30
Lost trades 0
Win Rate 100.00 %
Expected payoff 20.19
Gross Profit 605.81
Gross Loss 0.00
Total Net Profit 605.81
-100%
-50%
0%
50%
100%
EUR/USD Jul 2025 - Sep 2025
0.00
Total Trades 5
Won Trades 5
Lost trades 0
Win Rate 100.00 %
Expected payoff 20.00
Gross Profit 100.00
Gross Loss 0.00
Total Net Profit 100.00
-100%
-50%
0%
50%
100%
GBP/CAD Jul 2025 - Sep 2025
0.00
Total Trades 2
Won Trades 2
Lost trades 0
Win Rate 100.00 %
Expected payoff 14.44
Gross Profit 28.88
Gross Loss 0.00
Total Net Profit 28.88
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.00
Total Trades 6
Won Trades 6
Lost trades 0
Win Rate 100.00 %
Expected payoff 20.00
Gross Profit 120.00
Gross Loss 0.00
Total Net Profit 120.00
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.00
Total Trades 13
Won Trades 13
Lost trades 0
Win Rate 100.00 %
Expected payoff 12.73
Gross Profit 165.45
Gross Loss 0.00
Total Net Profit 165.45
-100%
-50%
0%
50%
100%
AUD/USD Jul 2025 - Sep 2025
0.00
Total Trades 24
Won Trades 24
Lost trades 0
Win Rate 100.00 %
Expected payoff 17.71
Gross Profit 425.00
Gross Loss 0.00
Total Net Profit 425.00
-100%
-50%
0%
50%
100%
GBP/USD Jul 2025 - Sep 2025
0.00
Total Trades 18
Won Trades 18
Lost trades 0
Win Rate 100.00 %
Expected payoff 17.17
Gross Profit 309.00
Gross Loss 0.00
Total Net Profit 309.00
-100%
-50%
0%
50%
100%
USD/JPY Jul 2025 - Sep 2025
0.00
Total Trades 27
Won Trades 27
Lost trades 0
Win Rate 100.00 %
Expected payoff 12.61
Gross Profit 340.42
Gross Loss 0.00
Total Net Profit 340.42
-100%
-50%
0%
50%
100%

Comments