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; Basic information that I used to train the network is mentioned on the following link as well http://www.tradertech.com/journal_trading.asp Input layer ...

Reply
 
LinkBack Thread Tools Search this Thread
Old Jan 28, 2010, 2:31am   #17
Joined Feb 2008
Re: Build Neural Network Indicator in MT4 using Neuroshell

arryex started this thread Basic information that I used to train the network is mentioned on the following link as well http://www.tradertech.com/journal_trading.asp

Input layer:
euro FX plus the daily open, high, low, close, volume and open interest data(Not available in MT4) for nine related markets:
· Australian dollar/U.S. dollar (AUD/USD)
· Australian dollar/Japanese yen (AUD/JPY)
· British pound -> (Not available in MT4, may be GBP Index?)
· Euro/Canadian dollar (EUR/CAD)
· Gold
· Nasdaq 100 Index
· British pound/Japanese yen (GBP/JPY)
· British pound/U.S. dollar (GBP/USD)
· Japanese yen -> (Not available in MT4, may be USD/JPY?)

NN configuration:
Five different neural network (see attached picture)
Output Layer:
- The first network forecasts tomorrow’s high to help set stops for entry and exit points.
- The second network forecasts tomorrow’s low to help set stops for entry and exit points.
- The third network forecasts a 5-day moving average of closes two days into the future to indicate the expected short-term trend direction within the next two days.
- The fourth network forecasts a 10-day moving average of closes four days into the future to indicate the expected medium-term trend direction within the next four days.
- The fifth network indicates whether the market is expected to change trend direction within the next two days, by making a top or a bottom.
The first four networks at the primary level of the network hierarchy make independent market forecasts of the high, low, short-term trend and medium-term trend. These predictions are then used as inputs into the fifth network, along with other intermarket data inputs, at the secondary level of the network hierarchy, to predict market turning points.

Fralo, for the training I use NS2, I do not try to make prediction using NST neither make trading strategy with it.. at least implementing the idea first, but I will post it after.

Just for your information, the Neural trend indicator and Neural Classifier posted previously has a good result on H4 or daily time frame. Imagine if put an order at blue or red dot..for me is quite fun.. I need some body to help me to convert the indicator to an EA...

Regards,
Arryex
Attached Thumbnails
figure2-map-nn.gif   posting-trading-idea-1.png  
arryex is offline   Reply With Quote
Old Jan 28, 2010, 6:15am   #18
Joined Jan 2007
Re: Build Neural Network Indicator in MT4 using Neuroshell

Quote:
Originally Posted by arryex View Post
Fralo, for the training I use NS2, I do not try to make prediction using NST neither make trading strategy with it.. at least implementing the idea first, but I will post it after.

Just for your information, the Neural trend indicator and Neural Classifier posted previously has a good result on H4 or daily time frame. Imagine if put an order at blue or red dot..for me is quite fun.. I need some body to help me to convert the indicator to an EA...

Regards,
Arryex
1. Is it that NS2 is better and more flexible than NST?
2. The red and blue dots are indeed a lot of fun..
3. I might be able to help with an EA, depending on what you want. I am not professional at this, but have programmed several that work quite well for backtesting with MT4. One I have used live, but it has drawdowns that are too large and is dependent too much on the spread. There are members of other forums that would probably jump at the chance to help since this is interesting and looks promising.

The problem I see is that several of the inputs to your NNs cannot be obtained using MT4. What is the form of your indicator? Is it a DLL fed by external data? Is it an MT4 indicator (I guess not)?

You probably know that there are ways to connect NST to MT4 so that NST will accept MT4 data in real time, and (I think) generate orders that MT4 can implement. I have never had need to do this so I'm not sure if it works well. PM me if you are interested in this, I have some files.
Fralo.
fralo is offline   Reply With Quote
Old Jan 28, 2010, 6:40am   #19
Joined Feb 2008
Re: Build Neural Network Indicator in MT4 using Neuroshell

arryex started this thread Hi Fralo,
Comparing NST with NS2
1. NS2 is not dedicated only for trading/financial prediction, it can be used for any other area. While NST is dedicated for trading only.
2. NST is newer product while NS2 is the oldest (classic one).
3. Neural Network prediction used in NST seems only back propagation, I am not sure if inside there are some choice to select the NN architecture inside NST, while with NS2 I can select which architecture NN available such as Kohonen, PNN for classification.

Thank you for your availability to create an EA, basically I need an EA code to generate trade signals (Buy, Sell, Stop) when cross over occurred (blue, red and magenta dots) which are based on cross over MA. The different is I am using predicted MA which called by MT4 using dll.

For your information, all my inputs are taken from MT4 chart using data collector, after trained in NS2 then I recall it using runtime facilities. All data and indicators are built in MT4.
See attachments..sorry I could not send the code yet, but almost same as the 1st post.

Arryex
Attached Thumbnails
neural-indicators.png   aaneuro-trend-properties.png   aaneuro-classifier-properties.png  

aaneuro-trend-mq4.png  
arryex is offline   Reply With Quote
Old Jan 28, 2010, 7:18am   #20
Joined Jan 2007
Re: Build Neural Network Indicator in MT4 using Neuroshell

