Momentum Capture EA

12 August 2017, 19:07
Roman Lengert
2 355

Important note:  On some of the symbols there might be missing H1 bars as MT4 only loads bar data on demand. H1 bars are required for ADR calculation and will influence the overall trade behavior. To force MT4 to load the bar data it is best to open H1 charts for every symbol you want to trade before you use this EA for the first time on a newly installed MT4 platform. 

Also, I would remove all symbols that you don't trade from the Market Watch to reduce the overall data demand. 

Addionally, make sure that your VPS has the correct time, else it might lead to MT4 showing the wrong GMT time. Just check with some economic calendar if the next news event that is showing on the chart has the correct GMT time. 

What settings are used for the signal accounts?

Since May 2018 I am using the default settings on all my accounts. So just attach the EA to any chart (I use EURUSD H1) and only adjust lot size for your desired risk. For additional protection you could also adjust the equityHardStop. 

I am using 0.01 lots per 1600 EUR balance (about $2000). I can not set the risk for you, please consider yourself what risk you are willing to take and whether a leverage up to 10 is ok with you. Else please use a higher equityPerStep value (I would use less risk on bigger accounts personally, but it is your decision). 

It might happen in rare cases after a strong reversal move that there will be a signal for a market order while also a pending order is open from the initial movement. In those cases with maxMarketOrdersAllSymbols=16 and maxStopOrdersAllSymbols=16 it could in in theory lead to up to 32 open positions even though it would be very unlikely that this happens on all symbols and time frames at the same time. The parameter closePendingOrdersInSameDirection=true can be used to prevent such behavior if one wants to follow strict risk rules.

Complete Parameter List

  #------------------------------ General Trade Settings ------------------------------#

  • IMPORTANT: every symbol should be added to only ONE of the four symbol lists else it might be traded twice!
  • symbolsNormal - comma separated list of symbols to trade with events from both currencies. 
  • symbolsIgnoreUSDevents - These symbols will also be traded but not on USD events. 
  • symbolsIgnoreEURevents  - These symbols will also be traded but not on EUR events. 
  • symbolsIgnoreJPYevents - These symbols will also be traded but not on JPY events. 
  • symbolsIgnoreGBPevents - These symbols will also be traded but not on GBP events. 
  • closeOnlyMode - If you don't want to open new positions. Or if you are afraid that your VPS might crash, you could run it with closeOnlyMode on a second VPS. 
  • tradeM5 - whether to use the M5 timeframe.
  • magicM5 - magic number for trades entered on M5 timeframe signals.
  • tradeM15 - whether to use the M15 timeframe.
  • magicM15 - magic number for trades entered on M15 timeframe signals.
  • tradeM30 - whether to use the M30 timeframe.
  • magicM30 - magic number for trades entered on M30 timeframe signals.
  • tradeH1 - whether to use the H1 timeframe.
  • magicH1 - magic number for trades entered on H1 timeframe signals.
  • 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 value (in account currency) the EA will close open positions (only of this strategy) and will not open any new positions. 
  • maxMarketOrdersAllSymbols - in case you want to limit the total number of open orders.
  • maxStopOrdersAllSymbols - this will limit the number of stop orders for reversal signals.
  • pipInPoints - for 5-digit brokers, this should be 10, for 4-digit brokers 1.
  • debugMode - if true the EA will print some debug information when it checks for trade entries. So if you observe that you have trades different from my signals or the backtests, you can send me the log file and I will try to find out what caused the differences. 
  • usePipsScaledToADR - if true the pip value will be scaled to the average daily range, so 40 pips could then mean something between 20 and 80 normal pips. 
  • allowHedge - If false it will only allow sells when not buys are open and will only allow sellstops below the lowest buy stop loss and the other way around. If set to true then running one time frame should be FIFO complient, but not running multiple time frames!
  • closePendingOrdersInSameDirection - If true, it will close any pending buy orders on the same symbol and time frame if there is a signal for a market buy order, same for sell orders. If false, it could sometimes lead to more than 4 open positions on one symbol. 
  • baseComment - to customize the comment.

  • #------------------------------ Auto Settings ------------------------------#

  • useAutoSettings - whether to use the internally stored entry and exit settings. Included settings are: waitTimeAfterNews, momentumStrengthMarket/Pending, expirationHours, stopLoss, takeProfit, trailingStop, trailingStart, breakEvenTo, breakEvenAt, closePartOfPositionsEarlier, entryMinutesAfterEvent, tradeAfterCPI. All other settings will be taken from the input parameters. 
  • autoAllowCPIonSomeSymbols - If true, the auto settings will allow to trade CPI events on those paris: EURUSD, EURAUD, GBPUSD, AUDUSD. Those pairs were chosen so that we have some exposure on CPI events, but not too much. 
  • autoScaleFactor - This parameter is for a quick way of diversification. It will scale SL, TP, BE, trailing start, trailing stop by the factor specified. It will also scale the entry strength parameters, but not as much because those are more sensitive. For example, instead of running one set with 0.03 lots, you could run 3 sets with 0.01 lots and scale factors 0.9, 1.0 and 1.1. This way your entries and exits will be slightly different on each set. 

    #------------------------------ Overwritable Settings ------------------------------#

  • waitMinutesAfterNews - how long to wait after a news event (in Minutes). If set to -1, it will use the bar period of each time frame. 
  • momentumStrengthMarket: Trend strength needed to trigger market orders.
  • momentumStrengthPending: Trend strength needed to trigger pending orders.
  • stopLoss - maximum stop loss used. 
  • takeProfit - take profit for trade exit. But usually the strategy will exit via trailing stop.
  • trailingStop - trailing stop in pips.
  • trailingStart - when to start the trailing stop.
  • trailingStep - step size to modify the stop loss.
  • breakEvenAt - when to set the breakeven stop loss.
  • breakEvenTo - how many pips above/below the entry price the breakeven stop loss should be placed.

  • #------------------------------ Entry Settings ------------------------------#

  • slippagePoints - maximum allowed slippage in points (not pips).
  • 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). 
  • maxStopOrderDistance - maximum distance of pending orders from the current price. 
  • maxAllowedMovement - maximum allowed movement. With this setting we avoid trading on crazy breakouts like the CHF spike on 2015.01.15. 
  • expirationHours - how long the pending orders should be active. 

  • #------------------------------ Time Settings ------------------------------#

  • liveGMToffset - In case you want to set the GMT offset manually yourself. Keep in mind that on most brokers the GMT offset will change twice a year because of daylight saving time. 
  • closePartOfPositionsEarlier - if true and there are multiple orders on a strong trend, it will close some of those orders after a specific time to reduce the risk and lock in profits. On some symbols this was better historically, but on other it is better to let the position run to catch longer trends. 
  • entryMinutesAfterEvent - how long signals should be traded after a news event. 
  • minUpdateTimeMillis - in case there was no tick for some time (given in milliseconds), you can set an independent update interval.
  • minTradeIntervalMinutes - Minimum time between new orders on the same symbol and time frame. 
  • startHourGMT - when to start trading (GMT).
  • endHourGMT - when to stop trading (GMT).
  • fridayEndHourGMT - when to stop trading (GMT) on Fridays.
  • closeAllPositionsOnFriday - whether to close positions before weekend. 
  • fridayCloseHourGMT - When to close in case closeAllPositionsOnFriday=true. 
  • skipWeekend - whether to skip Saturday and Sunday. 

    #------------------------------ News Filter ------------------------------#

  • useNewsFilter - If false, it will trade all the time and not look for news. It is not recommended as the settings are much too aggressive to be profitable all the time. But you can set it to false if you want to manually enable the EA at an even that is not shown in the economic calendar.

  • With the following parameters you can decide, which events to trade. I recommend only central bank events and speeches. 

  • tradeAfterCentralBankEvents = true
  • tradeAfterSpeechesAndTestimonies = true
  • tradeAfterCPI = false
  • tradeAfterGDP = false
  • tradeAfterNFP = false

    #------------------------------ Tester Settings ------------------------------#

  • testerGMToffset - if you do not use tick data in GMT format, then you need to specify the GMT offset in the tester if the news filter is used. 
  • testerIgnoreCurrency - In case you want to test the backtest with only events from one currency, then type in the other currency here. 

    Only for MT5 version:

  • testerGMToffsetBeforeYear20XX  - GMT offset until year 20XX.
  • testerGMToffsetAfterYear20XX - GMT offset after year 20XX.
  • year20XX - Year when GMT offset changes (if it does not change in your data, just set the upper two parameters to the same value)
  • testerDaylightSavingTime - Wether your broker uses daylight saving time for historic data. 

