Build Neural Network Indicator in MT4 using Neuroshell

Hi At120,

Finally I found where is the miscalculation come, the trigonometric calculation described on the SpectralDilation.pdf is based on degree instead of radiant, you should convert 2*pi = 360º or 180 = pi = 3.1415927

For example
b1 = 2*a1*Cosine(1.414*180 / 10);

it shall be written in c code as
b1 = 2*a1*cos(1.414*3.1415927/ 10);

After compiling code on visual c then import dll as indicator on Neuroshell.

You can check also the output of your indicator compare with excel calculation result, as attached here. You can insert the excel data into Neuroshell and then insert your dll indicator compare with excel calculated values.

Afterward, we can create a trading strategy based on stochastic filter. I think this indicator as well as other indicators will not giving successful trade all the time.
 

Attachments

  • dg2.csv
    84.1 KB · Views: 478
  • Ehler Roofing Filter-Compare Indicator and Excel.jpg
    Ehler Roofing Filter-Compare Indicator and Excel.jpg
    318 KB · Views: 3,624
  • Trade sample - Ehler Roofing Filter.jpg
    Trade sample - Ehler Roofing Filter.jpg
    260.7 KB · Views: 1,651
  • dll code.jpg
    dll code.jpg
    197.8 KB · Views: 1,068
I want to apply CH results as inputs for random forest tree algorithm.Should I use the CH predicted values(of indicator , price whatever) or the CH formula as input?
 
You can implement in both way:
1. Insert CH result into your Nst then input it into your random forest tree.
2. Insert your formula into Nst (using available indicators), then insert into your random forest tree.
Using method 2 will depend on your capability to implement the formula.
 
Hi At120,

Finally I found where is the miscalculation come, the trigonometric calculation described on the SpectralDilation.pdf is based on degree instead of radiant, you should convert 2*pi = 360º or 180 = pi = 3.1415927

For example
b1 = 2*a1*Cosine(1.414*180 / 10);

it shall be written in c code as
b1 = 2*a1*cos(1.414*3.1415927/ 10);

After compiling code on visual c then import dll as indicator on Neuroshell.

You can check also the output of your indicator compare with excel calculation result, as attached here. You can insert the excel data into Neuroshell and then insert your dll indicator compare with excel calculated values.

Afterward, we can create a trading strategy based on stochastic filter. I think this indicator as well as other indicators will not giving successful trade all the time.

I checked roofing filter and supersmoother quite deep like a year ago and unfortunatelly using of it was giving more harm then good. if you compare SMA an SS they almost the same just length SMA = length SS/2 or oposite.

Aplying SS to inputs of my AI algos was always giving worse results. So be carefull with it !!!

Krzysztof
 
Hi Everybody ,

I am preparing a csv file for Chaos Hunter?How should be the date formation in the csv file?Most recent date (data) should be on the top column or bottom column?Thanks.
 
bridge

hello all

I'm looking for the Neuroshell/MT4 bridge, any good soul would share it, if I may ask? I'm willing to pay a little bit if necessary

thanks a lot

Jeff
 
thank you so much! after hours of research (litterally) I found the full MT4 bridge on an isolated site and is working like a charm

you have to send 1 units to trigger the bridge (you cannot send for examples 234 units you select the lot on MT4 side and that's it (which is a bit of a problem if you use pyramiding and such)

here are the links:
https://www.mediafire.com/?b6zfsmg1xcycdy7
http://www.4shared.com/rar/U4We3nVkba/datafeedmt4.html
http://www74.zippyshare.com/v/x2ZmMAjh/file.html

If the main DLL keeps dissapeearing you have to add an exception to the DLL in your AntiVirus, also sometimes is it suspiciously erased by your AntiVirus but it's not a real virus inside.
 
Hi Arryex,

Thanks for your input and info! I changed the code now.. and it looks good so far.

bye the way, I now have a semi implementation of ChaosHunter in MT4... (MACD Signal, without the DLL from CH)
Testing... ;-))

Bye, AT
 

Attachments

  • test_M5.JPG
    test_M5.JPG
    136.9 KB · Views: 910
thanks, but some failure signals... but still working... need more improvement

Bye, AT
 

Attachments

  • test2_M5.JPG
    test2_M5.JPG
    170.4 KB · Views: 952
Question about the training input H1 data.

Hi Arryex,

Thanks for this post. I got a question about the extracted training data using NeuralTrainingsetCreator.mq4.

In this file, the corresponding 1 hour data is extracted using the following code:
h1shift = iBarShift(NULL,PERIOD_H1,iTime(NULL,PERIOD_M15,4),true);
input[15] = gmThreshold((iMA(NULL,PERIOD_H1,5,0,MODE_EMA,PRICE_CLOSE,h1shift)-iMA(NULL,PERIOD_H1,5,0,MODE_EMA,PRICE_CLOSE,h1shift+1))/(Point*10));

As we know, each 1 hour bar span over 4 M15 bars. For a particular M15 bar, the corresponding 1 hour bar may have already contained future information. For example, if the open time of the current M15 bar is 12:00 and the close time is 12:14, then the corresponding H1 bar will open at 12:00 and close at 12:59. When we use the above code to collect the close price or EMA of the H1 bar, it already contained the future information (future trend) for the current M15 bar. Thus can we still use these H1 data as the training input?

Thank you very much.

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
 
Hi Gyzhen,

Please verify based on your collected data. I do not think we could collecting the future data using MT4. The close value of H1 time frame will be equal with close value at the last M15, even 1H is not completed.
The sample data is just picked up from the sample, we could change or remove this 1H data if not necessary. We may select any other data which could indicate the predicted output.

Cheers

Hi Arryex,

Thanks for this post. I got a question about the extracted training data using NeuralTrainingsetCreator.mq4.

In this file, the corresponding 1 hour data is extracted using the following code:
h1shift = iBarShift(NULL,PERIOD_H1,iTime(NULL,PERIOD_M15,4),true);
input[15] = gmThreshold((iMA(NULL,PERIOD_H1,5,0,MODE_EMA,PRICE_CLOSE,h1shift)-iMA(NULL,PERIOD_H1,5,0,MODE_EMA,PRICE_CLOSE,h1shift+1))/(Point*10));

As we know, each 1 hour bar span over 4 M15 bars. For a particular M15 bar, the corresponding 1 hour bar may have already contained future information. For example, if the open time of the current M15 bar is 12:00 and the close time is 12:14, then the corresponding H1 bar will open at 12:00 and close at 12:59. When we use the above code to collect the close price or EMA of the H1 bar, it already contained the future information (future trend) for the current M15 bar. Thus can we still use these H1 data as the training input?

Thank you very much.
 
Hi,

I do not found yet for Chaos Hunter.

Some people may get problem to install NS2 within Windows 7 x64 and x32, but I did.

There are two methods:
1. Install virtual machine, you can download it freely from microsoft then install windows XP. Afterward you can install NS2 setup.

2. You can copy directly extracted files from windows XP into your windows 7 (either x32 and x64)
neuroshell folder (c:\Neuroshell 2\) , copy also all dll and ocx files required into c:\neuroshell 2 folder. Register all of them using command.com, regsvr32
example: regsvr32 /s COMDLG32.ocx
or
regsvr32 /s asycfilt.dll

Here are the dll list you need:
asycfilt.dll
comcat.dll
comdlg32.dll
ctl3d32.dll
EZGA32.DLL
GAPI32.DLL
Gswag32.dll
GSWDLL32.DLL
hlinkprx.dll
Implode.dll
INETWH16.DLL
inetwh32.dll
inloader.dll
mfc40.dll
MFC42ENU.DLL
MFCANS32.DLL
MSFL651.DLL
MSSTKPRP.DLL
msvbvm50.dll
msvcrt40.dll
NS2-32.DLL
NSGA32.DLL
NSHELL2.DLL
NSTGA32.DLL
NSTOMG32.DLL
NSTRD-TS.DLL
NSTRDAUT.DLL
OC25.DLL
Oc30.dll
OLE2CONV.DLL
OLE2PROX.DLL
oleaut32.dll
RHMMPLAY.DLL
SCP.DLL
TPROP32.DLL
TPROP321.DLL
TRADES.DLL
VB40016.DLL
VB5DB.DLL
vb5stkit.dll
vbar332.dll
VCFIDL32.DLL
VCFIWZ32.DLL
_ISREG32.DLL

And here OCX files you need:
COMDLG32.ocx
Dblist32.ocx
GRAPH32.OCX
Mscomm32.ocx
MSFLXGRD.OCX
picclp32.ocx
SPIN32.OCX
ss32x25.ocx
ssa3d30.ocx
SSDOCK32.OCX
SSFORM32.OCX
tabctl32.ocx
THREED32.OCX
VCFI32.OCX
Vsocx32.ocx

You can also create a batch file and run in DOS to register all of them. See attached pictures to shown that NS2 run directly on my windows 7 x64.

Good luck

Hi. Can you put that files in archive and link here?
 
Здравствуйте можете предоставить мне пример какого нибудь индикатора(dll) как подключить к программе neuroshell?
 
Last edited:
What is generally regarded as the ideal frequency of reoptimization in Neuroshell? Should I optimize on the previous 200 bars and trade 100 bars OOS? Unfortunately, NS does not allow me to set both a date range for optimization and a date range for OOS testing. It automatically chooses the remaining bars after the optimization period for OOS testing. In order to test, I need separate data sets for each date range, which is a bit of a hassle.
 
Top