Build Neural Network Indicator in MT4 using Neuroshell

This is a discussion on Build Neural Network Indicator in MT4 using Neuroshell within the Trading Software forums, part of the Commercial category; Develop a Neural Network based indicator has some advantages: - Indicator may consist of a predicted values, as a leading ...

Reply
 
LinkBack Thread Tools Search this Thread
Old Jan 20, 2010, 9:12am   #1
Joined Feb 2008
Build Neural Network Indicator in MT4 using Neuroshell

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).

The original MT4 files should been modified due to the format data required on
Neuroshell is different.

Attachment explanations:
- Description.doc (brief description from the originator)
- Data collection script.zip (sample code to collect data)
- Indicator, met file, template including instruction (in zip)
- aa Neurotred.jpg (indicator produced based on Neuroshell dll)
- Neuro Trend Classifier 4H.jpg (improved indicator)

Any advice is highly appreciated.
Cheers,
Arryex
Attached Thumbnails
aa-neurotrend.jpg   neuro-trend-classifier-4h.jpg  
Attached Files
File Type: doc Description.doc (428.5 KB, 7161 views)
File Type: zip Data collector script.zip (43.0 KB, 3351 views)
File Type: zip Indicators & instruction.zip (21.1 KB, 3734 views)

Last edited by arryex; Jan 20, 2010 at 8:07pm.
arryex is offline   Reply With Quote
Thanks! The following members like this post: Charlton
Old Jan 20, 2010, 6:16pm   #2
 
2 Posts
Joined Dec 2008
Re: Build Neural Network Indicator in MT4 using Neuroshell

Dear Sir Arry,

Could you explain how to use data sets training creator as you attached above? and how it works.

Thank you
fx1st is offline   Reply With Quote
Old Jan 20, 2010, 8:21pm   #3
Joined Feb 2008
Re: Build Neural Network Indicator in MT4 using Neuroshell

arryex started this thread 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
arryex is offline   Reply With Quote
Old Jan 20, 2010, 8:35pm   #4
Joined Feb 2008
The 2nd Indicator

arryex started this thread 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
Attached Thumbnails
aaneural-predict-high-low.jpg  
arryex is offline   Reply With Quote
Old Jan 20, 2010, 8:55pm   #5
 
Pat494's Avatar
Joined Mar 2004
Re: Build Neural Network Indicator in MT4 using Neuroshell

Please excuse my ignorance but are you saying your NN will predict (rightly/wrongly) 5 bars in advance ?
__________________
Imagination is more important than knowledge.
Einstein
Imagination should be used constructively on the firm basis of knowledge.
Me
Pat494 is offline   Reply With Quote
Old Jan 21, 2010, 12:25am   #6
Joined Feb 2008
Re: Build Neural Network Indicator in MT4 using Neuroshell

arryex started this thread 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

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
arryex is offline   Reply With Quote
Old Jan 21, 2010, 1:26pm   #7
 
Pat494's Avatar
Joined Mar 2004
Re: Build Neural Network Indicator in MT4 using Neuroshell

Which NNs do you find are best forecasters ?

I have found general regression and combined adaptive time ones are best.
Although the former are a bit wilder and the latter a bit slower.
__________________
Imagination is more important than knowledge.
Einstein
Imagination should be used constructively on the firm basis of knowledge.
Me
Pat494 is offline   Reply With Quote
Old Jan 21, 2010, 1:51pm   #8
 
Pat494's Avatar
Joined Mar 2004
Re: Build Neural Network Indicator in MT4 using Neuroshell

Quote:
Originally Posted by arryex View Post
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

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
Had a look at tradetrek.
Seems that they are closing the equity side to concentrate on Forex.
NNs imho aren't quite up to speed yet. But this will change as markets become more and more predictable with better technology. Ultimately ceasing to exist.
__________________
Imagination is more important than knowledge.
Einstein
Imagination should be used constructively on the firm basis of knowledge.
Me
Pat494 is offline   Reply With Quote
Old Jan 21, 2010, 10:22pm   #9
Joined Jan 2007
Re: Build Neural Network Indicator in MT4 using Neuroshell

