Momentum Capture EA

12 August 2017, 19:07
Roman Lengert
0
127


Backtest with news data and correct GMT offset (MT4)


IMPORTANT: The EA uses daily data for ADR calculation and the MT4 backtester might not load enough days before start. So either use D1 timeframe for testing or increase the bar number. In Tick Data Suite set "Bars before data:" (advanced tab) to a high value. For M5 for example to 15000. 

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 https://www.forexfactory.com/calendar.php .
  • Download the historic news event file from my website: 
          http://currencystrength.de/static/historic_news_events.dat
  • Open MT4, go to File -> Open Data Folder. Then copy the file historic_news_events.dat into the directory \tester\files. Create it if it does not exist. 
  • Set TesterUseNewsFilter=true to use the news data in tester. 
  • Run the backtest and check in visual mode whether the next events are printed in the lower left corner of the chart.


Backtest results with tick data and slippage simulation


The chart below shows the historic backtest for the complete recommended portfolio for a fixed lot size and a period of 8 years. Real Dukascopy tick data was used with 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. 

Because we use fixed lots the yearly percentage profit was historically about 68% per year ($8750 / 8 / $1600). 




Complete Parameter List


Important note: If you get the message on expert tab "Error: ADR zero for XX.", it means that the EA does not get the data for that symbol. You have to add all symbols that should be traded to the Market Watch list in MT4. If they are already on the list, it could still happen that the EA does not get the data on the first try if you never opened a chart with daily timeframe of that symbol before. But if you see the ADR printed on the screen than the message is not relevant anymore because the EA got the data on second attempt. You can re-attach the EA to the chart to double check. If the Error persists, try opening a chart with daily timeframe for the specific symbol to force MT4 to load the daily candles. 


  #------------------------------ General Trade Settings ------------------------------#
  • symbolsNormal - comma separated list of symbols to trade.
  • symbolsIgnoreUSDevents - These symbols will not use USD events. 
  • symbolsIgnoreEURevents  - These symbols will not use EUR events. 
  • symbolsIgnoreJPYevents - These symbols will not use JPYevents. 
  • 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).
  • slippage - maximum allowed slippage.
  • 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.
  • 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. 

    #------------------------------ Entry Parameters ------------------------------#

  • useAutoEntryAndExitSettings - whether to use the internally stored entry and exit settings. 
  • waitTimeAfterNews - how long to wait after a news event. 
  • momentumStrengthMarket/Pending: Trend strength for entry. 
  • 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.

    #------------------------------ Exit Parameters ------------------------------#

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

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


  • 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.
  • 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 ------------------------------#

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

  • tradeAfterCentralBankEvents = true
  • tradeAfterSpeechesAndTestimonies = true
  • tradeAfterGDP = false
  • tradeAfterCPI = 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. 


Files:
Share it with friends: