Implement Neural Network in MT4
Implement Neural Network in MT4
1. Plan your idea, what symbol, from where data will be collected (broker), time frame, software
that will be involved, select prediction/classification target (output) and inputs, data range, etc.
2. Collect Data:
a. Manual Export from MT4 History Center (F2)
b. Create Indicator, expert advisor or script to export data from MT4
Data shall consist of all inputs and outputs data. Inputs can be indicators value available in MT4
and output is the target of neural network prediction/classification. Most of time, output can be
future indicator values, such as 10 bar in advance of moving average, percent change, optimal
Buy and Sell, etc.
Data shall be in ASCII format (csv, txt, dat, etc) that can be read by the Neural Network software.
Select the data range for neural network training, it should consist of all market condition:
uptrend, downtrend and sideway.
Verify any error in data, since it will impact the network quality.
3. Train Neural Network
a. Copy the training data into Neural Network working folder
b. Split data into: optimization, validation and production (out of sample). Percentage can
be 70% (O), 20% (V), 10% (P) or others.
c. Run the optimization using any available training algorithm
d. Verify the result (based on R‐squared, MSE, %direction, correlation, etc)
e. Select the best neural network model
f. Save the trained neural network data (weight factors, bias, neural network
configuration, etc). Some software offering dll server/wrapper, source code generator
into C, visual basic, etc.
4. Deploy Neural Network into MT4
a. Using Dll Server, such as .def file in NS2, .md file in CH, etc.
b. Using source code generator in C, VB or FLA that consist of all information about trained
neural network (weight factor, bias, formula that showing relation between inputs and
outputs). Using this code we can create a dll file or convert the code into mq4.
c. Create indicator to call trained neural network file (.def, .md or dll).
d. Create Expert Advisor to implement the trained net trading system.