NY Close Scalper
This is a mean reversion strategy around the close of the New York session.
It is only designed for symbols: EURUSD, GBPUSD, EURCHF and USDCHF on M5 timeframe.
I am also testing USDCAD and EURAUD since 2019. Additionally, there are auto settings for EURCAD and EURGBP, but I am not using it on my signal account.
Please read the blog post for instructions on how to set up the EA.
Because the EA will trade around the New York close time (16:00 - 18:00 New York time), the GMT time will be different in summer compared to winter (DST: daylight saving time). But the EA has daylight saving times stored internally, so there is no need to adjust the trading hours manually.
Please allow web requests to the following URLs for the calendar news filter and automatic GMT offset calculation:
- http://breaking.fxdata.cc (only needed if you use the breaking news filter)
For backtest you should use GMT offset 0 (or set testerGMToffset to the correct value) and don't adjust for DST, the EA will do the adjustment itself.
Because this strategy is trading around swap time the spread can be very large. It is important to use real spread in backtesting and not some fixed spread. But be aware that the spread can be very different between brokers at that time.
The EA should be turned off on days of important events, for example general elections in UK, US or Europe!
Be aware that past performance is no guarantee of future profitability (the EA could also make losses) and that optimized backtest results cannot provide a realistic prediction of future profitability.
- orderComment - Each trade will show this comment in history tab.
- magicNumber - individual magic number. The EA will only manage position of the chart symbol with this magic number.
- 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).
- equityHardStop - if the equity falls below that level the EA will close open positions (only of this strategy) and will not open any new positions.
- pipInPoints - for 5-digit brokers, this should be 10, for 4-digit brokers 1.
- slippagePoints - Slippage used in OrderSend() function (points, not pips).
- maxSpreadPips - maximum spread allowed for entry. If smaller 0, auto settings will be used, which are different for each currency pair.
- liveGMToffset - To set GMT offset manually. Usually this is not needed.
- skipSunday - if true the EA will not open positions on Sunday (GMT).
- startHourGMT - when to start trading (GMT).
- endHourGMT - when to stop trading (GMT).
- waitMinutesBetweenEntries - The EA will not check for new positions during the given duration. If you are sleeping during the trading hours you could limit the potential total risk with this parameter. If the last hour was a loss the EA will automatically increase waitMinutesBetweenEntries by 15 minutes.
- dontTradeTripleNegativeSwap - If true, the EA will not open trades on before swapHourGMT when the swap is negative on days with triple swap rate.
- tripleSwapDay - Day at which tripple swap is applied. On most borkers it is Wednesday.
- swapHourGMT - Swap hour used if dontTradeWednesdayNegativeSwap=true.
- testerGMToffset - Only needed for tester because GMT time is not defined in tester and your bar data might have a GMT offset.
Please also have a look at the "What's new" tab for additional parameters.
- The maxSpreadPips settings were changed. Now every used symbol will have its own max spread value derived from optimizations.
- 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.
1) Version 2.0 will not be able to read historic data files from earlier version. Therefore, if you don't want to miss a trading day please upgrade during the morning of a weekday (not weekend).
2) Please check that the new parameter dailyEquityStopPercentage is correct for your risk settings. The EAs will stop trading and close open positions if the equity falls below this level (in percent) compared to the equity at 17 GMT (or at initialization if initialized afterwards). If you withdrew or deposited money after 17 GMT it would cause this logic to not work correctly. Please see the blog post for more information:
- There are also default settings for two new pairs, USDCAD and EURAUD.
Backtests can be found in the blog post. They look good, but I only started to test them live in 2019. Therefore, I will only use them on small risk and also not on all signals.
- The EA will now use news filter on all symbols, but with shorter pause times after events compared to NightWalker.
- 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 parameters stopDayDecember and startDayJanuary so that users can decide whether or not to pause trading during the low liquidity period around New Year.
- 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.3 to 2.2 percent.
The EA has historic 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.
dontTradeWednesdayNegativeSwap - true if you want to avoid trading in the direction of negative tripple swap.
trippleSwapDay - Day at which tripple swap is applied. On most borkers it is Wednesday.
swapHourGMT - Time of swap in winter (GMT+0), in summer it will be automatically adjusted with DST.
Be aware that the EA will always reload the historic data if it is not older than a few days. So if you intend to stop the EA for a day during the week (when the market is open), you might want to delete the historic data in the directory \MQL4\Files\NYCloseScalper_history before restarting it to prevent loading data that is too old.
- Added a parameter liveGMToffset so that those who have problems with time zone settings of their VPS can chose GMT offset manually.
- 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.
Therefore, now the EA will determine the GMT offset itself and use broker time to calculate GMT time.
You have to allow web requests to http://currencystrength.de to use the automatic GMT offset calculation.
Also added a parameter testerGMToffset to enable backtests with GMT offset. Daylight saving time will still be applied automatically, so don't backtest with DST!