You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Canon-ball problem using a Multi Layer Perceptron in MT4
Canon-ball problem using a Multi Layer Perceptron in MT4
forward train
#define IN 2
#define IN1 3 //IN+1
#define OUT 2
#define N_HU 3
#define N_HU1 4 //N_HU + 1
// weights between hidden neurons and inputs
double w1[N_HU1];
double w1old[N_HU1];
// weights between outputs and hidden neurons
double w2[OUT][N_HU1];
double w2old[OUT][N_HU1];
// values of integration function
double aHidden[N_HU1];
double aOutput[OUT];
// values of transfert function
double yHidden[N_HU1];
// constant value of bias
double xBias = 1.0;
Good job Barnix and others,
Could I see a backtest graph to see the performance after all?
Or we are not there yet!
PNN modif2
hi,
some modifs are done in PNN(Gomez):
1.adding some Monthly/weekly/daily/fib_daily pivots and using nearest HIGH_LOW of TF15m Candles distance, for vector elements
2.adding some CCI calcs, for vector elements
3.adding NORMALIZER for reducing numeric size of eucledian calc
4.disabling final multipyer : becuz these are huge const numerics( after training length=const, classvetorcount=const .... lead to a huge const numeric for each class and for our purpose the classes # =2 and each class counts nearly the same )
//fx *= 1 / (MathPow(2 * 3.14159265, length / 2) * MathPow(SIGMA, length)) * (1 / classVectorCount);
5. monitoring some information for control the operation.
6. disabling only single trade: thus it trades too many,
/*if (total == 0)*/ {
7. adding NewBar() function for reducing trained vectors data bank
RUN:
EURUSD TF5m ; trainer for 1 month and system for 1month+ some days
results:
a. the trained time window is nice UPGOING balance slope
b. in none trained part of chart , it generates both BUY/SELL orders, but not profitable yet, the balance smoothly decreasing.
c. it needs more logics to generate best signals for trade, till now it is such as a simple fingerprint bitmap reading and compare system ,
but we need scale_changerin price an time , and noise_filterand data_miner (features_extractor) for reducing patterns count, and finding rules.
note: if you want to single trade each time , let this code in system:
if (total == 0) {
Regards
OTR
OnTheRoad,
nice job on PNN modification. Some time ago I was trying to classify N previous candles formation to store the succsessful patterns using that code. Didn't get any promising results though.
Here is a hint how you could also try to modify the code to get probably better results.
Store normilazed values of several different by nature indicators, for example RSI, Stoch, ADX, EMA(80), CCI, JMA. Remember they must be normalized, if that function in the library does a good job then you're good to go.
Also, if your results out of teaching period are still bad have a few external parameters like TP, SL, SIGMA, whatever in your main EA you could optimize in MT tester. After that extent the testing period a liitle and see if you get any better results. Remember, no EA works forever (what's why all of them on the market are scams. Just show me 1, only 1 EA which consistently brings profit over 12 months). Anyway, my theory is you should re-teach/re-optimize your EA like every week to adjust it to changing market conditions.
Keep us posted.
Orest
hi,
some modifs are done in PNN(Gomez):
1.adding some Monthly/weekly/daily/fib_daily pivots and using nearest HIGH_LOW of TF15m Candles distance, for vector elements
2.adding some CCI calcs, for vector elements
3.adding NORMALIZER for reducing numeric size of eucledian calc
4.disabling final multipyer : becuz these are huge const numerics( after training length=const, classvetorcount=const .... lead to a huge const numeric for each class and for our purpose the classes # =2 and each class counts nearly the same )
//fx *= 1 / (MathPow(2 * 3.14159265, length / 2) * MathPow(SIGMA, length)) * (1 / classVectorCount);
5. monitoring some information for control the operation.
6. disabling only single trade: thus it trades too many,
/*if (total == 0)*/ {
7. adding NewBar() function for reducing trained vectors data bank
RUN:
EURUSD TF5m ; trainer for 1 month and system for 1month+ some days
results:
a. the trained time window is nice UPGOING balance slope
b. in none trained part of chart , it generates both BUY/SELL orders, but not profitable yet, the balance smoothly decreasing.
c. it needs more logics to generate best signals for trade, till now it is such as a simple fingerprint bitmap reading and compare system ,
but we need scale_changerin price an time , and noise_filterand data_miner (features_extractor) for reducing patterns count, and finding rules.
note: if you want to single trade each time , let this code in system:
if (total == 0) {
Regards
OTRI think we shall use the PNN network. Paco Comez PNN, his classification is not right. We need to have a PNN that does correct classification.
I have been trying to debug paco Comez pnn classificaion for whole days, without lite bit progress. Tired, wish some one can take over this.
Attached please find the lecture notes for PNN.
So, If I have PNN input
buy class
class = 0;
x1,1=2,
x1,2=2.5;
x1,3=3;
x1,4=1;
x1,5=6;
total nodes n_buy=6;
if I have a new value 3 that need to be classified.
Then pdf_buy(3)=0.2103. (ref to the attached lecture notes)
sell class
class = 1;
x2,1=6,
x2,2=6.5;
x2.3=7;
total nodes n_sell=3;
if I have a new value 3 that need to be classified,
Then pdf_sell(3)=0.0011. (ref to the attached lecture notes)
pdf_sell(3) < pdf_buy(3),
then the new value 3 shall belonged to the class buy, and hence BUY OP.
Attached is the EA that I tried to debuge Comez PNN classification, and not get to the end yet.
to debuge the classification part
Pnn_verify5.mq4-- I tried not to change his code structure.
Pnn_verify3.mq4-- I have to change the code sturecture in order to debug.
you run this in the strategy tester, and check out the print out in the journal.
Here is Comez original code that has problem, here I comments on it.
In this structure, the total nodes for each class is not get the right results.
double length = ArrayRange(vector, 0);
double result = -99999999999999999999;
int resultClass = -1;
double fx[2] = {0, 0};
double classVectorCount[2] = {0, 0};
for (int i = 0; i < ArrayRange(pnn, 0); i++) {
int class = pnn[0];
double classVector[60];
for (int j = 0; j < length; j++) {
//j< upper range, the upprange here shall be the total nodes of buy class or the total nodes of sell class,
// like total range of pnn[1] or pnn[0]
classVector[j] = pnn[j + 1];
}
classVectorCount[class]++;
fx[class] += MathExp((-1) * euclideanScalarProduct(vector, classVector) / (2 * MathPow(SIGMA, 2)));
}
for (i = 0; i < ArrayRange(fx, 0); i++) {
// if we take after the lecture notes, here shall be fx = fx*1 / (MathPow(2 * 3.14159265, 0.5) ) * (1 / classVectorCount);
//since the (MathPow(2 * 3.14159265, 0.5) is constant, therefore we have fx = fx * (1 / classVectorCount); and used this to compare the class.
fx *= 1 / (MathPow(2 * 3.14159265, length / 2) * MathPow(SIGMA, length)) * (1 / classVectorCount);
if (fx > result) {
result = fx;
resultClass = i;
}
return (resultClass);
}I've double posted the code, can not edit my own code any more?
Here is the all the lectures notes
Pattern1.pdf
Pattern2.pdf
Pattern3.pdf
Pattern4.pdf
Pattern5.pdf
Pattern6.pdf
Pattern7.pdf
Pattern8.pdf
Pattern9.pdf