Build Neural Network Indicator in MT4 using Neuroshell

I wish to create complete article but this short explanation should be sufficient.

I found the way to improve r-squared value of any prediction buy putting new prediction output as a new input. It can be implemented using available tools.

For example create a prediction originally using 6 inputs (I0 to I5), it producing rsquare about 0.36, the new equation inserted as new input for the next prediction. By having new inputs I6 to I8 the new prediction rsquare increased become 0.62. This can proceed gradually till we get the required rsquare value.
 

Attachments

  • Data original.png
    Data original.png
    126.3 KB · Views: 550
  • Data modified.png
    Data modified.png
    138.7 KB · Views: 445
  • initial R-square.png
    initial R-square.png
    57.6 KB · Views: 460
  • Increasing R-square1.png
    Increasing R-square1.png
    93.9 KB · Views: 444
For anyone who still not succeed to display aaneuromacd indicator:
1. indicator value will be -1 and 1 if account not valid
2. value above 9000000 or below -9000000, if the dll is not allowed

I tried that we can use it on EURUSD pair by adjusting levelsig value. It can run in any decimal point.

If this not solved, it may related with OS (not updated windows or different OS).
 

Attachments

  • alpari 5 digit eurusd.png
    alpari 5 digit eurusd.png
    145.7 KB · Views: 834
  • allow dll in option.png
    allow dll in option.png
    44.7 KB · Views: 491
  • not valid account.png
    not valid account.png
    17.3 KB · Views: 406
  • before allow dll.png
    before allow dll.png
    15.6 KB · Views: 356
...For example create a prediction originally using 6 inputs (I0 to I5), it producing rsquare about 0.36, the new equation inserted as new input for the next prediction. By having new inputs I6 to I8 the new prediction rsquare increased become 0.62. This can proceed gradually till we get the required rsquare value.
Herr Arryex,

Thank you for the thread. It is very interesting and generous of you to start & moderate so far.

Please explain what you meant using the current prediction for the next prediction. Say bar A is followed by bar B, then bar C and so on. Last closed bar is bar 1. Before bar 1 was bar 2, prior to bar 3 and so on.

First we do in0 to in5 to predict bar A output. What do you do with this output & what you refer to as 'next prediction' ? Insert it as in6 to predict bar A better/again or insert it for bar B (next bar after A)? I hope my question does not confuse you. Sorry :)
 
Hi ytrwq123,

Hope this one can answer your question, I do the following steps:

1. Example you have initially I0 to I5 to predict A, in this case A is target prediction such as 5 bar future SMA.

After the first training you will have a predicted value, let say net1. You will have rsquare value let say rsq1

2. You put this net1 become I6, then you will have new data for your training become I0 to I6.

3. Run the new training with this new input I0 to I6, and still used to predict A. This second training will produce new rsquare value, let say as rsq2, where rsq2>rsq1.

You repeat above steps (probably with new input I7, I8, etc) until you get desired rsquare value, example near 0.99. In this case you have already a good prediction.

In MT4 case, I convert predicted formula or trained net as new input from Chaos hunter, NS2 or other software.


Cheers
 
Hi arryex,
Please help to explain about NS2.
1.How to make dll from NS2.I can make only def file.
2.In neuroshell I import def file insert new Indicator what mean about input#1, input#2
I don't understand If we use same input before train in ns2.
the result did not same predict of neuroshell. Or I mistake about how to make Indicator from ns2.I'm confuse about this process.
For my understand
first we predict in neuroshell. second we send input and output to prdict in ns2.
final we predict again by result of ns2 in neruoshell.That right ???
Thank you.
 
Hi Palwoong,

Here the answer for your question:
1. With NS2 runtime facilities, you can produce def file and also source code generator.
You can make dll from the source code generated by NS2 (C or VB code), you should convert NS2 generated code to your selected compiler. I use visual studio to convert it into dll.

2. If you deploy def file from NS2 into NSDT, then you can use it as new input to predict the same output.
For example: you have 5 inputs (I0 to I5) to predict 5 next bar MACD, then
a. Export all inputs and output from NSDT to csv format.
b. Open this csv file into NS2 then train it, afterward you will have trained net in def format.
c. Import this def file in NSDT, let say as I6
d. You can create a new prediction with 6 inputs (I0 to I6) in NSDT or you export again to csv for the next training in NS2 to produce new input I7, etc.
This step repeated until you are happy with the new result. The easiest way for you is using NSDT to display def file, but at the end all trades should be generated from NSDT.
 
Some time if I think that optimization with Chaos Hunter getting slow to find better rsquared, then I use Gene Hunter to find a new input which resulting better.

Here if I have I0 to I6, then I try to make linear combination, such as
a0*I0+a1*I1+a2*I2+a3*I3+a4*I4+a5*I5+a6*I6 to get new I7
The optimization target is still to maximize rsquared

The rsquared value can be higher than what resulted within Chaos hunter.
 

Attachments

  • Using Genehunter.png
    Using Genehunter.png
    101.4 KB · Views: 648
Is it a good start for Buying Gold? let see...after few days..but no body knows the future will be:?:
 

Attachments

  • Trade Entry 29 Jun 2011.png
    Trade Entry 29 Jun 2011.png
    39.3 KB · Views: 610
The previous small uptrend is a down trend correction.
Seems tomorrow there will be a correction again ?? aaJRSX has crossed up.
 

Attachments

  • trade result30 Jun 2011.png
    trade result30 Jun 2011.png
    20.6 KB · Views: 369
  • Trade Entry 30 Jun 2011.png
    Trade Entry 30 Jun 2011.png
    45.2 KB · Views: 520
Expected the trend still going up event the volatility is decreasing..
Reentry after aaNeuroRSI cross up back and aaNeuroMACD and aaNeurotrend still in uptrend mode.
 

Attachments

  • TR 6 Jul 11.png
    TR 6 Jul 11.png
    50.4 KB · Views: 472
  • open trade 6 Jul 11.png
    open trade 6 Jul 11.png
    15.9 KB · Views: 278
As expected the new high value happened recently..

Here I close partially the previous open position..:)
 

Attachments

  • Partial trade result 6 July 11.png
    Partial trade result 6 July 11.png
    72.3 KB · Views: 407
Nice arryex, Still got problem running it here.. keep getting error 126?

Seems you are doing great with the nn indicator, one question though; did you optimize/retrain it after some time or not since you sent us the indicator?.
 
Hi Arjang, I replied already your private message, please follow up my query.

Hi Nick, error 126 indicate that MT4 cannot call the library. The indicator dll should be located in experts\libraries folder.

If you check aaneuromacd.dll with PE Explorer, you can see that this dll is using kernel32.dll and msvcr100D.dll. Please ensure that these 2 files are also available on your PC. May be can help you.

I found those two files in my windows folder.

For your question: I did training optimization only one time, I am using the same trained net since I created and I do not re-optimize/retrain it. The last modification I did is related with adding account number checking and not related with the net (weight factor, bias, etc). I think to get robust neural net should be related with selection of input and output.

Arryex
 

Attachments

  • Imported dll.png
    Imported dll.png
    80.9 KB · Views: 579
Last edited:
I did wrong entry..but cut loss soon and reverse position..It is the best way ;)

When market moving fast..short term indicator is helping more than macd, especially during big news like NFP today..because macd is really lag indicator...meanwhile aaneurotrend is not confirming down trend.
 

Attachments

  • helped by rsi.png
    helped by rsi.png
    42.8 KB · Views: 550
  • Cut loss soon.png
    Cut loss soon.png
    24.7 KB · Views: 312
Current market condition:
- still going uptrend (aaneurotrend and aaneuromacd)
- short term indicator (aaneuroRSI) still small uptrend
- low volatility (stdev), possible change during European or USA market open ..
market change indicated by short term indicator and increasing volatility ..we will see
 

Attachments

  • Open Trade 11 Jul 11.png
    Open Trade 11 Jul 11.png
    32.4 KB · Views: 493
Indicators shows that market uptrend still continuing, event with small correction two sell orders are in profitable trade.
 

Attachments

  • Trade 11-12 Jul 2011.png
    Trade 11-12 Jul 2011.png
    66.9 KB · Views: 562
I just found a new trading method to get larger profit shortly...
Previously I kept my position for several days to get small profit..now combination both methods should be the best
 

Attachments

  • new method result 13 Jul 11.png
    new method result 13 Jul 11.png
    13.8 KB · Views: 303
Top