See also our website: http://currencystrength.de/newssniper/
Without these files the strategy won't work.
I will update these files every month to include new events.
Historic event file entries:
occurrences: total number of occurrences of the event
nonZeroOccurrences: number of occurrences where there was a difference to forecast value
websiteImpact: impact given on the website (between 1 and 3)
direction: whether a positive change is positive for that currency (not for the currency pair!)
currencyDirection: Whether a positive event for that currency is positive for the pair. For example for EURUSD, positive EUR events are positive for the pair and positive USD events are negative.
differenceToForecast: mean difference between actual value and forecast value
movementPerSign: directional price movement 10 minutes dependent on the direction of that event
movementZero: directional price movement 10 minutes after news event when there was no difference to forecast value
maxMinPerSign: the larger value of (max - priceBeforeNews) and (priceBeforeNews - min), where min and max are taken from a 10 minute duration after news (dependent on the direction of that event)
maxMinZero: same value as above when there was no difference to forecast value
range10afterNonZero: price range 10 minutes after news event when there was a difference to forecast value
range10afterZero: price range 10 minutes after news event when there was no difference to forecast value
Backtesting of a news trading strategy is of course a bit more complicated than backtesting a price based strategy. First we need access to the historic event calendar. I attached the historic event HTML files to this blog post. You can also directly download them from http://currencystrength.de/static/historic_html_files.zip , which has the advantage that they will be automatically updated every day to include the last day.
Unzip the file and put the folder "historic_html_files" into the directory \Terminal\Common\File
The backtest of news strategies is always very poor because the execution at news is not considered. Make sure that the data you import has GMT/UTC time zone, else it will trade at completely wrong times! Dukascopy data for example can be downloaded in correct time zone, you can use the widget on my site http://currencystrength.de/newssniper/#historical_data or just google for historic data. I would only use Dukascopy data starting from 2011, because somehow the minute candles are much more volatile before November 14th 2010, not sure what the reason is.
IMPORTANT: all parameters are in pips not in points (1 pip = 10 points), if you want to have everything in points, just set pipInPoints = 1.
- magic - magic number used for this strategy
- pipInPoints = 10 - All parameters are in pips, which are calculated from points with this ratio.
- lots = 0.01 - lots per level. IMPORTANT: the total number of lots will be equal to: numLevels * lots. If tradePending=true AND tradeLimit=true it can be double the amount.
- numLevels = 3 - number of levels used for breakout orders and also different trailing stops
- trailingStopRangeStart = 7 - the smallest trailing stop to use. If numLevels = 1, this value will be used.
- trailingStopRangeEnd = 17 - the biggest trailing stop to use.
- slippage = 5 - slippage
- stopLoss = 50 - stopLoss used for all orders
- takeProfit = 1000 - takeProfit is very high, because the strategy usually closes positions by trailing stop, but you can also use a normal TP.
- trailingStart = 2 - only start trailing stop if the profit is higher than trailingStart
- minutesAfterNews = 2 - place orders until x minutes after news (if too large multiple events can overlap). Should be >=2 if you tradeLimit=true.
- openMultipleTimes = false - if true the strategy will open orders again if trailing stop gets hit
- minTradeInterval = 5 - minimum time difference between two trades in minutes (if openMultipleTimes is true)
- maxLossDuration = 120 - after this duration (in minutes) losses will be closed because we don't expect any further movement from the news
- minimumWebsiteImpact = 2 - minimum impact (as specified on the website) to add to daily event
- minimumHistoricVolatility = 20 - One of the most important parameters because it will determine what events to trade. The historic volatility is defined as max(range10afterNonZero, range10afterZero) in historic event files.
- tradePending = true - Whether pending orders should be created before news. These will be deleted as soon as the event results are available. But on very strong movements they can get hit within 1-2 seconds.
- secondsBeforeNews = 7 - When to place the pending order (if tradePending is true). The orders will be modified until news time to aviod getting hit from random volatility, which can still happen if the movement is very fast. Most brokers execute on a "first come, first serve", so it might have negative effects if this value is too small.
- breakoutOffset = 10 - This value is added to the trailing stop. For example, a trailing stop of 10 would have a breakout distance of 20.
- minBreakout = 20 - Minimum value for the breakout distance from the high/low of the last minute candle before the news.
- tradeInstant = true - Whether the strategy should trade instantly based on the result of the news event.
- minimumExpectedPipsInstant = 20 - Minimum calculated expected pips to open a position based on the news results.
- tradeLimit = false - Whether it should open limit orders on retracement levels of the first minute candle after news.
- minimumExpectedPipsLimit = 10 - Minimum calculated expected pips to place limit orders.
- retracementPercentage = 25 - Retracement level in percentage of the first minute candle after news.
- decreaseExpectedPipsByPreviousMovement = false - As described above to include the effect of "buy the rumor sell the fact".
- minPreviousPips = 30 - Only apply this change if the price movement during the last 6 hours is greater than this value.
- previousMovementWeight = 0.8 - Weight of the pips already moved before news.
- trailingPerPip = 0.1 - Amount to lower the trailingStops in the direction where the price has already moved (because we expect a less strong movement if the price has already moved).
- startHour = 0 - Hour of day (GMT) to start trading.
- endHour = 24 - Hour of day (GMT) to end trading.
- updateSeconds = "2,4,6,9,13,18,24,30" - Seconds after news at which the strategy will retry to get the result from the website. It might be too much to update every second because you may get problems when your server spams to many requests. Also the request takes some time.
- randomEventsForTester = false - If true it will generate random events for strategie tester, this will of course just be 50/50 wins. The mql-team asked for this option, but if you want a good backtest download the data as described above.