Roman's Night Scalper Setup

28 January 2019, 13:11
Roman Lengert
3 918


This blog post is meant to help to set up live trading and answer the most frequently asked questions. I will be using abbreviations NW for NightWalker EA, NYCS for NY Close Scalper, DW for Delta Wave EA and DS for Density Scalper.

Fixed lot size backtests of the current version can be found attached to this blog post for NightWalker EA, NY Close Scalper, Density Scalper, and DeltaWave EA

I use default settings (no set files) on my signals, except for GBPUSD (startHourGMTwinter=22 and halfRiskExceptSunday=true). All signals also use the  breaking news filter. Also some of the parameters depend on either risk settings or broker, therefore I cannot set them for you. Please follow the instructions below. 

IMPORTANT: even if this is a lot of text, please read at least point 6 about dailyEquityStopPercentage and the section about lot size and maximum drawdown. 

The drawdown of the porfolio backtest is at least $56 per 0.01 lots for NYCS and $83 for NW. Some of my customer use very high risk, but this is the drawdown that can occur according to backtests and there is no guarantee that the future drawdown will be lower. 

How to set up live/demo trading:

  1. Please add the following URLs under Tools -> Options -> Expert Advisors -> Allow Webrequests for listed URL: (only needed if you use the breaking news filter, which all my signals are using)

  2. If you want to use the stock market crash filter, check which symbol represents the S&P500 stock index at your broker. It is usually called something like US500 or SPX500. Open a M30 chart for that symbol to force MT4 to load the new bars. It can be closed again afterwards (but the symbol should stay visible in the market watch). Insert the symbol name into the  stockIndexSymbol parameter. Leave it empty if you want to disable this filter.

  3. For DS, DW and NYCS the EA has to be attached to M5 charts for every pair. All pairs should have the same magic number (except if you use the same pair on multiple charts with different settings). For NW, put the EA on one M1 chart for a currency pair, for example EURUSD or GBPAUD. Do not attach NW to a SP500 chart as it might be closed during some hours. 

  4. lotSize: Select the lot size according to the risk you want to take. The combination of 0.01 lots NW + 0.02 lots NYCS (or DS) had a maximum drawdown in portfolio backtests of about 100 USD, so you can use this value to calculate the risk factor. For example, if you have 1000 USD and want to risk 20%, it would be 200 USD. Divide this by the 100 USD max historic drawdown and you get a risk factor of 2, meaning 0.02 NW+0.04 NYCS. If your account currency is not USD, then you have to take the exchange rate into account for risk calculation. 
    Of course, there is no guarantee that the future max drawdown will be lower than the historic max drawdown, but it is the best estimate we can do. Due to optimization bias I would also assume that it can get a bit higher. Please don't over-risk your accounts. We have seen in Jan 2019 that flash crashes can cause big losses for night scalpers. 

    If you want to use automatic lot size calculation in the example above, you would have to set lotType=increasing, lotStep=0.01 and equityPerStep=500 for NW, meaning it will increase by 0.01 (lotStep) for every 500 account currency. For NYCS it would be equityPerStep=250 in this example. For JPY you would have to multiply equityPerStep with the USDJPY rate, so it would be about 25000 instead of 250. 

  5. equityHardStop: Similar to the last parameter, if the equity falls below this level (in account currency, not percent), the EA will stop trading and close open positions. The difference is that it will not reset every day at 17 GMT. Therefore, if it triggers it will not trade at all until you change the value. For example, if you use 1000 USD and set the value to 800, it will stop trading if the equity falls below 800 USD. If you want to continue, you would have to set a new value or deposit money to the account. 

  6. dailyEquityStopPercentage: 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. Set this parameter to a value that makes sense with your risk settings. For example, if you have risk settings with 25% max drawdown, a value of about 95 (%) would make sense to close early on flash crashes. In all other scenarios it is very unlikely that we will get 1/5 of the maximum drawdown during one night. If you use too high values compare to your risk settings (for example 95 on 50% drawdown settings)  it might interfere with the normal trading because it will close open positions. I use a value of 95 on most of my signals. If you use higher risk then you need to set it to a lower value (e.g. 90 for 50% drawdown settings)!

    I think a good value for the maximum risk per night should be around 1/4 or 1/5 of your maximum percentage drawdown. Since the max historic DD was about $50 per 0.01 lots this means for example:

    equityPerStep=200  ->  max DD = 25%  ->  dailyEquityStopPercentage = 94-95 (max loss 5-6% in one night)

    equityPerStep=100  ->  max DD = 50%  ->  dailyEquityStopPercentage = 88-90 (max loss 10-12% in one night)

Frequently asked questions

How do you calculate the estimated maximum drawdown?

The portfolio backtests I show are usually done with a fixed lot size of 0.1. This means that you have to look at the fixed drawdown, not the percentage one. For example, the drawdown of Density Scalper with all pairs was about $586 for 0.1 lots or about $59 per 0.01, which you can use to scale to the desired risk level. For example, if you have a $10k deposit and you are ok with 20% ($2000) historical maximum drawdown, then the lot size would be 2000 / 59 * 0.01 = 0.34. 

Things to consider:

The maximum backtest drawdown happened in 2008 and never occurred again in later years. In 2008 the spreads were much larger than they are now and the tick data quality is also much worse for early years. So some developers argue against even using data before 2010/2011. However, since optimization usually leads to underestimation of the expected drawdown, I still prefer to use the 2008 drawdown as the best estimate. 2008 was also the year of a global financial crisis, which might be a risk factor to consider for the future.

Please also keep in mind that there is never any guarantee that the future drawdown will be less than the historical one.

What is the difference between NightWalker EA and NY Close Scalper?

They have a fundamentally different logic as to how the price channel is calculated as well as differences in entry/exit logic. Both looked good in backtests and therefore I decided to use both as diversification instead of combining them to just one logic. NYCS also only trades exactly one hour before and one hour after swap time. This specific strategy only works on a few pairs while NW has up to 15 pairs and the time window is at least 3 hours and up to 7 hours on some pairs. But this does not mean that NW is necessarily better. Right now the performace of NYCS is actually better as it is sometimes better to focus on the few pairs that work best. However, the difference in performance is also mostly due to the fact that NW was active during the flash crash on 2nd Jan 2019 while NYCS's default settings already included a trading pause from Christmas until a few days into the year (which makes sense to avoid low liquidity times with higher probability for flash crashes). 

Are the strategies safe?

Investing into a forex strategy is always a speculation on whether the future price movement will be similar to the historic movement. There are some reasons why this might be more probable, but it is never guaranteed. So there can also be no "safe" strategy no matter how well a strategy was tested and how well-intentioned the developer is. Also, forex is a zero-sum game and liqudity providers, institutional traders as well as brokers all want their piece of the cake, so it is a very competitive environment.

Why do my backtests look different?

Sadly, the only good way to do backtests that I know of is to use Tick Data Suite (TDS), which is not free. But there is a free two week trial, so you can test the EAs you are interested in. The reason why one needs TDS

  • MT4 is not using real tick data, but simulated data. Therefore, strategies that trade around swap time, where the spread can be extreme, would give very unrealistic results when tested on fixed spread or simulated ticks.

  • My EAs handle Daylight Saving Time (DST) internally. Therefore, if your backtest data already includes DST then the hours will be shifted twice in summer and give wrong results. You can use testerDataHasDST=true in case the backtest data has the DST shift. But often broker data is not even consistent in its GMT offset during the years. 

Usually I use TDS with real ticks, time zone GMT+2 with DST, 5 USD commission and 150 ms execution delay. On some pairs for NW I use a spread multiplier of 0.8 because especially in early years the spread on the backtest data from Dukascopy can be extremely high, like 10 pips on average on some symbols (not only around swap time). 

