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, QFS for QuantFlow Scalper, DW for Delta Wave EA and DS for Density Scalper.
I use default settings (no set files) on my signals. All signals also use the breaking news filter. Some of the parameters depend on either risk settings or broker, therefore I cannot set them for you. Please follow the instructions below.
The EAs save historc data in a file, which will be used when you restart the EAs. Therefore, the EA should be active continuously without interruptions (also Friday evening) else it might load too old data on restart.
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 QFS 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:
- Please add the following URLs under Tools -> Options -> Expert Advisors -> Allow Webrequests for listed URL:
http://breaking.fxdata.cc (only needed if you use the breaking news filter, which all my signals are using)
- 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 (press Ctrl+U to see all symbols). Open an M5 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.
- For DS, DW and QFS 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.
- Lot size (fixed or increasing): Select the lot size according to the risk you want to take. The combination of 0.01 lots NW + 0.02 lots QFS (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 QFS . 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 QFS 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.
- 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.
- 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 7 standard pairs was about $345 for 0.1 lots or about $35 per 0.01. When adding some of the experimental pairs, I would estimate it to be rather $40-50, 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 / 50 * 0.01 = 0.4.
For QFS the maximum drawdown was around $55 per 0.01, which can be used to scale the lot size similarly to DS. For the same example, it would be 2000 / 55 * 0.01 = 0.36
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. 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.
There is never any guarantee that the future drawdown will be less than the historical one. Therefore, please don’t overrisk your account.
What is the difference between the night scalpers?
They have a fundamentally different logic as to how the price channel is calculated as well as differences in entry/exit logic. All show promising backtests and therefore I decided to use them as diversification instead of combining them to just one logic. QFS and DS also only trades exactly one hour before and one hour after swap time. This specific strategy only works on a few pairs while NW and DW use more pairs and the time window is at least up to 6 hours on some pairs. But this does not mean that NW/DW are necessarily better. Right now the performace of DS and QFS is actually better as it is sometimes better to focus on the few pairs that work best.
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.
- The GMT offset must be the same as in the backtest data used. For backtests the EA will use the values given by parameters manualGMToffsetWinter/manualGMToffsetSummer. Default is 2/3. So if you use TDS, you could just keep the default settings for the EA and set the TDS time zone to GMT+2 with US DST.
Usually I use TDS with real ticks, time zone GMT+2 with DST, 5 USD commission and 150-250 ms execution delay. On some pairs for NW I use a spread multiplier of 0.7-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).
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:C:\Users\YOUR_USER_NAME\AppData\Roaming\MetaQuotes\Terminal\Common\Files
- Run the backtest. 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.
Also, the all my night scalper signals use the 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.
The account uses 0.05 lots NW + 0.02 lots QFS per 1000 EUR, which means a maximum historic drawdown of about 25%. 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. For the CAD and AUD pairs for QFS I also reduced the risk slightly compared to the others with 0.03 lots.
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 QFS with the default settings maxPositionsAllSymbols=5 and maxCurrencyPositions=2 for NW and maxPositionsAllSymbols=2 for QFS, you could have 0.05 lots open for NW and 0.04 for QFS, so a total of 0.09. But since NW also checks the currency, it would be max 0.02+0.04=0.06 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.
- addToExitThreshold – This value will be added to the stock market filter threshold and losses will be closed if the threshold is reached. For example, if maxPercentageDecline=1.5 and addToExitThreshold=0.5, then it would not allow to open positions if the stock market change was worse than -1.5%, but it would only close losses if it was worse than -2.0%.
- pauseMinutesAfterStockTrigger – The interval for which trades will not be allowed after the stock market filter triggered. Each pair has a different threshold for the stock market filter, so it can happen that one pair triggers, but another is allowed to trade.
- 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.
- modifyEntryPips – this parameter can be used for diversification with multiple settings. The value (in pips) will be added to the entry level (later entry). Negative values would result in earlier entries.
- modify ExitPips – this value (in pips) will be added to the exit level.
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 QFS 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
- maxPositionsSameSideXXX – allowed position for currency XXX (XXX = GBP, CAD, CHF or NZD).
- maxPositionsSameSideOthers – allowed positions for other currencies
- symbolPrefix – has to be entered in case your broker has a prefix with symbols like xxEURUSD.
- negativeSwapFilter – Option “Off” will not check the swap. “Triple swap day” will only filter out negative swap on triple swap day. “All days” will filter negative swap on all days. “Max negative points” will allow a certain level of negative swap given by maxNegativeSwapPoints.
- maxNegativeSwapPoints – The maximum number of points of negative swap that will be allowed for positions opened before swap time (if the broker calculates swaps in points).
- tripleSwapDay – Day at which tripple swap is applied. On most borkers it is Wednesday. With “Auto” option it will try to determine the triple swap day automatically from the given MT4 information. The EA will print the day in the Expert log, so you can double check if it is correct.
- swapHourGMT – Swap hour used if dontTradeWednesdayNegativeSwap=true.
Share it with friends: