Make sure that MetaTrader 4 is installed. It will not work with MetaTrader 5. Usually it's located under C:\Program Files\MetaTrader 4 path. During NQuotes installation it will ask you to provide this path.
Unzip and run the nquotes-setup-X.exe installer and follow instructions. It will prompt you to install the .NET Framework if necessary.
This download is an evaluation version, which has all features available, but works only on demo accounts, i.e. not on real money trading accounts.
A sample project is located in "%TERMINAL_DATA_PATH%\MQL4\Projects\nquotes\MovingAverageExpert" folder, which is typically "c:\Program Files\MetaTrader 4\MQL4\Projects\nquotes\MovingAverageExpert", but can possibly be inside "%APPDATA%" if you use UAC, for example, "C:\Users\John\AppData\Roaming\MetaQuotes\Terminal\ABC123...\MQL4\Projects\nquotes\MovingAverageExpert". To know the TERMINAL_DATA_PATH of your terminal, or the "terminal data folder", use "Open Data Folder" command from the "File" menu of the terminal, as described in Data Structure in MetaTrader 4.
The sample project references nquotes.dll and implements an expert advisor in C#. You can build it with an IDE (Visual Studio, Xamarin MonoDevelop, SharpDevelop are supported), or with a provided "build.bat" script. It's also possible to build it with Mono. After the build, an expert advisor DLL is produced.
|With IDE||Without IDE|
|Open "MovingAverageExpert.sln" file and click "Build" on the IDE toolbar. Check that the build is successful in the output window.||Double click "build.bat" script. Check that the console window doesn't contain any error messages.|
Open the MetaTrader 4 terminal and login using a demo server account. If you don't have a trading account, it's possible to register a demo account.
Open "Tools - Settings" menu command, then select "Expert Advisors" settings tab.
Enable the following settings:
1. Put a breakpoint somewhere inside the "start" C# method.
2. Start debugging by hitting "F5" (Run and Debug). The "nquotes.debughost.exe" process will be started and waiting for any activity from the terminal. It's normal that the breakpoint will not become active immediately, because the expert advisor DLL is not yet loaded.
3. Go to the MT4 terminal and run the expert in "test" mode using the "Strategy tester": open "View" - "Strategy tester" in the menu, select "nquotes" expert from the list, configure the testing parameters and click "Start". At this moment the execution will be stopped on a breakpoint and you could debug your code.
To run the expert advisor without a debugger you need to put your DLL to the "Experts" folder. Copy the DLL file from your build output folder ("bin\Debug") to "%TERMINAL_DATA_PATH%\MQL4\Experts". Another option is to modify "ExpertsDirPath" in "nquotes.config" to point to your build output folder.
You can start the expert in "test" or "live" mode. "Test" mode is designed to quickly test a strategy that is implemented by an expert advisor on historical data. In the test mode the expert will receive a lot of ticks in a short period, and a profit/loss report will be generated. "Live" mode is a trading mode on the current market state. In the live mode the expert receives a tick as soon as it arrives from the broker server.
|Test mode||Live mode|
|Open "View" - "Strategy tester" in the menu, select "nquotes" expert from the list, configure testing parameters (date range, period and accuracy), and click "Start".||Drag "nquotes" expert from the navigator window to the chart window.|