For MT5 backtester there is no TDS, therefore the best option would be to use testerDataHasDST=true and insert the correct testerGMToffset of your data. But it would probably still give wrong results if the backtest data does not have a consistent GMT offset. You could still test single years when inserting the correct testerGMToffset. Also, the MT5 data often has extremly large spreads in earlier years like 20-25 pips for some non-major pairs (and commission is added on top), so scalpers will probably not be profitable on that data. 

How do I backtest with more recent news data?

The EA has news data stored internally until the date of the last update. So you only need to follow these steps if you want to test the period after the last update. 

  • Download the historic news event file from my website: 

  • Open MT4, go to File -> Open Data Folder. Then copy the file historic_news_events.dat into the common files directory  (not the tester directory). It depends on your user name and is usually in:


  • Run the backtest. You can check in visual mode whether the next events are printed on the chart. In the journal it should als print "Reading news events from file...". 

Why are there differences between my trades and your signals?

First, if you experience large differences, you can turn on debugMode for NW, which will print some more information into the log files. Then if you noticed differences during a night, you can send me the log file afterwards so I can analyze why the differences occured. 

Generally, there are several reasons that can lead to differences. Night scalpers trade during a time where the spread can be very different between brokers. As you can see from the image below spreads can go up to 20 pips after swap time and can be very different between brokers. Even on the same broker the price feed each MT4 terminal gets might not be 100% the same. Another factor is the latency from your VPS. My VPS have a latency in the range 2-10 ms. So if yours is much slower or faster you might get filled differently. Also, the users with the fastest VPS connection will get filled first, so later ones might have higher slippage if a buy signal occurs at the same time. On fast movements however, those with slower VPS might get filled at a better price since the order will be delayed a bit. 

Additionally, the solo signals for NW and NYCS use the market version, but my combined signals use an additional breaking news filter. Additionally to the normal news filter, which can only filter events with a given date and time as found in economic calendars, the breaking news filter checks news, for example about Brexit, every minute and does not allow trading if there is such a news. However, this filter cannot be backtested, therefore it is not clear if it an improvement. I only provide it for users that trade under me as introducting broker as it requires continuous effort and higher workload for my servers. 

What risk settings does the combined account NW+NYCS use?

The account uses 0.1 lots NW + 0.2 lots NYCS on a balance of currently around 3600 EUR, which means a maximum historic drawdown of about 25-30%. You see that the live drawdown was less, but I would always estimate the expected future drawdown from the maximum value of either live drawdown or portfolio backtest drawdown. 

What is the maximum lot size that would be opened or maximum leverage used? 

The EAs have a maxPositionsAllSymbols parameter counting positions with the same magic number. The EAs will count all filled positions with the given magic number as defined in the input parameters and only allow new positions if the number is below maxPositionsAllSymbols. In very fast movements it could theoretically still happen that some of the pending orders cannot be closed fast enough and result in more positions. Because of this reason NW will only use pending orders for 3 symbols and not for all. 

NW and DW also have an additional check via the parameter maxCurrencyPositions, where the EA will check the number of positions for each currency. For example, if there is a buy signal for EURAUD, but there are already 3 open positions on AUD (AUDCAD, AUDNZD and GBPAUD) then it will not allow to open the EURAUD position. 

For the combination 0.01 lots NW and 0.02 lots NYCS with the default settings maxPositionsAllSymbols=6 and maxCurrencyPositions=3 for NW and maxPositionsAllSymbols=2 for NYCS, you could have 0.06 lots open for NW and 0.04 for NYCS, so a total of 0.1. But since NW also checks the currency, it would be max 0.03+0.04=0.07 for one currency. The used leverage depends on your balance. If you used this combination for 1000 USD it would be a max leverage of about 10. If you use it for each 500 USD it would be a max leverage of about 20. 

Parameters not explained in the description

