PDA

View Full Version : Build Neural Network Indicator in MT4 using Neuroshell



AllisonJexy
05-24-2015,
Develop a Neural Network based indicator has some advantages:
- Indicator may consist of a predicted values, as a leading indicator.
- This leading indicator will be useful prior placing any trade
- Neural network training can be performed using available softwares (freeware and commercial are available).
- the trained NN can be implemented as indicator in Metatrader either written neural configuration (weight) or calling the dll.

As a sample of NN implementation, I found the following link as the starting point:http://forums.babypips.com/57970-post1.html
Here I attached all file discussed on above link, basic idea to create the neural net is explained on the file (description.doc).

Using the same idea, I use Neuroshell to train the neural network and implement it in MT4 to create the indicator.

The following steps to build the NN:
1. Prepare the training data,i.e. consist of inputs and outputs for NN. Using MT 4 script to collect the data. Input can be indicators available in MT4 such as EMA, RSI, CCI, WPR etc. The output can be predicted EMA, Close, etc which useful for our trading depend on the NN strategy (back propagation, kohonen, PNN, GRNN, or GMDH).
2. Train the network using neuroshell:
- Create new problem
- Advanced NN: loading the data, define input/ouput, extract data (training and testing), design NN to choose NN strategy, create the dll using run time facilities.
3. Copy the created dll into MT4 folder.
4. Create MT4 indicator which consist of: dll file link definition, NN initiation OpenNet (in MT4 init function), calculate the indicator using FireNet and CloseNet (in MT4 deinit function). FireNet is used to firing the neural network using inputs as defined while preparing the data to get the NN output (predicted data).
5. Improving indicator, in my attachment I use moving average and comparison between the output net to generate trading signal and classifier indicator.
6. Converting MT4 indicator to expert advisor (I need some one to help me to create the EA based on created indicators).

AllisonSype
05-26-2015,
Hi,
I just uploaded the indicator file, net file and instruction to use them.

To use a script file, you should copy NeuralTrainingsetCreator.mq4 (and ex4) into folder
..\experts\script\, to use it expand the +script from navigator MT4 terminal, double click the file. You need to close and reopen MT4 if you can't see it.

The format data file is suitable for SNNS or JNNS (http://www.ra.cs.uni-tuebingen.de/SNNS/) which free downloaded. It is cheapest solution if you do not have
any commercial software to train your NN.

Other freeware is BMP that you can download from dit.ipg.pt/MBP/. All software and tutorial can be downloaded as well.

Sorry I could not tell more about SNNS or BMP since I am not use it extensively rather than Neuroshell, but I am sure it will help you much to learn neural network.

Good luck

allongJax
05-27-2015,
I wish to predict 5 bar of High and Low in advance. The preparation done as the following:
1. Network Design
- input NN:
High(t), High(t+1), High(t+2), High(t+3), High(t+4), High(t+5),
Low(t), Low(t+1), Low(t+2), Low(t+3), Low(t+4), Low(t+5),
Close(t), Close(t+1), Close(t+2), Close(t+3), Close(t+4), Close(t+5)

- Output NN:
High(t-1), High(t-2), High(t-3), High(t-4), High(t-5) for Network 1
Low(t-1), Low(t-2), Low(t-3), Low(t-4), Low(t-5) for Network 21

- Network architecture:
3 hidden slabs, with 38 neurons, input slab with 15 neurons and output slab with 5 neurons.
Learning rate, momentum, and initial weight using default values
Pattern selection: rotation, Weight updates: Turboprop, Save training: best test set, event since min. avg. error=1,000,000.

2. Data preparation (using MT4 script, in csv format) to collect all required inputs and outputs.

3. Training performed, transfer created dll into MT4 folder.
4. Use the indicator.

Any other ideas are appreciated.

Cheers

AllassoN
05-28-2015,
Yes, regardless the quality of prediction (right or wrong), the intention is to next 5 bar high and low price (the next price range).

I have been inspired by the following article
http://www.tradetrek.com/Education/w...n5forecast.asp (http://www.tradetrek.com/Education/webclassroom/nn5forecast.asp)

I think the quality of neural network prediction will be based on inputs, outputs and the neural network it self. Any other influence such as fundamental news announcement is not part of this NN input, hence we can not expect that the price range will be valid when the fundamental news announced.

Cheers