Build Neural Network Indicator in MT4 using Neuroshell

Here I would like to show you a concept of multi time frame indicators:
- This indicator is based on several predicted indicators (can be combination of 1, 2, 3 or more indicators)
- Each predicted indicator will be calculated on several time frame (5M, 15M, 30M, H1, H4 and D)
- Each indicator on a single time frame will be presented as an arrow (green for an uptrend and red for a downtrend)
- Calculate a percentage for overall trend, if we have 5 downtrend and 16 uptrend out of 21 (total) then overall will be about 76% uptrend

This overall percentage calculation will be used as trade entry base. So far seems better than a single time frame analysis.
 

Attachments

  • aaNeuroMTF.png
    aaNeuroMTF.png
    46.3 KB · Views: 2,728
I closed my sell position when overall percentage around 50%, meaning that market not deciding where it will go..time to relax until the new probability defined
I will reentry when the probability reach 90% or more..
 

Attachments

  • Close position - no entry.png
    Close position - no entry.png
    43.8 KB · Views: 3,966
Hi John,

Here is my NN training detail :
- aaneuromacd (11 inputs, 2 outputs, 10000 rows of total data, 80% for training, 20% for test, 1H data since 2 Jan 2008 till 26 Feb 2010), NN configuration: Back Propagation network with 1 input, 1 hidden layer and 1 output. I am using a simplest NN configuration rather complicated one but with no good result.
- aaNeurotrend (17 inputs, 3 networks, one output/network, 3977 rows of total data, 3000 rows for training, 977 rows data for test, 1H data since 2 Jan 2007 till 28 Feb 2007), NN configuration: Ward network with 1 input, 3 hidden layer and 1 output.
- aaNclass2, I use only 8 data (2 input and 1 output) to build formula in CH.
I never retrain my net since it was build, till now it seems reliable for me.
 
Other variation for aaNeuroMTF:
a. I use stochastic as 3rd indicator, first two charts indicate a good prediction with good trade
b. I use Jurik Trend Envelope as 3rd indicator and showing two previous profitable trades and one open trade;)
 

Attachments

  • aaNeuroMTF test 2.png
    aaNeuroMTF test 2.png
    38.2 KB · Views: 604
  • aaNeuroMTF test 2a.png
    aaNeuroMTF test 2a.png
    36.4 KB · Views: 582
  • aaNeuroMTF with JTEnv.png
    aaNeuroMTF with JTEnv.png
    63.2 KB · Views: 786
Another way to shown aaNeuroMACD...full color..:D
 

Attachments

  • Full Color NeuroMACD.png
    Full Color NeuroMACD.png
    99.2 KB · Views: 1,113
Are this uptrend will continue? lets check out after..

My personal notes:
"You can do any deep analysis for any instrument you want, it will take a lot of your own resources (times, money, energy, etc), but at the end, have you get any clue from your analysis result about what you should do?

New buy/sell entries, hold existing position, averaging, set profit target, exist positions, set stop loss, or cut loss your existing position are actions need to be done by a trader.

But even though you already get a clue....your emotions (expectation, fear and greed) will take a part on your decision making and action"

=======

"Anda bisa melakukan analysis mendalam terhadap instrument yang anda inginkan, hal itu akan menghabiskan banyak sumber daya yang anda miliki (waktu, uang, tenaga, dll), tetapi pada akhirnya, Apakah anda sudah memiliki kesimpulan dari hasil analisis tentang apa yang harus anda lakukan?

Melakukan entri beli/jual, menahan posisi, averaging, setting target profit, melepas posisi, menentukan stopp loss, atau melepas posisi rugi, semuanya adalah apa yang harus lakukan sebagai seorang trader.

Tetapi, walaupun anda sudah mempunyai sebuah kesimpulan..emosi anda (harapan, kekhawatiran dan keserakahan) akan ikut ambil bagian dalam penentuan keputusan dan langkah yang anda lakukan"

Balikpapan, 30th Nov 2011
 

Attachments

  • aaNeuroMTF 100% uptrend.png
    aaNeuroMTF 100% uptrend.png
    41.7 KB · Views: 567
New setting using neural indicators:
- Using 1 minute chart as entry (preferable during pull back as the main trend)
- Using 5 minute chart as reference
- Using 1H as main trend
- Both indicators shall be in confluence
- Close the position as soon as the price or indicator reverse (most of time in confluence with pivot point or other support resistance)

Here is the recent trade result that I just closed. Someone my think that its like scalping, but actually I am using my neural indicator on small time frame:D
 

Attachments

  • Nice trade 1M and 5M TF.png
    Nice trade 1M and 5M TF.png
    76.8 KB · Views: 938
Update trade result ...
 

Attachments

  • Nice trade 1M and 5M TF (update).png
    Nice trade 1M and 5M TF (update).png
    57.8 KB · Views: 954
equity indicator

Here is a link to advanced equity curve display indicator. This indicator is able e.g. split equity curve into separate BUY and SELL curves and display it in real time.

Indicator of Equity and Balance - MQL4 Code Base

and related forum in Russian

?????? ?????? ? ??????? - MQL4 ?????

I think proper applicability of this indicator to our systems can give crucial improvement in performance as determining the current bias (BUY or SELL) is a key in my opinion and the best is to determine it based on equity curve.

Krzysztof
 
Hi Krizys,

I am happy to see your indicators that leading you to a profitable trade. I get similar comments from anybody to do a lot of things but most of them forget that such advice should not only directed to anyone else except himself first..I hope you agree to this point.

And i still remember about your previous preferred software (multicharts, adaptrade, etc), is there any update?:?: Hope you will get successful also with Matlab.. I think there should be a time for me to check them out..but not in rush...

FYI, now I am developing my indicator manual...here is the sample..,my developing still in progress so far..

cheers
 

Attachments

  • aaNeural Indicator - Manual rev 1.0 sample.pdf
    377.2 KB · Views: 1,207
Hi Krizys,

I am happy to see your indicators that leading you to a profitable trade. I get similar comments from anybody to do a lot of things but most of them forget that such advice should not only directed to anyone else except himself first..I hope you agree to this point.

And i still remember about your previous preferred software (multicharts, adaptrade, etc), is there any update?:?: Hope you will get successful also with Matlab.. I think there should be a time for me to check them out..but not in rush...

FYI, now I am developing my indicator manual...here is the sample..,my developing still in progress so far..

cheers

Yes, I used equity curve trading in one of my simulations and indeed it improved performance a lot, PF raised from 1.5 to 4.54 for 568 trades. It was using 5 trades for equity curve trading and 5 trades for virtual trading (to approve signal for trading, system must make certain profit on x virtual trades) so it worked at least in this case.

The russian indicator seems to be very advanced but problem with it that it does not work for back test, needs to be redesigned i think. For equity trading I use my own solution.

Good you remind other software. Some time ago I found out major bug in MSA.
MSA is making dependency analysis (analysis of series of winners and losers).
It looks that it does not consider that trades can overlap in time i.e. one trade can be open than another open again without closing 1st one. If the 1st trade closes with profit it makes analysis ignoring not closed trades which can be losers. It inflates results a lot for both equity trading and dependency trading.

The ADAPTRADE has a site on facebook and also had the discussion board. I wrote 'HAD' because when I wrote there about this bug, next day author deleted whole discussion board(n). So next crooky guy with super software

As far as Im concerned I'm using now setup which I described some posts ago. Its a bit complicated but its very flexible and works well

Krzysztof
 

Attachments

  • results.zip
    40.6 KB · Views: 232
Hi John,

Here is my NN training detail :
- aaneuromacd (11 inputs, 2 outputs, 10000 rows of total data, 80% for training, 20% for test, 1H data since 2 Jan 2008 till 26 Feb 2010), NN configuration: Back Propagation network with 1 input, 1 hidden layer and 1 output. I am using a simplest NN configuration rather complicated one but with no good result.
- aaNeurotrend (17 inputs, 3 networks, one output/network, 3977 rows of total data, 3000 rows for training, 977 rows data for test, 1H data since 2 Jan 2007 till 28 Feb 2007), NN configuration: Ward network with 1 input, 3 hidden layer and 1 output.
- aaNclass2, I use only 8 data (2 input and 1 output) to build formula in CH.
I never retrain my net since it was build, till now it seems reliable for me.

Regarding training range. If you train indicator on e.g. 100K bars and some of the inputs are based on EMA, that when you are using trained model in real time I believe you can end up with big and very difficult to dedect problems. Obviously you can not use 100K bars to calculate inputs for model (indicator) in real time, the number of back bars must be much lower maybe 1k to have short calculation time. But in this case EMA calculated for 100k bars for training has very different values (due to memory effect) than EMA calculated on 1k bars so your model can give very very different responses than it should !!!!

Krzysztof
 
I think we have a different understanding:
- I am using training range with 10K bars only to get the optimum NN parameters.
- Example, the input that I have used Is previous 5 bar EMA(Close, 5)
During deployment of trained net, the input used still previous 5 bar EMA(Close 5), and I do not use previous 10K bars data.

In addition, if I train the net for 10K bars data, mean my net will response to the similar condition as the training range.
If we train the net only during uptrend then the net only have a good response during uptrend, similar case in for down trend.
I think this is a common problem during selecting the training range, and probably your comments are valid.

Thanks

Regarding training range. If you train indicator on e.g. 100K bars and some of the inputs are based on EMA, that when you are using trained model in real time I believe you can end up with big and very difficult to dedect problems. Obviously you can not use 100K bars to calculate inputs for model (indicator) in real time, the number of back bars must be much lower maybe 1k to have short calculation time. But in this case EMA calculated for 100k bars for training has very different values (due to memory effect) than EMA calculated on 1k bars so your model can give very very different responses than it should !!!!

Krzysztof
 
Any one has experience to protect the indicator/expert MT4? since there are some ex4 decompiler available, it is risky for anyone to give somebody the ex4 code, especially for the seller.

So far I have done the following:
- Include all indicator calculation on the dll instead in mq4 code -> no change to break the logic behind indicator
- Include the MT4 account number and broker's name check on dll file-> no change some one steal the indicator and used in other account number

The remaining parts that still not established:
- To include the computer ID or CPU serial ID check-> no change to use indicator on other computer when it has been run in one computer
- To include reporting activity check when indicator is running on a computer (need a server to response, probably there is a chance to use an email address)
Any one has other idea, please advice..

Thanks
Arryex
 
I think we have a different understanding:
- I am using training range with 10K bars only to get the optimum NN parameters.
- Example, the input that I have used Is previous 5 bar EMA(Close, 5)
During deployment of trained net, the input used still previous 5 bar EMA(Close 5), and I do not use previous 10K bars data.

Question is how many bars back you use to calculate EMA during deployment ??


to have no mismatches in EMA value should be like this

x----10kbars training----x---OOSbars---y

x---x training period
y - last bar

so EMA during deployment should be calculated on 10kbars + OOSbars but for real time it can take a lot of time. It also applies to other indis using EMA 'inside'.

in other words if you calculate EMA on 10k+OOSbars you will get different results that if you calculate just one.g 500bars and you indi will give different responses

Krzysztof
 
Hi Kryzs,

I need to recall back my memory related to what you have explained above, for me, this is one serious thing that we should consider during predicting using neural network:
1. Output that will be predicted
2. Input variable, using price change is better than price itself.
3. Consider to add 5-10% of maximum and reduce 5-10% of minimum values of Output. In order our net will have a little freedom. As my experience, if we train the net using price range example between 1500 to 1700, and the output let say between 1500-1700 than during real time (after OOS) the net will give value 1700 even the input going to above 1700 (1800, 1900, etc), same thing if the input values lower than 1500 (1400, 1300) then the output will be 1500.

Next I will attach my net sample after completed.
 
Hi Kryzs,

I need to recall back my memory related to what you have explained above, for me, this is one serious thing that we should consider during predicting using neural network:
1. Output that will be predicted
2. Input variable, using price change is better than price itself.
3. Consider to add 5-10% of maximum and reduce 5-10% of minimum values of Output. In order our net will have a little freedom. As my experience, if we train the net using price range example between 1500 to 1700, and the output let say between 1500-1700 than during real time (after OOS) the net will give value 1700 even the input going to above 1700 (1800, 1900, etc), same thing if the input values lower than 1500 (1400, 1300) then the output will be 1500.

Next I will attach my net sample after completed.

regarding point 3. This problem is related to scaling of data. Related thread is here.

Retain and Reuse Scaling Information for LIBSVM classification

Regarding my previous mail. If EMA is used as an input, the big size of training range and small number of bars for calculation of EMA in real time comparing to training range size introduces error in prediction.

For example for 20k trainig range and 1k bars back for input calculation in real time i encountered 20-30 faulty predictions of 1440. For range 100k it was like 10% so much more. This number will depend of the model i guess and this problem
applies to all recursive inputs with memory effect like EMA.

The solution for this is pretty simple. Use database of inputs and calculate new bars of inputs incrementally but i never heard somebody even considered this, usually people using much shorter training ranges.

Krzysztof
 
I just start to learn NN in Matlab:
- After installing Matlab R2008b, directly search demos for Neural Network
- Demo refers to Neural Network Design, by Martin T. Hagan, Howard B. Demuth, Mark Beale
- Found ebook at 4shared (example: Neural Network Design - Hagan; Demuth; Beale.pdf - 4shared.com - document sharing - download -)
- Neural Network Guide for Matlab can be downloaded at http://www.mathworks.com/access/helpdesk/help/pdf_doc/nnet/nnet.pdf
- Related to LIBSVM, I found the following link
LIBSVM -- A Library for Support Vector Machines
LIBSVM -- A Library for Support Vector Machines
Anyone who want to share good ebook to learn NN in Matlab (for beginner) are welcome..
 
Last edited:
Top