Since there is a text limit on product descriptions, here are some explanations of parameters that are not explained there. The list might not be complete. Just write a PM to me if you have any questions. 

  • skipSunday - if true the EA will not open positions on Sunday (GMT).

  • halfRiskExceptSunday - If true, the EA will use half the risk on all days except Sunday-Monday night. I use this setting for GBP pairs until there is a Brexit solution. 

  • neverReduceLotSize. If true and lotType=increasing, then the EA will not decrease the lot size when the balance is reduced (e.g. in drawdown). 
    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. 

  • waitMinutesAfterLargeLoss and lossFractionOfSL. If a loss was larger than lossFractionOfSL times the normal SL, then new trades are not allowed for a duration of waitMinutesAfterLargeLoss minutes. 

  • stopDayDecember/startDayJanuary - To define start and stop days for the Christmas/New Year trading pause. As we have seen in January 2019 low liqidity can increase the probability of flash crashs. Therefore, it is better to stop trading until a few days into the new year. 
  • maxPercentageDecline - If the price of the stockIndexSymbol declines more than the given percentage within the last 8 hours, the EA will stop trading for the day. There are auto settings for each symbol, so you don't have to modify it except if you want to have use values.
  • maxPercentageIncrease - Similar to maxPercentageDecline, but here the EA would stop trading if the stock market gains more than the given percentage within the last 8 hours. The default values are very high since usually profitable days on the stock market are not too bad for mean reversion currency trading. 
  • exitLossesOnStockMarketCrashTrigger - If true, the EA will also close open position when the stock market crash filter triggers. 
  • testerDataHasDST - Whether or not the backtest data has DST. This is only needed for testing. Set it true if you want to backtest on data with DST, like GMT+2/+3 time zone.

  • useNewsFilter - All event filters only apply to those symbols that contain the corresponding currency. Will also work on backtest (news data included in the ex4 file until the publish date).
  • filterCentralBankEvents - if true, the EA will not trade right before or after central bank events.
  • filterSpeechesAndTestimonies - if true, the EA will not trade right before or after central bank speeches and testimonies.
  • filterHighImpact - if true, the EA will not trade right before or after high impact news like CPI or GDP.

  • addEntryPips - this parameter can be used for diversification with multiple settings. The value (in pips) will be added to the entry level (later entry). 
  • addExitPips - this value (in pips) will be added to the exit level (later exit). 

Specific for Density Scalper:

    • maxEntryPriceDeviationPoints - If the price moved more than the given value in the negative direction during entry calculation, then the order will not be sent.  
    • maxTakeProfitPips - in case you want to limit the maximum take profit value. 
    • minSecondsBetweenTPchange - in case you have problems with your broker because of too many take profit modifications, you can set this to a higher value. 

    • modifyExitPips - to modify the position of the take profit order. In contrast to NYCS also negative values are possible. 
    • agility - optimization parameter 1 for entry logic
    • fussiness - optimization parameter 2 for entry logic
    • propensity - optimization parameter 2 for entry logic

    • SLmultiplierAfterSwapTime - The EA can reduce the SL at 30, 45, 60 minutes after swap time to a multiplier (below 1). This way you can use a larger SL before the spread spike at swap time and a smaller SL afterwards. Choose -1 for default settings. 
    • additionDuringSwapHour - This fraction will be added for the modification at 30 and 45 minutes after swap time because then there will still be higher spread than usual. For example, if SLmultiplierAfterSwapTime=0.5 and additionDuringSwapHour=0.17, then the SL will be modified to 0.67 of the normal value from 00:30 to 01:00 and 0.5 of the normal value afterwards. 

    • maxPositionsAllSymbols - max positions on all symbols
    • maxPositionsSameSideCHForCAD - allowed position for CHF or CAD. With default settings only one CHF and one CAD position will be allowed. 
    • maxPositionsSameSideOthers - allowed positions for other currencies
    • symbolPrefix - has to be entered in case your broker has a prefix with symbols like xxEURUSD. 

    Share it with friends: