Displaying Info in
- Calling External DLL Functions
Custom News Sources
1. Setup the news sources (for MT4 news sources)
Warning: MT4 news sources often can be significantly delayed, it is not recommended to use (only) MT4 sources for trading on real accounts! For real trading, please purchase the Full version and use the faster custom news sources. Click here for more info.
Some MT4 brokers known to provide market news are: EXNESS (demo/real accounts), FxPro (demo/real), NordFX (real), AxiTrader (real), MIG Bank (real), Alpari UK (real). This is not a complete list of brokers with news, you can try other brokers also. It is not required to trade with any of these brokers, they can be used just for receiving the news. For trading almost any broker can be used (including non-MT4 brokers), it only needs to execute trades fast enough.
For brokers that require real accounts to get news, investor logins/passwords which can be sometimes found on the web also work OK (have the news feed).
For testing the news reader you can try the following MT4 broker with investor access:
Broker name: EXNESS
MT4 download link: http://files.metaquotes.net/exness.ltd/mt4/exness4setup.exe
Recommended Data Center (click on MT4 connection status image to select): DC-MAIN
Short name: EXN
Path to terminal.exe: enter the MT4 installation directory (example: "C:\Program Files (x86)\MetaTrader - EXNESS")
Window title pattern: Exness
To receive info about all recommended news sources (access info, setup instructions, settings), including the fastest custom news sources, please purchase the Full version. Click here for more info.
Download the MT4, install, and enter the settings in NAT (Options -> News Sources -> Add)... Make sure in MT4 options "Enable news" is checked (should be checked by default).
If the MT4 was just installed and you had chosen the option to launch it after installation ("Launch program after successful installation"), the news reader may not work on first run (Windows Vista and later), because the MT4 is running with Administrator privileges. Simply restart the MT4 to fix the problem. The same can happen after installing MT4 updates.
Be aware that the news tab in MT4 terminal may not appear immediately, until any news is received for the first time. During weekends there may be no new news. All charts can be closed, they are not necessary to receive the news.
Launch the MT4 terminal(s). You can use the "Launch MT4s" button in NAT to launch them all at once. To save desktop space you can click "Hide All" to hide the windows (MT4 terminals will run in background).
Click "Start" in main window to check that the news headlines are readable by NAT.
Read about optimizing the MT4 news sources here.
2. Find tradable news
The following sites can be useful:
http://www.forexpeacearmy.com/forex_news_calendar/ (site may not work on old browsers like IE8) - you can also view historical price action of news events (click on event name to view all history). Very useful for researching tradable news, deviations, and to find the best currency pairs to trade.
http://www.forexfactory.com/calendar.php - forecasts (consensus) can be outdated.
NAT includes scripts for the following economic indicators:
Canada Core CPI
Canada Core Retail Sales
Canada Employment Change (includes Unemployment Rate)
UK Interest Rate
UK Interest Rate + APF (Asset Purchase Facility)
UK Retail Sales
US ADP Report
US Consumer Confidence
US Core CPI
US Core Durable Goods Orders
US Core Retail Sales
US Existing Home Sales
US Interest Rate
US ISM Manufacturing PMI (includes Prices Index)
US ISM Non-Manufacturing PMI
US Nonfarm Payrolls (includes Unemployment Rate)
US Unemployment Claims
To trade other news releases you can create your own scripts, if the used news sources provide the necessary economic data.
3. Edit the news script(s) and setup the triggers using News Script Editor (NSEditor)
Warning: be aware that you need to edit the scripts and update the triggers (consensus (forecast) numbers and deviations) for each trade!
Click the 'Script Editor' button in main NAT window to open the editor, open the script for news event you want to trade, and update the consensus and (optionally) deviation trigger numbers.
Consensus numbers can be found in the calendar sites above and they usually don't differ much. Numbers at http://www.forexpeacearmy.com/forex_news_calendar/ site are usually pretty accurate and can be used "as is".
// EDIT THE LINES BELOW TO SETUP THE TRIGGERS. REMEMBER, YOU NEED TO DO THIS FOR EVERY NEWS TRADE!
cns=2.7; // quarterly GDP consensus
// deviation triggers:
posdev=+0.4; // buy USD/JPY
negdev=-0.4; // sell USD/JPY
strongposdev=+0.8; // buy USD/JPY
strongnegdev=-0.8; // sell USD/JPY
For existing scripts the recommended deviations are included and recommended currency pair(s) to trade are provided in comments, but it is advised to do your own research to determine the best settings. Usually for US news the best pair to trade is USD/JPY, for UK news - GBP/USD, for Canada news - USD/CAD or EUR/CAD. Be careful to not choose the wrong currency pair to trade!
You can test the scripts with your own made-up headlines by using the "Testing sandbox" in the editor.
4. Trade the news
It is best to prepare about 10 minutes or more before the news are released.
Stop all downloads and close all other unnecessary programs that use the internet connection for best trade execution speed.
When the script(s) are ready and according to the news calendar schedule news are soon to be released, prepare for the trade:
4.1. In NSEditor, click "Attach" button to activate and initialize the script you want to use.
4.2. Make sure all MT4 terminals used for news reading are launched.
4.3. Launch the trading broker platform, open the order window(s), select the currency pair you have chosen to trade and set trade size (lots/units).
If these are your first news trades, it is advised to trade on either demo account or use a small trade size.
4.4. Setup the autoclick: click "Coords" button in main NAT window and set the broker order window button coordinates (BUY/SELL, also BUY+/SELL+, if you want to differentiate the trade size) by using the "Q", "E", "T", "U" hotkeys. Example: move the mouse cursor over order window BUY button and press "Q", then move the cursor over order window SELL button and press "E".
Example setup for MT4:
Coords or NAT window needs to be active for hotkeys to work. All settings are applied immediately, you can close the Coords window when done. Coordinate settings are not saved when NAT is closed, they need to be re-entered each time NAT is launched.
If you want to trade with more than one broker simultaneously, setup Click 2, 3,... coordinates to other broker order window BUY/SELL buttons. You can also select the Click number by using hotkeys "1" - "5" (can be useful to set coordinates without opening the Coords window).
Note: In virtual machines (VMWare, Virtual PC) the simulated mouse pointer movement may appear to not work, however the mouse clicks should still be registered correctly.
4.5. Make sure the news reader is started to process the incoming news (click "Start" in main NAT window).
4.6. About 1 minute before the news are released:
- Click (check) the "autoexecute" checkbox to
enable the autoclick.
- Advised: hold the mouse cursor over
"autoexecute" checkbox and monitor the broker spread for the
selected pair and the price action. This way in case the spread is
increased too much or the price spikes before you get a signal (if
you receive news too late), you can disable the execution of the
trade by quickly clicking the "autoexecute" checkbox again to
disable autoclick and thus prevent a potentially bad trade.
- If you get a signal (this will
appear in NAT signal panel) and the trade is executed,
use your discretion to close the trade (trades need to be closed
manually). In most cases it's recommended to close trades in 1-3
minutes or less.
Main NAT Window Interface
In case some main window interface functions are not clear at first, here it is fully explained:
1. Opens the Manual
Buy/Sell coordinate setup window (to setup the broker order window button
coordinates, where the autoclick should do a mouse click
when a trade signal is generated).
2. Enables/Disables the autoclick function.
3. If a script is attached to NAT the window title will show the title defined by script + current local time in 24 hour format.
4. Starts/Stops the news reader (all available news sources, including custom news sources in NAT full version).
5. The "Results panel". Scripts use it to display the economic indicator consensus numbers, deviations, etc. Default label meanings: cns - consensus, act - actual, dev - deviation, pre - previous, rev - revision, rdev - revision deviation. Default labels can be renamed or hidden by scripts, new labels can also be created.
6. The "Signal panel". Displays the signal that was generated by script from processing the incoming news. Supported signals: "BUY", "BUY+" (means strong buy), "SELL", "SELL+" (means strong sell), "No Trade", "Cancel" (means "cancel trade" - can be used to inform the trader about possible conflict in later received news, suggest to close the trade as soon as possible).
7. Number of active news sources. If news reader is stopped, value is 0.
8. Number of new news headlines received. After 999 headlines the value is reset to 0.
9. The "Headline box". Click right mouse button to copy the selected headline to clipboard or clear all headlines/messages.
10. Launches the News Script Editor (NSEditor). With right mouse click you can remove(detach) the currently attached script.
11. Launches all MT4 terminals which are setup in options.
12. Closes all MT4 terminals.
13. Shows all MT4 terminals which were previously hidden.
14. Hide all MT4 terminal windows (they will be running in background).
15. MT4 terminal selection box (for showing/hiding specific terminals).
16./17. Show or Hide selected MT4 terminal. Note: in Full version if you are using the Console Application custom news source, console window can be also shown/hidden.
18. Opens the options window...
Automatic Buy/Sell Button Location
This feature allows to automatically locate the buttons to click in broker platform when a trade signal is generated, so you don't need to specify the coordinates manually each time. However, it is limited to only a single mouse click per trade signal.
It should work for most broker platforms.
How it works: order window(s) are located by their window title and classname, which need to be specified. Button locations are determined by using the specified relative coordinates from within the window (window client coordinates, not absolute coordinates of the screen). If there are multiple order windows, correct window and button to click (Buy/Sell/Submit/etc.) is determined according to horizontal window placement on the screen/desktop.
There are 4 allowed order window placement configurations:
1. Single order window that contains both Buy and Sell buttons (Example: MetaTrader 4). Window can be placed anywhere on the screen, but Buy/Sell buttons need to be visible. X and Y coordinates specify the Buy button location and X2 and Y2 the Sell button location within window. In case of BUY+/SELL+ signals, the same Buy/Sell buttons of this window will be clicked (if there is only one order window). Example:
2. Two order windows that each contain both Buy and Sell buttons. The window which is positioned more to the left will be used for clicking on BUY/SELL signals, the window more to the right on BUY+/SELL+ signals. Window vertical placement is irrelevant, but Buy/Sell buttons need to be visible. X and Y coordinates specify the relative Buy button location and X2 and Y2 the relative Sell button location within each window and need to be the same for both windows. Example:
3. Two order windows that each contain a single button to open the trade. Whether it's Buy or Sell order needs to be specified in each order window or otherwise (Example: OANDA). The window which is positioned more to the left will be used for clicking on BUY or BUY+ signal, the window more to the right for SELL or SELL+ signal. Window vertical placement is irrelevant, but buttons to click need to be visible. Relative X and Y coordinates which specify the button location need to be the same for both windows. X2 and Y2 should not be specified, "Buy and Sell buttons within the same window" needs to be unchecked. Example:
4. Four order windows that each contain a single button to open the trade (can be used with OANDA). Whether it's Buy or Sell order needs to be specified in each order window or otherwise. The leftmost positioned window will be used for clicking on BUY signal, next window to the right - for SELL signal, next window again to the right - for BUY+ signal, the rightmost window - for SELL+ signal. Window vertical placement is irrelevant, but buttons to click need to be visible. Relative X and Y coordinates which specify the button location need to be the same for all 4 windows. X2 and Y2 should not be specified, "Buy and Sell buttons within the same window" needs to be unchecked. Example:
1. In "Options->Clicker->Buy/Sell button location method" select "Custom".
2. Enter the info in section "Custom button location method (single click limit)".
2.1. Open the broker platform order window.
2.2. For "Order window title pattern" enter the title (caption) of the order window. If the title is not constant (for example, includes the currency pair name), use partial title (the non-changing part of it).
2.3. Click "Show visible window titles and classnames" and find the classname of the order window. Enter it in field "Window classname".
2.4. Specify the X,Y and, if necessary, also X2,Y2 coordinates of the buttons within the order window. This will need to be done by trial and error. Use the Buy/Sell test buttons with clicking disabled while the order window is open to test the current coordinates and adjust the coordinates (remember to click "Apply" each time), until the mouse cursor is moved to desired location when using the test buttons.
Note: in virtual machines (VMWare, Virtual PC) the simulated mouse pointer movement may appear to not work, however the mouse clicks should still be registered correctly.
Warning: when not using the test buttons, order window placement configuration is verified and remembered on enabling the autoclick ("autoexecute" checkbox in main NAT window). Window configuration should not be changed afterwards (or disable/enable the autoclick again).
For MetaTrader 4 platform try these settings:
Order window title pattern: Order
Check "Allow only exact match"
Window classname: #32770
X position: 633
Y position: 230
Check "Buy and Sell buttons within the same window"
X2 position: 424
Y2 position: 230
For OANDA fxTrade platform try these settings:
Order window title pattern: Market Order
"Allow only exact match" unchecked
Window classname: SunAwtFrame
X position: 136
Y position: 442
"Buy and Sell buttons within the same window" unchecked
Note: Provided coordinates are for 96 DPI system setting. If you are using other DPI setting or the platform interface is changed, they'll need to be updated.
Optimizing MT4 News Sources
By default you may not receive news from MT4 brokers optimally fast. Some suggestions:
1. Remove the unnecessary symbols (currency pairs) from MT4 "Market Watch" window. You may need to close the open charts and restart the MT4 terminal first to do this. This decreases the incoming traffic and can decrease the news latency (can help to receive news faster). Unfortunately if you remove all symbols (current MT4 versions), then on restarting the terminal the default symbols will reappear. The solution is to leave just one symbol in Market Watch window.
2. MT4 brokers often use multiple servers (Data Centers / Access Points) and they can have different news delivery speed. If you click on Connection Status image (on right-bottom side of terminal window), there is a server selector. Unfortunately there is no easy way to find out which server will deliver news the fastest without using multiple PCs or virtual machines (to be able to compare). Usually the main server or one which is close to it is the best.
Be aware that the server selection doesn't always stay. On reconnects, platform restarts, etc. you may be reconnected to a different server! If you know the Data Center hostname/IP address:port you can manually specify the server address in the terminal (Tools->Options->Server).
MT4 news source setup example (one symbol, no charts):
About Log Files
Unless headline logging is disabled in NAT options, each attached script will use a separate log file with the same filename as the script, but with .txt extension. If a log file already exists with the same filename, new entries will be appended to it, the file will not be overwritten.
Because file writes are buffered (4KB write buffer is used, for better performance), headlines in log files may not appear immediately.
If no script is attached then headlines are still logged to file "newslog.txt" (unless logging is disabled).
Test headlines used in "Testing sandbox" (NSEditor) are not logged.
Default log files directory can be changed in NSEditor (Options -> Script & Log paths).