You may notice in the TradeTrek article quoted above that they retrain their net at the end of each day. This allows the net to adapt to nonstationarities in the FX series. The problem with using a DLL from NS is that the net is fixed in time, and unless you go through the same process (collect features, transfer to NS, train net to get DLL, use it in MT4) each and every bar (equivalent to each day at trendtech) you may be hurt by the changes in the patterns. Is there any way to simplify the training process? Is it possible to train an adaptive net, or perhaps one that used an adaptive input?
fralo is offline   Reply With Quote
Old Jan 22, 2010, 12:00pm   #10
Joined Feb 2008
Re: Build Neural Network Indicator in MT4 using Neuroshell

arryex started this thread My experience to train the network is quite faster, as you know, neuroshell was built since 2003 where only slow processor available at that time.
Now using 2000 bar data, 20% data for testing, using turboprop and event after minimum average 1,000,000 event it can be done only within 15 minutes. I am using AMD quad processor for my PC..hence the training time is not the case for me now, I can train the network any time if necessary but I will keep the net if the result still valid.

Please advice if you have any adaptive indicator available in MT4, so I can use it to train the network.
arryex is offline   Reply With Quote
Old Jan 22, 2010, 12:26pm   #11
 
Pat494's Avatar
Joined Mar 2004
Re: Build Neural Network Indicator in MT4 using Neuroshell

Quote:
Originally Posted by arryex View Post
My experience to train the network is quite faster, as you know, neuroshell was built since 2003 where only slow processor available at that time.
Now using 2000 bar data, 20% data for testing, using turboprop and event after minimum average 1,000,000 event it can be done only within 15 minutes. I am using AMD quad processor for my PC..hence the training time is not the case for me now, I can train the network any time if necessary but I will keep the net if the result still valid.

Please advice if you have any adaptive indicator available in MT4, so I can use it to train the network.
I wasn't talking about training. I meant slower to adapt to new trends as in CAT nns or more erratic as in Gr nns.
__________________
Imagination is more important than knowledge.
Einstein
Imagination should be used constructively on the firm basis of knowledge.
Me
Pat494 is offline   Reply With Quote
Old Jan 22, 2010, 6:12pm   #12
Joined Jan 2007
Re: Build Neural Network Indicator in MT4 using Neuroshell

Quote:
Originally Posted by arryex View Post
My experience to train the network is quite faster, as you know, neuroshell was built since 2003 where only slow processor available at that time.
Now using 2000 bar data, 20% data for testing, using turboprop and event after minimum average 1,000,000 event it can be done only within 15 minutes. I am using AMD quad processor for my PC..hence the training time is not the case for me now, I can train the network any time if necessary but I will keep the net if the result still valid.

Please advice if you have any adaptive indicator available in MT4, so I can use it to train the network.
Sorry, the only MT4 NN indicators I have seen are primative, and do not do the job. They are in forums on NNs in the MT4 website and ForexFactory.

My comment was more a set of questions.
How often do you need to retrain your nets?
Have you considered using the adaptive neural Indicators in NS as preprocessors to your final net?
If you used these, would your net last longer between retraining?

A final question: Do you use ChaosHunter?
Regards
Fralo
fralo is offline   Reply With Quote
Old Jan 22, 2010, 11:28pm   #13
Joined Feb 2008
Re: Build Neural Network Indicator in MT4 using Neuroshell

arryex started this thread I should explain that I am using Neuroshell2 instead of Neuroshell Trader, it is one of ward product (www.wardsystems.com).

With Neuroshell2 I can build my own prediction or classification and knowing neural net architecture (back propapagation, recurrent network, Kohonen, probabilistic neural network, GRRN, GMDH, etc). While in Neuroshell Trader you can make any prediction or classification using indicators add-on. Using runtime facilities in Neuroshell2 I can make my own add-on indicator for Neuroshell Trader or other software such as MT4. Even this is an oldest product, I can still get some benefits. There are other products that they called as AI Trilogy which consist Neuroshell predictor, classifier, genehunter and runtime facilities but I do not have them.

I think Chaoshunter is more advantage of GMDH neural network, I use it to get relation (formula) between variables, it can be used in many application and not limited for financial matters. I am still learning to use it, may be I can post about it after I get something useful.

You may compare Neuroshell2 and Neuroshell trader with neurosolution and Tradingsolution from neurodimension (www.nd.com) or Alyuda forecaster with Tradedecion. You can choose freely to train your network using a free software (SNNS, MBP, rapidminer etc).
arryex is offline   Reply With Quote
Old Jan 27, 2010, 6:27am   #14
Joined Feb 2008
Re: Build Neural Network Indicator in MT4 using Neuroshell

arryex started this thread As an advice from Chris (val2004), I tried to implement the same method as described on the following ebook by Mr Kutsurelis. http://citeseerx.ist.psu.edu/viewdoc...10.1.1.26.8408, here attached.

The objective is to predict 10 bars in future EURUSD (daily bar), all inputs are modified as described in attached pictures. All data are taken from MT4 chart, some inputs are not included due unavailability data. The chart is only displayed on Neuroshell trader Chart.

I am still develop the indicator on MT4, since the inputs are coming from other charts, such as EUJPY, USDJPY, #DJC.XDJ, etc.

Cheers,
Arryex
Attached Thumbnails
indicator-inputs.png   training-display.png   predicted-close.png  

Attached Files
File Type: pdf NeuralMarketsThesis.pdf (415.1 KB, 2591 views)
arryex is offline   Reply With Quote
Old Jan 27, 2010, 4:26pm   #15
Joined Feb 2008
Re: Build Neural Network Indicator in MT4 using Neuroshell

arryex started this thread Anybody know about VantagePoint's Intermarket Anaylisis?

As explained in the book "Trend Forecasting with Technical Analysis" by Louis Mendelsohn, intermarket analysis provide more precise trading strategies.

Based on given inputs, there 5 Neural Networks are produced: 1. predicted 1 bar high (PHigh), 2. predicted 1 bar low (Plow), 3. predicted short term 2 bar SMA5 (PTS), 4. predicted medium term 4 bars SMA10 (PTM), 5. Neural Index (based on difference between predicted 1bar and actual SMA3).

Additional indicators PTS Diff (PTS-actual SMA5) and PTM Diff (PTM-actual SMA10), PHigh Diff (PHigh - High) and PLow Diff(PLow-Low). Unfortunately, I could not found how to get "Strength Index".

Neural Network Inputs: for EURUSD chart daily.
Open,High,Low,Close,Volume,AUDJPY, AUDUSD, EURCAD,GBPJPY, GBPUSD,,^DJI, ^DJT, ^DJU, Nasdaq-100, FTSE 100. I could not include Oil, USD Index, T-Notes as mentioned in the book, due to unavailability data from MT4.

Neural Network outputs:
Lead(High,1), Lead(Low,1), Lead(Avg(Close,5),2), Lead(Avg(Close,10),4) Lead(Avg(Close,3),1)

NN design using back propagation.
The book explain how to use these indicators, such as:
- Buy when PTS Diff or PTM Diff turns positive and sell when PTS DIff or PTM Diff turns negative.
- Buy when PTS cross above TrendS or PTM cross above TrendM and sell when reverse
- Buy when PTS cross above PTM and sell when reverse
- Buy when Neural index 1 and sell when 0.

Higher probability to be used for trading, i.e. when all indicators are in confluence.
Attached Thumbnails
inputs.png   high-probability-buy.png   high-probability-sell.png  

Attached Files
File Type: pdf intermarket_analysis_of_forex_markets.pdf (518.9 KB, 4026 views)
arryex is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Neuroshell Cluster Indicator > Comments? Skyhr Forex 6 Nov 25, 2014 12:25pm
MTFeed Pro Neuroshell MT4 Input Orders Problem eurgbp Trading Software 3 Mar 24, 2010 3:13pm
Neural Network indicator - Any potential users? Flo_UniS Forex 5 Jan 15, 2009 8:27am
Neural Network Trading Models gs2004 Educational Resources 7 Sep 23, 2005 11:40pm

Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)