Latest changes to this post in red typeface
Disclaimer: The attached indicator is supplied 'as is', free of charge. No warranty or obligation of support is implied. Download and use it at your own risk. I hope that you find it useful. It's the initial v1.0 release, please feel welcome to post questions, and report any bugs or shortcomings in this thread.
The News Composite indicator (NCI) plots a cumulative total of the outcome/effect of FF calendar-based news events on your MT4 charts. The indicator can plot fundamental (news-based) trends for up to 8 different currencies and/or pairs in the same window, for any combination of timeframes, although timeframes shorter than D1 are somewhat meaningless. See the screenshot below, and also posts #436 and #437 here for a conceptual overview.
Apart from Commitment of Traders, NCI is the only OHLCV-independent indicator that I'm currently aware of, for whatever that might be worth. You can use NCI to see what effect news announcements have on price, and to what extent/circumstances they might be a leading or lagging indicator.
To install, copy the attached Presets---News Composite.TXT file into the .....\experts\files folder; copy the attached News Composite.ex4 file into the .....\experts\indicators folder, and then restart MT4.
You will also need Plot_News/FFcal.EXE v 1.33, which can be downloaded from post #1 in this thread. Full installation instructions can be found there also.
The data plotted comes from a 'news file' in CSV format. You can maintain your own news file(s) and/or have FFcal.EXE assist you in creating them. The News Composite.MQ4 indicator expects the files to be named NCI1.CSV, NCI2.CSV, etc, in the ...../experts/files folder, and in the following format:
<NCI value>,<MT4 date/time>,<currency>, ...... any other info about the news event (optional)
There must be ONE news event, and at least 3 commas, on each line. The only character that's prohibited is a semi-colon (; ).
The events must be kept in descending MT4 date/time order, i.e. the latest at the top of the file.
The required steps are:
1. (optional) Run FFcal.EXE and set the NCI 'Outputs' parameter to a value > 0. When you click OK, FFcal.EXE will append any newly added events in FF calendar to your news file(s).
2. Use a text editor (e.g. Notepad) to adjust the NCI value attached to each event and/or create your own records in the news file.
3. Attach the News Composite.MQ4 indicator to your MT4 price chart(s).
If you wish to keep your NCI plots up to date, then you will need to run these 3 steps every time a news announcement occurs in real time, i.e. the 'Actual' value is populated on FF calendar.
As already explained, you may use FFcal.EXE to build the NCI1.CSV for you. Enter the parameters shown in the red area of the screenshot below. ALL news events in the Event History database will be output, regardless of any filters (date range, currency, description, impact, etc) selected. FFcal.EXE builds the file in the following format:
<NCI value>,<MT4 date time>,<currency>,<impact>,<description>,<actual>,<forecast>,<previous>,<revised from>,<ff calendar id>
Here is a sample:
-3 ,2009.04.28 10:00,EUR ,Low ,Italian Retail Sales m/m ,-0.7% ,-0.1% ,0.2% ,0.3% ,14397 4 ,2009.04.28 08:00,CHF ,Medium ,UBS Consumption Indicator ,0.99 , ,0.89 , ,13633 0 ,2009.04.28 06:01,JPY ,Low ,Bank Holiday <"AllDay"> , , , , ,12072 0 ,2009.04.28 06:01,EUR ,Medium ,German Prelim CPI m/m <"AllDay"> , ,0.1% ,-0.1% , ,11828 0 ,2009.04.28 06:01,AUD ,Medium ,HIA New Home Sales <"Tentative"> , , ,3.9% , ,14479 5 ,2009.04.28 01:50,JPY ,Medium ,Retail Sales y/y ,-3.9% ,-4.8% ,-5.8% , ,14254 0 ,2009.04.27 18:45,EUR ,Medium ,ECB President Trichet Speaks , , , , ,19837 -5 ,2009.04.27 10:30,GBP ,Medium ,BBA Mortgage Approvals ,26.1K ,29.2K ,28.0K ,28.2K ,12341 5 ,2009.04.27 08:00,EUR ,Medium ,GfK German Consumer Climate ,2.5 ,2.3 ,2.5 ,2.4 ,14210 -3 ,2009.04.27 08:00,EUR ,Low ,German Import Prices m/m ,-0.4% ,-0.2% ,-0.1% , ,11885 0 ,2009.04.26 06:01,AUD ,Low ,Bank Holiday <"AllDay"> , , , , ,12754 0 ,2009.04.26 06:01,ALL ,Medium ,IMF Meetings <"Day2"> , , , , ,19792 0 ,2009.04.24 22:30,USD ,High ,Treasury Sec Geithner Speaks , , , , ,19768 0 ,2009.04.24 20:00,USD ,Medium ,Bank Stress Test Info , , , , ,19778
Every entry (on a line) must be separated by a comma. If an entry is omitted, the comma must still be present, as a place-holder, i.e. for the file to be intelligible to FFcal.EXE, there must be exactly 9 commas present on every line. Any number of embedded spaces may be included, to improve readability. If the file is never going to be processed by FFcal.EXE, then the only entries required are: NCI value, MT4 date/time and currency, separated by commas; the rest is optional.
The <NCI value> can be any integer in the range [-99, ..., 99]. Use a leading minus sign for negative values (e.g. -6), no sign for positive values (e.g. 6). Any non-numeric value (e.g. ## – see below) will be plotted as if it was a zero value. The meaningfulness of the indicator plot is ultimately 100% dependent on the value that you arbitrarily assign to the importance of each news event. The dummy values (see below) optionally supplied by FFcal.EXE are not necessarily accurate:
- it's assumed that increasing values (trends) reflect positively on a nation's economy. With events like Unemployment, this may not necessarily be true.
- it doesn't take into account the magnitude of any difference between Actual and Previous values, e.g. it will treat a 0.3% increase in CPI the same as an 0.1% increase.
- with events where there's no Actual value, like 'Mr XXX speaks', a value of 0 is assigned. Hence it's up to you to assess the probable economic impact, and assign your own value.
The <MT4 date/time> must be in the format: YYYY.MM.DD<space>HH:MM
Errors will cause unpredictable results when the News Composite.MQ4 indicator is attached to your price charts.
The <currency> should be one of: AUD, CAD, CHF, EUR, GBP, JPY, NZD, or USD. News events labeled 'ALL' are not processed by the indicator.
FFcal.EXE creates/modifies records as follows:
1. News events not already in NCI1.CSV (i.e. freshly downloaded from FF calendar) get added to the file:
-- if the 'Auto' parameter is unchecked, FFcal.EXE will place a double hash (##) in the NCI value, as a place-holder, for you to later edit manually. The rest of the detail (date/time, currency, description, etc) is copied from FF calendar.
-- if the 'Auto' parameter is checked ON, FFcal.EXE will calculate and assign a dummy NCI value. The rest of the detail (date/time, currency, description, etc) is copied from FF calendar.
NOTE: The dummy NCI value is calculated as follows:
- if the Actual > Previous (or Revised From, if non-blank), then the outcome is deemed to be favorable, and a base value of 2, 4 or 8 is assigned, for a low, medium or high impact event, respectively
- if the Actual < Previous (or Revised From, if non-blank), then the outcome is deemed to be unfavorable, and a base value of –2, –4 or –8 is assigned, for a low, medium or high impact event, respectively
- if the Actual > Forecast, the base value is adjusted by +1
- if the Actual < Forecast, the base value is adjusted by –1
- anything else results in a value of 0
2. For news events already in NCI1.CSV (regardless of whether previously created by FFcal.EXE, or by the user):
-- if the 'Auto' parameter (see red area of screenshot below) is unchecked, FFcal.EXE leaves all such records completely untouched
-- if the 'Auto' parameter is checked ON, FFcal.EXE will leave the record untouched, unless there is one or more hash character(s) in the NCI value field, in which case it will calculate and assign a dummy value as described above
FFcal.EXE will automatically sort the file into descending MT4 date/time sequence (a requirement of the News Composite.MQ4 indicator).
FFcal.EXE can create multiple NCI files: NCI1.CSV, NCI2.CSV, etc. Set the 'Outputs' parameter (see red area of screenshot below) to the number of files you require. For example, setting the parameter to 2 would create 2 files: NCI1.CSV and NCI2.CSV. Each file can be used to store/plot different sets of values, e.g. NCI1.CSV plots the longer term trends by comparing Actual and Previous values; NCI2.CSV plots the shorter term impact by comparing Actual and Forecast values. I expect that most users will use only one file. If you don't require NCI plotting, simply set the 'Outputs' parameter to 0.
The News Composite.MQ4 indicator
This must reside in the ...../experts/indicators folder. Attach it to any MT4 chart in the normal manner, by dragging it onto the chart from the Navigator.
You can set the parameters either by using MT4's built-in dialog, when you attach the indicator; or by overriding these settings using the Presets---News Composite.TXT file (use a text editor like Notepad to view/edit the file). Using the file allows you to save preset values, retaining them for each future time you attach the indicator. To disable an entry in the file, start the line with two slashes (//). To re-enable it, remove the slashes. You may use any number of embedded spaces or underscores, and/or any combo of upper or lower case, to aid readability, however you wish. Every line MUST end with a semi-colon (; ). To save typing and improve accuracy, copy/paste the sample lines in the file. To disable the entire file, rename it, or delete its content; if the file doesn't exist, the Parameter Dialog entries (when you attach/edit the indicator) will be used. To have any changes take immediate effect, either (1) re-attach the indicator to your chart; (2) edit the indicator (press Ctrl-I); or (3) toggle between timeframes.
To expand/compress the plot(s) horizontally, zoom in/out using the +/– keys.
To expand/compress the plot(s) vertically, drag the window separator upward/downward.
- NCIFile: should be NCIn.CSV
- EventsLookback: default is the max permitted value of 9999. Set to a lower value to possibly improve computer performance.
- TimeFrames: D1 is recommended. Use W1 and MN if you have enough news history. Timeframes shorter than D1 may be used, but are essentially meaningless. If you want to plot multiple timeframes in the same window, separate timeframe identifiers with commas, e.g. D1, W1. Embedded spaces, to improve readability, are optional. Any combination of upper or lowercase may be used. If the parameter is left blank, it will default to the timeframe of the chart to which it's attached.
- NumPoints: the currently forming candle is point 0. Prior points are 1,2,3, etc. To see an NCI plot corresponding to the last 30 candles' worth of data, enter 30. This parameter applies to all timeframes being plotted.
- BasePoint: the 'zero' point, which must be between 0 and NumPoints, from which all differences will be calculated/plotted. If you enter a negative number, BasePoint is set to the same value as NumPoints, i.e. the plot is zero-centered at the left of the chart. Applies to all timeframes being plotted
- SmoothingSMA: enter a value to smooth the plots (applies to all timeframes being plotted). A value of 1 means no smoothing, since a simple moving average of 1 averages the current point only. Smoothing introduces lag and also distorts the zeroing around the BasePoint. Note that the sum of the NumPoints and SmoothingSMA values must not exceed 500. Alternatively, you can use MT4's facility of dragging MAs and other indicators down into the window, and set them to 'Previous indicators data' (the white dotted line in the screenshot below).
- TextColor/Font/Size: sets the typeface for the captions plotted. Font name must be spelled correctly for Windows to recognize it. Color must be spelled correctly, but may contain embedded spaces, and upper/lower case may be used interchangeably
- ___CcyOrPairN___: you may enter either a valid currency (e.g. JPY, or ---JPY for an 'inverted' plot) or pair (e.g. GBPJPY, or JPYGBP for an 'inverted' plot) supplied by your broker. Upper or lowercase doesn't matter. Since MT4 allows 8 buffers, up to 8 currencies and/or pairs may be plotted. If you leave all 8 blank, then the parent pair's chart (the chart to which the indicator is attached) will plot in the first buffer. If you enter a currency, only events affecting that currency are plotted. If you enter a pair, events affecting either currency in the pair are plotted. Events positive (i.e. a positive NCI value) to the first currency in the pair, or negative to the second currency, will cause an increasing plot; events negative to the first currency in the pair, or positive to the second currency, will cause a decreasing plot.
- CPn_Color: select a color for each of the (up to) 8 different plots.
- CPn_Style: enter a style for each of the (up to) 8 different plots. Valid values are 10=solid line; 11=dashed line; 12=dotted line; 13=dash-dot; 14=dash-dot-dot; 20, 30, 40, 50 = solid lines of width 2, 3, 4, 5, respectively.