Quote:
Originally Posted by arryex View Post
Hi Fralo,

3. Neural Network prediction used in NST seems only back propagation, I am not sure if inside there are some choice to select the NN architecture inside NST, while with NS2 I can select which architecture NN available such as Kohonen, PNN for classification.
I am still learning NST, but I am reasonably sure that it allows control of network architecture, provided that the architecture is simple. e.g. NST allows use of Kohonen and PNN's, but it will not support Laguerre recurrent nets. It will allow you to specify things like number of hidden layers and nodes per layer. I seem to recall that NST also has some form of recurrent net. I am not sure about control of the error prop algorithm. It has something called turbo prop which is proprietary.


Quote:
Thank you for your availability to create an EA, basically I need an EA code to generate trade signals (Buy, Sell, Stop) when cross over occurred (blue, red and magenta dots) which are based on cross over MA. The different is I am using predicted MA which called by MT4 using dll.
Arryex
A basic crossover EA is supplied with MT4. It is OK to use for testing your logic, but too simple to go live. All you need do is make an MT4 indicator that calls your DLL, then replace the MA function in the EA with an iCustom function calling the MT4 indicator. It is important that your DLL be callable from MT4. (You might be able to simply call your DLL from the EA).

You might notice in the attached image that I have circled an area where most MA crossover systems fail, and made a couple of x's at the likely trading price. One cannot trade until the bar after the crossover has occurred. Then you must trade at the market or use some form of pending order. Although the crossovers may show profit if one could trade at the cross, the actual trades may cause whiplash. Because your sample shows long trends that are caught, for your sample the return would be very nice. But what about the long run? Only backtesting can tell. That might actually be easier in NST. (If I just knew how to use it).

whiplash.jpg
fralo is offline   Reply With Quote
Old Jan 28, 2010, 7:57am   #21
Joined Feb 2008
Re: Build Neural Network Indicator in MT4 using Neuroshell

arryex started this thread On the chart, magenta dot can be used as early stop/exit..or Classifier to confirm it. I am sure that it is not a best indicator..but it can be improved after..

I tried to use iCustom to call my indicator and it make crash MT4 when the EA being started. Maybe because I am using a dll on my custom indicator?

I may testing after the EA built in MT4. To be noted that creating a trading strategy in NST using MT4 data require additional indicator to collect data and transmit the trading signal from NST to MT4. The result may be different in NST if you are using optimization.

Using trained dll directly in MT4 may reduce any slippage or error transmitting data/signals between MT4-NST.
regards,
Arryex
arryex is offline   Reply With Quote
Old Jan 28, 2010, 1:09pm   #22
Joined Feb 2008
Re: Build Neural Network Indicator in MT4 using Neuroshell

arryex started this thread Finally I found an EA code, name it as Classifier, with the following properties:
- Open Buy when my custom indicator value =1
- Open Sell when my custom indicator value =-1
- Order Lots depend on available margin
- Stop loss added when placing the order
- New position opened when take profit/stop loss filled (need to solve this)

remaining:
- No trailing stop (currently, I put manually at 15 pips)
- No take profit target
- No magic number identification
- No EA comment on placed order
The EA can run properly but can not be tested, when using tester making crash MT4 (probably due to calling a dll). Any body know how to fix it?

For testing purpose I use 5M time frame just for EA testing purpose, but looks OK

regards,
Arryex
Attached Thumbnails
classifier-ea-action.png  
Attached Files
File Type: mq4 Classifier.mq4 (2.2 KB, 1358 views)

Last edited by arryex; Jan 28, 2010 at 1:17pm.
arryex is offline   Reply With Quote
Thanks! The following members like this post: puiu288
Old Jan 28, 2010, 5:44pm   #23
Joined Jan 2007
Re: Build Neural Network Indicator in MT4 using Neuroshell

How to fix it will depend on your indicator. Here's a url that may be helpful.
http://www.metatrader.info/node/150

For one thing, the ordersend function in the EA is wrong. There are several parameters missing. From here
http://docs.mql4.com/trading/OrderSend the definition of ordersend

int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)

Also, MT4 will reject orders if certain parameters are not what the broker wants. e.g. the stops cannot be too close to market, the minimum and maximum lots must be in bounds for your account, and the lots digits must be correct.

I don't think that you can use MT4 to backtest an EA that uses more than one symbol, because the strategy tester in MT4 simulates tick data, and was not designed to handle more than one symbol at a time. It always hangs. To test an EA that uses more than one symbol you must forward test it on a demo, or use another program.. maybe Multicharts if you don't like NST.

I'm in the process of writing a (single symbol NN) DLL indicator and using MT4 to backtest. My problem is to get the DLL tested independenty. Then I will face the MT4 integration. If I find any secrets I will post.

Fralo
fralo is offline   Reply With Quote
Old Jan 29, 2010, 12:53am   #24
Joined Jan 2007
Re: Build Neural Network Indicator in MT4 using Neuroshell

I remember a thread somewhere about using a DLL to build and train a neural net. Don't remember the thread, but here is source code for the DLL, and the MT4 indicator that calls it.BPNN.zip

Hope this helps.
Fralo
fralo 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: 7 (0 members and 7 guests)