
How Reliable is Night Trading?
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 Ltd.
Original article: https://www.mql5.com/ru/articles/1373





- Free trading apps
- Free Forex VPS for 24 hours
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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
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
Hi!
I am new to MQL and did the EA and it seems to work when testing, and that's great and all. I am really thankful!
... But as I said, I am kinda new and would love some more explanation on everything.
I guess I could start by asking my own questions, and maybe, if you have time I'd love to read the answers! :)
So...
1. the integers ticket, err and time that are defined within the function for closing orders. They are not being used, am I correct on that? I have commented them out and nothing bad seems to happen from that.
2. The "Auxillary" double variables, max and min are for calculating the boundries by two proceeding bars... could you explain that part step by step? what it means and what one would do if one wanted to use 3 bars or 6 bars, etc.?
3. Even though the extern int TakeProfit is saying 20 (or whatever it might be) the take profits during testing can be something completely different. I am sure it depends on something?
Also, when setting up expert properties in MT4, the settings look something like this (image below). There are 4 different columns - "Value", "Start", "Step" and "Stop"... What are they, decided upon in the code? Even if they aren't thre because of anything in the code, if somebody has answers, I would still like to know!
Thank you in advance!
Best regards!
and also... why is there a "int slippage = 5" in the auxiliary variables? what is it for?