Before you buy a night scalper please be aware of the risks involved:
1) Past performance is no guarantee of future profitability (the EA could also make losses).
2) The backtests shown (e.g. in screenshots) are highly optimized to find the best parameters but therefore do not give a realistic prediction of future profitability.
3) Any mean reversion can get caught on the wrong side of a fast movements due to unexpected news or flash crashes. This strategy will always use a stop loss, but still execution of the SL depends on your broker.
4) Night scalpers are dependent on good brokerage conditions, like low spread and slippage, which might be worse on high lot sizes.
This is a multi symbol mean reversion system that trades during the end of NY session and start of Asian session. You only need one chart opened to trade all symbols.
It does not use martingale or grid and uses fixed stop losses for every position.
Symbols: AUDCAD, AUDNZD, CHFJPY, EURAUD, EURCAD, EURCHF, EURNZD, GBPAUD, GBPCAD, GBPCHF, GBPUSD, NZDCAD, USDCAD, USDCHF, USDJPY
Time frame: M1
Max. drawdown in 16 year backtest: $83 per 0.01
Minimum deposit: $300 - $1000 (smaller deposits will have higher percentage risk)
The default settings are stored within the EA. Please read the blog post for instructions on how to set up the EA.
- Best used with a broker that has low spreads during the night. Many brokers have extreme spreads around swap time. Contact me if you want to analyze the spread at night.
- To use the calendar news filter, please allow requests to:
http://breaking.fxdata.cc (only needed if you use the breaking news filter)
(Tools -> Options -> Expert Advisors -> Allow WebRequests for listed URL)
- Even with news filter, you should look for major events like elections and disable the EA during those nights.
The EA saves 10 hours of bar data internally, so it is best to run it continuously on a VPS.
General Trade Settings
- dailyEquityStopPercentage: IMPORTANT: please read point 6 in the blog post.
- symbols1/2 - Two comma separated lists of symbols to trade. Suffix needs to be included if your broker uses one.
- magic - Individual magic number for the strategy
- lotType - "fixed" or "increasing", where the lot size is calculated automatically.
- fixLots - fixed lot size in case lotType = fixed
- lotStep - how much the lot size should be increased every equityPerStep (if lotType = increasing).
- equityPerStep - how much equity is needed for one lot step (if lotType = increasing).
- equityHardStop - if the equity falls below this level, the EA will close positions of this strategy and will not open new positions.
- maxSpreadPips - if the spread is below this value the entry will be allowed (pending orders will not be closed on high spread).
- maxSpreadRelativeToAverage - If the spread is smaller than the average spread multiplied with this factor, trades are allowed even if the spread is larger than maxSpreadPips (but not if it is larger than 2*maxSpreadPips).
- maxPositionsAllSymbols - Maximum number of open position on all symbols
- maxCurrencyPositions - Maximum positions per currency
- pipInPoints - For 5-digit brokers 10, for 4-digit brokers 1
- debugMode - To print some numbers into the log, which can be used to analyze the trades.
- liveGMToffset - To set GMT offset manually. Usually this is not needed.
- weekdaysToTrade - To determine which weekdays to trade. 0 is Sunday, 1 Monday, ..., 5 is Friday.
- currenciesNeverAllowedFriday - Can be used to filter out some currencies that would not be allowed to trade Friday even if weekdaysToTrade allows it.
- minTradeIntervalMinutes - minimum time between opening of orders on the same symbol
- waitAfterLossMinutes - After a loss the EA will wait the duration specified before looking for new entries.
- filterTripleNegativeSwap - If on, the EA will not open trades on Wednesday before swapHourGMTwinter when the swap is negative (to avoid triple swap on Wednesday). If set to auto, only some of the symbols will be allowed.
- swapHourGMTwinter - Swap hour (in winter) used if dontTradeWednesdayNegativeSwap=true.
For further parameters please see the list at the end of the blog post.
For live trading this update does not make a difference, so you only have to update if you want run backtests on AUDCAD, AUDNZD and EURNZD.
Changes for the new version:
- The old auto GMT solution would not work for brokers with EU DST. The new one will check the GMT offset when both EU and US DST changes.
- The Japanese holiday filter on Sundays will now only filter JPY and CHF since those are the most risky currencies with regards to flash crashes.
- Added a function to calculate DST, which should be correct until 2099.
- If the execution fails for some reason, the EA will now try to reopen the position on the next tick.
maxPositionsAllSymbols = 5
maxCurrencyPositions = 2
- Modified the entry signal slightly after optimizations.
IMPORTANT: This will also be the case if you withdraw some of the money. This option will be ignored if the margin is not enough to cover the previous lot size.
- Added parameter weekdaysToTrade, which can be used to filter out any weekday. Therefore, tradeFriday and tradeSunday variables have been removed.
- Reduced trading hours for USDCHF and USDJPY.
If auto is selected, only some of the symbols will be allowed to trade before triple swap.
- Added a parameter stopLoss for those who want to define an own value or do some optimizations.
- Changed the DST tester settings. Now there is a parameter testerDataHasDST. Set it true if you want to backtest on data with DST, like GMT+2/+3 time zone.
- As a result of the flash crash on 2nd Jan, I added parameters stopDayDecember and startDayJanuary so that users can decide whether or not to pause trading during the low liquidity period around New Year.
- Added exitLossesOnStockMarketCrashTrigger parameter. Set it to true if you want the EA to close filled positions when the crash filter triggers. Default is false.
- Added startHourGMTwinter and endHourGMTwinter for those who want to change the trading hours or want to run own optimizations.
- All calculations that used daily bars are now using hourly bars to make it more consistent between brokers with different GMT offset.
- Fixed an issue with the GMT offset during the first minutes after market open in case the EA was initialized during the weekend.
- Other small improvements for the stock market crash filter.
- Added historic SP500 data starting from 2003 to the EA file and optimized the stock market crash filter from 2003-2018.
- Added a new parameter maxPercentageIncrease to prevent trading on days with an extreme increase in stock market during the last 8 hours (0 = auto settings for each pair).
stockIndexSymbol - Here you have to insert the symbol for the S&P500 index, which is used for this filter. The default is set for ICMarkets where it is called "US500", but it might be different on your broker. To disable this filter, set the parameter to an empty string.
maxPercentageDecline - In case you want to set your own value. If it is 0, auto settings will be used, which are different for each pair in the range of 1.1 to 2.4 percent.
The EA has historical SP500 data stored internally, so it will also work on backtest (until the date of the last update). You don't have to change the stockIndexSymbol for backtests.
- A parameter maxCurrencyPositionsFriday=2 was added to reduce the risk over the weekend.
- I removed EURGBP from the default settings. We already have 4 better GBP pairs. With maxCurrencyPositions=3 an additional pair will not increase the total profit much and EURGBP always had the worst backtest from all current pairs.
- Changed default settings to maxSpreadPips=5 and maxPositionsAllSymbols=6.
- Added symbols USDCAD, USDJPY and CHFJPY to default settings.
- Added a parameter liveGMToffset so that those who have problems with time zone settings of their VPS can chose GMT offset manually.
- The EA will now save the historic data in files in the directory \MQL4\Files\NightWalker_history and load from that data after initialization. This way the EA will not need to wait hours before being able to trade. So users can modify the settings or restart the VPS during the weekend and the EA will still be able to trade Sunday night.
Be aware that the EA will always load from that data as long as it is not older than 2 days (Monday or Tuesday 4 days are allowed) and the difference to the last close is less than 50 pips.
Therefore, if you disable the EA during the week for a longer period it might be best to delete the historic data.
- Slightly improved exit logic.
- The EA will now check entry/exit every new minute instead of every new bar, which might improve consistency between different price feeds.
- It is now possible for me to add additional events in the database that NightWalker will use in its news filter (but Momentum Capture will not). This way, I can disable a currency for one night if there is some non-calendar risk event.
- Trading hours for EURNZD changed by 1 hour.
- To calculate GMT offset it will use MetaTrader 4 GMT time which depends on local PC time.
- Use MetaTrader 4 broker time for minutes and seconds (because local PC time could be off by a few seconds or more).
- Check only once on connection to the broker's server whether the MetaTrader 4 GMT time is correct. If it is not correct, an alert message will be shown.
Also, the EA will now automatically add missing symbols to the market watch.
- The EA will no longer use TimeGMT() function which depends on local PC time, but will determine GMT offset itself. It will also adjust for DST in summer.
- The time of the next news event will show on the chart as a visal feedback that the news filter is working.
- Added better spread control:
maxSpreadPips - If the spread is below this value (in pips) the entry will be allowed (old pending orders will stay active and not be closed on high spread).
maxSpreadRelativeToAverage - If the spread is smaller than the average spread multiplied with this factor, the trade will be allowed even if the spread is larger than maxSpreadPips (but not if it is larger than 2*maxSpreadPips).
- Because slippage can be very important for night trading systems, the EA will now monitor slippage. It will display the average slippages for market orders, take profits and stop losses on the chart.
It will also save the slippage for each symbol into a separate file in directory /MQL4/files/NightWalker_slippage/ (only for live trading not for tester).
- Until now, the EA only used Bid price for internal candle calculation. Now it will use the "Mid price" (Bid+Ask)/2. I hope that this way it will be more consistent with backtest and between brokers because the spread wil have a smaller influence.
- It will now only open orders after at least 3 hours of being initialized. This way we avoid wrong positions in the first minutes when the EA has not yet gathered enough data on non-chart symbols.
- Added the debugMode parameter. If true it will print out some values for analysis. If you experience different positions compared to my signal, you can send me the log files to analyze the output.