Download MetaTrader 5

How Reliable is Night Trading?

2 August 2013, 08:15
Shashev Sergei
2
5 055

Introduction

Over the last six months, we have seen a lot of Expert Advisors that earned good money without virtually any risk involved, by simply trading in the night on EURCAD, GBPCAD, EURCHF and other currency pairs. Trading on Alpari's PAMM accounts that employ this tactics has demonstrated indeed amazing results. Negative feedback on using this trading system is however not uncommon. The purpose of this article is to see if night flat trading is really profitable and to identify all hidden dangers of such trading on a real account.

Theory

The figure below shows typical night flats. The image is not the best for the given strategy but this choice is intentional. The night flat boundaries are quite vague. We can say that for EURCHF the flat starts at 18:00-20:00 and ends at 10:00-14:00 server time. We will take it as the period from 18:00 to 10:00.

The night flat usually lasts during the Pacific and Asian trading session and is characterized by low volatility of the majority of currency pairs.



Implementation

First off, let's roughly define how the Expert Advisor for night flat trading should operate.

1) Deal opening time – not earlier than a specified hour

2) Deal closing time – not later than a specified hour

3) TP – quite close, from 10 to 50 points

4) SL – greater than TP, from 30 to 70 points

5) Market entry – price is near the flat boundaries

6) Flat boundaries are determined in the last hours before the beginning of the flat

7) Number of night deals may be limited which is due to the fact that entering into Sell or Buy more than once and exiting with profit is rare; the second market entry often results in closing with a loss by the end of the night flat.

The above points can be implemented like this:

// External variables
extern double    Lots=1;
extern int       h_beg=20;
extern int       h_end=10;
extern int       TakeProfit=20; 
extern int       StopLoss=90;

// Auxiliary variables
double max;
double min;
int slippage=5;
int magik=5;
int pos=0;

//Counter of deals over the night session
int Buy_count=0; 
int Sell_count=0;
 
//Function for closing an order
bool CloseOrder()
{
   int ticket,i;
   double Price_close;
   int err;
   int count=0;
   int time;      
       for(i=OrdersTotal()-1;i>=0;i--)
       {
          if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
            if (OrderSymbol()==Symbol())           
                if(OrderMagicNumber()==magik)
                   {                                                                
                     if(OrderType()==OP_BUY)      
                        Price_close=NormalizeDouble(Bid,Digits); 
                     if(OrderType()==OP_SELL)       
                        Price_close=NormalizeDouble(Ask,Digits); 

                     if(OrderClose(OrderTicket(),OrderLots(),Price_close,slippage))                        
                           return (true);
                   }                                         
      }
return(false);
}

//Taking a decision 
int GetAction()
{
   int TotalDeals;
   int type=0;
   int N=OrdersTotal(); 

// Counting current positions     
   for(int i = N - 1; i >= 0 ; i--)
      {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         if( OrderSymbol()==Symbol())
            TotalDeals++;
            type=OrderType();       
       }    

   if (TotalDeals==0)
   {
      pos=0;
   }
   else
   {
      if (type==OP_BUY)
         pos=2;
      if (type==OP_SELL)
         pos=-2;
   }

// Beginning of the night session, determination of the flat boundaries by two preceding bars
   if (Hour()==h_beg)
   {
      max=MathMax(High[1], High[2]);
      min=MathMin(Low[1],Low[2]);
      Buy_count=0;
      Sell_count=0;
   }

// End of session, closing of all positions and disabling trading operations by the Expert Advisor
   if ((Hour()>=h_end)&&(Hour()<h_beg))
   {
      Buy_count=1;
      Sell_count=1;
      max=0;
      min=0;
      if (TotalDeals!=0)
         CloseOrder();
   } 

// Checking for position opening       
      if ((Bid>max)&&(max!=0)&&(pos==0)&&(Sell_count==0))      
            pos=-1;                  

      if ((Ask<min)&&(min!=0)&&(pos==0)&&(Buy_count==0))             
            pos=1;     

   return (0);       
}

//Processed at every tick
int start()
  {
   int action;
   double profit;
   double stop=0;
   double price=0;
   int ticket=-1;  

   GetAction();   
   if (pos==1)
         {
               stop=NormalizeDouble(Ask-StopLoss*Point,Digits);
               profit=(min+TakeProfit*Point);             
               pos=2;                                      

               while (ticket<0)
               {
                  if (!IsTradeContextBusy( )) 
                     ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,slippage,0,0,NULL,magik,0,Green);
                  if (ticket>0)
                     OrderModify(ticket,0,stop,profit,0,Blue);                           

                  if(ticket<0)
                     Print("OrderSend failed with error #",GetLastError());

                  Sleep(5000);
                  RefreshRates();
               }
               Buy_count=1;                       
         }  

   if (pos==-1)
         {
               stop=NormalizeDouble(Bid+StopLoss*Point,Digits);
               profit=(max-TakeProfit*Point); 
               pos=-2;                                   

               while (ticket<0)
               {
                  if (!IsTradeContextBusy( )) 
                     ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,slippage,0,0,NULL,magik,0,Green);

                  if (ticket>0)
                     OrderModify(ticket,0,stop,profit,0,Blue);                           

                  if(ticket<0)
                     Print("OrderSend failed with error #",GetLastError());

                  Sleep(5000);
                  RefreshRates();
               }
               Sell_count=1;
        }                            
   return(0);
  }


Testing

As can be seen on the below chart, some deals are truly amazing: buying virtually at LOW and selling virtually at HIGH of the night price range. There are some exceptions that are usually closed after the set time.

The testing shows that the given Expert Advisor would be able to earn more than 30% over a couple of months trading with one lot with the deposit of $10,000. If we further increase the risks, we will be able to see how trading on Alpari's PAMM accounts could yield results of 1000% over just a couple of months.

Practical Application

Of course, it's not all roses, otherwise we would have seen a dramatic increase in dollar millionaires over the last 6 months to a year. What stands in the way of earning superprofits when doing night trading?

1) Night spreads are 1.5 to 2 times wider for the currencies that are especially good for night trading – EURCHF, GBPCAD and EURCAD.

2) Upon large dramatic profits trading conditions in some Dealing Centers may become considerably more unfavorable

3) One may come across a series of large losing trades, e.g. upon intervention on EURCHF/USDCHF

4) TP values need to be constantly adjusted, mostly downwards. And while in winter we could take profit at 40 points for a deal on EURCAD, now this value is around 20.

The Expert Advisor for night trading provided in the article is very basic and can be made considerably more complex. This can be done in many ways, including:

1) scaling in;

2) volatility analysis;

3) news analysis (to avoid intervention risks);

4) analysis of major currency pairs underlying the cross currency pairs (e.g., for EURCHF those will be EURUSD and USDCHF);

5) more complex entry algorithms.

The template provided in the article can be used in real work. It earned around 50% per annum over 6 months during which it was used. And even though this Expert Advisor itself is currently of little usefulness, this article can give impulses to new ideas that will potentially be used by the forum users and the author of this article.

Conclusion

Night trading offers good profit opportunities in winter, while getting trickier in spring and even more so in summer. Given the trend, it is difficult to make any statements regarding autumn. However this strategy has the right to exist as the deposit on a real account was increased through its application.

The future will tell whether the strategy has outlived its usefulness or not. Being fundamentally very basic, the Expert Advisor provided in the article can nevertheless be shelved and used again when stable night flats are seen again.

Translated from Russian by MetaQuotes Software Corp.
Original article: https://www.mql5.com/ru/articles/1373

Last comments | Go to discussion (2)
sixty8doors
sixty8doors | 13 Sep 2013 at 17:46

Very interesting! I'm having very good returns trading at night while sleeping. Im in Pacific time, which is when Europe is awake. I set up my trades and go to bed. In the morning Im usually pleasantly surprised.

I would love to give this a try. How do I ago about testing this? Do I copy/paste the code and save it as an MQ4 file and put into my experts folder?

Many Thanks! Dave

savitara
savitara | 7 Nov 2015 at 18:05
sixty8doors:

Very interesting! I'm having very good returns trading at night while sleeping. Im in Pacific time, which is when Europe is awake. I set up my trades and go to bed. In the morning Im usually pleasantly surprised.

I would love to give this a try. How do I ago about testing this? Do I copy/paste the code and save it as an MQ4 file and put into my experts folder?

Many Thanks! Dave

Its easy to create MQ4 file. Open Meta Trader 4 and Click Navigator (Ctrl+N).Right click Expert Advisor and choose Create in Meta Editor. When the Meta Editor opens choose expert Advisor template. Then click Next to get a window where you can give a name to your file.Click next until you get an edit environment for your file. Delete the contents in the file (Ctrl+A) Then copy the program code from the source article and paste in this new file. Click Compile and run. You will be back in MetaTrader. Check in Navigator if your new file name is visible.  Now you can run it in tester. Happy testing
Money Management Revisited Money Management Revisited

The article deals with some issues arising when traders apply various money management systems to Forex trading. Experimental data obtained from performing trading deals using different money management (MM) methods is also described.

Alert and Comment for External Indicators (Part Two) Alert and Comment for External Indicators (Part Two)

Since I published the article "Alert and Comment for External Indicators", I have been receiving requests and questions regarding the possibility of developing an external informer operating based on indicator lines. Having analyzed the questions, I have decided to continue with the subject. Getting data stored in indicator buffers turned out to be another area of interest to users.

Simple Methods of Forecasting Directions of the Japanese Candlesticks Simple Methods of Forecasting Directions of the Japanese Candlesticks

Knowing the direction of the price movement is sufficient for getting positive results from trading operations. Some information on the possible direction of the price can be obtained from the Japanese candlesticks. This article deals with a few simple approaches to forecasting the direction of the Japanese candlesticks.

Expert Advisor for Trading in the Channel Expert Advisor for Trading in the Channel

The Expert Advisor plots the channel lines. The upper and lower channel lines act as support and resistance levels. The Expert Advisor marks datum points, provides sound notification every time the price reaches or crosses the channel lines and draws the relevant marks. Upon fractal formation, the corresponding arrows appear on the last bars. Line breakouts may suggest the possibility of a growing trend. The Expert Advisor is extensively commented throughout.