Backtest with news data and correct GMT offset (MT4)

IMPORTANT: The EA uses H1 data for ADR calculation, so the backtest should be run using H1 time frame to make sure it is available. The MT4 backtester might not load enough days before start. In Tick Data Suite set "Bars before data:" (advanced tab) to a high value. For H1 for example to 2000. 

Follow these steps to do a backtest with news filter from historic news events. 

  • Make sure you know the GMT offset of the historic chart data you got in your MT4 terminal. Best would be to download it from Dukascopy in GMT fromat. If you don't have GMT format, set the TesterGMToffset to the correct value. If you are not sure, best look at the latests big news, which caused a breakout on the chart and check the time with any economic calendar in GMT format, for example at .
  • Download the historic news event file from my website (backtest will also work without that file but only until end of 2017): 

  • 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 and check in visual mode whether the next events are printed in the lower left corner of the chart. In the journal it should als print "Reading from file...". 

Backtest with news data and correct GMT offset (MT5)

Sadly there is no Tick Data Suite for MT5. So we have to use the default data (H1 time frame). Also it is not possible to change the spread, so it might be that your broker has much better live spreads than shown in the historic data. 

  • The GMT offset is a bit tricky on MT5. I found that it can vary between brokers and might not even be conistent during the years. For example, the metaquotes demo data I used had GMT offset 1 until 2015 and 2 afterwards. Also it used daylight saving time, which makes it even more complicated. For that reason, I added the paramters
    TesterGMToffsetBeforeYear20XX = 1  - GMT offset until year 20XX.
    TesterGMToffsetAfterYear20XX = 2 - GMT offset after year 20XX.
    Year20XX = 2015 - Year when GMT offset changes (if it does not change in your data, just set the upper two parameters to the same value)
    TesterDaylightSavingTime = true - Wether your broker uses daylight saving time for historic data. 
  • The news events from 2010 to the date of the last update are already stored within the ex4 file, so you only need to download the historic news event file if you want to test more recent events: 

  • 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:


    Create it if it does not exist. 
  • Run the backtest and check in visual mode whether the next events are printed in the lower left corner of the chart. In the journal it should als print "Reading from file...". 

Backtest results with tick data and slippage simulation (version 2.4)

The chart below shows the historic backtest for the complete recommended portfolio for a fixed lot size and a period of more than 8 years. Real Dukascopy tick data was used with variable spread, commission of 5 USD and an execution delay of 150 ms to simulate slippage. The individual backtests can be downloaded as a zip-file at the end of this blog post. 

To limit the maximum amount of open positions not every EUR symbols is used for EUR events. So we have a maximum of 4 pairs for each currency event. This way there should not be more than 16 positions open at the same time. There fore the backtest is valid for a start balance of about $1600 to $2000 depending on the risk. 

Share it with friends: