Forex
Google

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack (89) Thread Tools Display Modes
  #171 (permalink)  
Old 05-09-2008, 10:31 AM
leeb's Avatar
leeb leeb is offline
Senior Member
 
Join Date: Dec 2005
Posts: 342
leeb is on a distinguished road
Smile Optimise better indicators ?

Hi Barnix

Thanks for all your great work.
Just a thought but if you forgot about the command line method and put the 3 Better indicators into an EA that could be optimised in metatrader that could be interesting, especially if all 3 indicators could be optimised seperaretly ?
Just a thought

Keep up the great work
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #172 (permalink)  
Old 05-13-2008, 07:50 AM
barnix barnix is offline
Senior Member
 
Join Date: Mar 2006
Posts: 684
barnix is on a distinguished road
Multi Layer Perceptron
Sbastien Marcel - Lab: Solving the XOR problem using a Multi Layer Perceptron
Quote:
/* This program implements a simple Multi Layer Perceptron to solve the xor problem (classification)

Adapted by Sebastien Marcel (2003-2004) from D. Collobert

The goal is to learn the XOR table of truth:

IN | OUT
|
0 0 | 0
0 1 | 1
1 0 | 1
1 1 | 0



The networks is the following:

w10--
--
-->
x1 -- w11 --> (hidden 1) -
- .> -- w31
w21-- .. --->
-. output
w12.. -- --->
. --> -- w32 /|\
x2 .. w22 ..> (hidden 2) - |
--> |
-- |
w20-- w30



x1, x2 are the inputs
wij the weights

*/

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

// Random generator
float Random(float inf, float sup)
{
return(((sup - inf)*((float)(random() & 0x7fffffffL) / (float) 0x7fffffffL) ) + inf);
}

// Transfer function
float f(float x)
{
return (tanh(x / 2.0));
}

// Derivative of transfer function
float f_prime(float x)
{
return ((1.0 - x * x) * 0.5);
}

int main()
{
// inputs
float x1, x2;

// target
float y;
float target0;
float target1;

// integration
float a1, a2, a3;

// outputs
float y1, y2, y3;

// weights
float w11, w12, w21, w22, w10, w20, w31, w32, w30;

// gradients
float Y1, Y2, Y3;

// training parameters
int T = 1000; // maximum number of iterations
float mse_min = 0.1; // minimum MSE
float lambda = 0.1; // learning rate



//*****************************
// Initialize weights
//
float bound = 1.0 / sqrt(2);

w11 = Random(-bound, bound);
w12 = Random(-bound, bound);
w10 = Random(-bound, bound);
w21 = Random(-bound, bound);
w22 = Random(-bound, bound);
w20 = Random(-bound, bound);
w31 = Random(-bound, bound);
w32 = Random(-bound, bound);
w30 = Random(-bound, bound);



//*****************************
// targets for tanh tranfert function
//
target0 = -0.6;
target1 = 0.6;



//*****************************
// Print info on the MLP
//
printf("\n");
printf("Bound = %f\n", bound);
printf("Initial weights:\n");
printf(" hidden neuron 1: %f %f [%f]\n", w11, w12, w10);
printf(" hidden neuron 2: %f %f [%f]\n", w21, w22, w20);
printf(" output neuron: %f %f [%f]\n", w31, w32, w30);



//*****************************
// Print outputs of the MLP
//
printf("\n");
printf("MLP outputs:\n");

// Example 1: x = {1, 1} y = 1
x1 = 1.0;
x2 = 1.0;
y = target1;

a1 = w11 * x1 + w12 * x2 - w10;
y1 = f(a1);
a2 = w21 * x1 + w22 * x2 - w20;
y2 = f(a2);
a3 = w31 * y1 + w32 * y2 - w30;
y3 = f(a3);

printf(" MLP(%f, %f)=%f \t y=%f\n", x1, x2, y3, y);

// Example 2: x = {1, 1} y = 1
x1 = 1.0;
x2 = -1.0;
y = target0;

a1 = w11 * x1 + w12 * x2 - w10;
y1 = f(a1);
a2 = w21 * x1 + w22 * x2 - w20;
y2 = f(a2);
a3 = w31 * y1 + w32 * y2 - w30;
y3 = f(a3);

printf(" MLP(%f, %f)=%f \t y=%f\n", x1, x2, y3, y);

// Example 3: x = {1, 1} y = 1
x1 = -1.0;
x2 = 1.0;
y = target0;

a1 = w11 * x1 + w12 * x2 - w10;
y1 = f(a1);
a2 = w21 * x1 + w22 * x2 - w20;
y2 = f(a2);
a3 = w31 * y1 + w32 * y2 - w30;
y3 = f(a3);

printf(" MLP(%f, %f)=%f \t y=%f\n", x1, x2, y3, y);

// Example 4: x = {1, 1} y = 1
x1 = -1.0;
x2 = -1.0;
y = target1;

a1 = w11 * x1 + w12 * x2 - w10;
y1 = f(a1);
a2 = w21 * x1 + w22 * x2 - w20;
y2 = f(a2);
a3 = w31 * y1 + w32 * y2 - w30;
y3 = f(a3);

printf(" MLP(%f, %f)=%f \t y=%f\n", x1, x2, y3, y);



//*****************************
// Train the MLP
//
printf("\nStochastic gradient training:\n");

int t; // the current iteration
float mse; // the current MSE

//
FILE *pf = fopen("mse.txt", "w");

for(t = 1; t <= T ; t++)
{
mse = 0.0;

//*****************************
//
// Example 1: x = {1, 1} y = 1
x1 = 1.0;
x2 = 1.0;
y = target1;

// Forward
a1 = w11 * x1 + w12 * x2 - w10;
y1 = f(a1);
a2 = w21 * x1 + w22 * x2 - w20;
y2 = f(a2);
a3 = w31 * y1 + w32 * y2 - w30;
y3 = f(a3);

// Backward
Y3 = (y3 - y) * f_prime(y3);
Y1 = f_prime(y1) * Y3 * w31;
Y2 = f_prime(y2) * Y3 * w32;

// Update weights
w11 = w11 - lambda * x1 * Y1;
w12 = w12 - lambda * x2 * Y1;
w10 = w10 + lambda * Y1;

w21 = w21 - lambda * x1 * Y2;
w22 = w22 - lambda * x2 * Y2;
w20 = w20 + lambda * Y2;

w31 = w31 - lambda * y1 * Y3;
w32 = w32 - lambda * y2 * Y3;
w30 = w30 + lambda * Y3;

// Compute MSE
mse = mse + 0.5 * (y3 - y) * (y3 - y);


//*****************************
//
// Example 2: x = {1, -1} y = -1
x1 = 1.0;
x2 = -1.0;
y = target0;

// Forward
a1 = w11 * x1 + w12 * x2 - w10;
y1 = f(a1);
a2 = w21 * x1 + w22 * x2 - w20;
y2 = f(a2);
a3 = w31 * y1 + w32 * y2 - w30;
y3 = f(a3);

// Backward
Y3 = (y3 - y) * f_prime(y3);
Y1 = f_prime(y1) * Y3 * w31;
Y2 = f_prime(y2) * Y3 * w32;

// Update weights
w11 = w11 - lambda * x1 * Y1;
w12 = w12 - lambda * x2 * Y1;
w10 = w10 + lambda * Y1;

w21 = w21 - lambda * x1 * Y2;
w22 = w22 - lambda * x2 * Y2;
w20 = w20 + lambda * Y2;

w31 = w31 - lambda * y1 * Y3;
w32 = w32 - lambda * y2 * Y3;
w30 = w30 + lambda * Y3;

// Compute MSE
mse = mse + 0.5 * (y3 - y) * (y3 - y);


//*****************************
//
// Example 3: x = {-1, 1} y = -1
x1 = -1.0;
x2 = 1.0;
y = target0;

// Forward
a1 = w11 * x1 + w12 * x2 - w10;
y1 = f(a1);
a2 = w21 * x1 + w22 * x2 - w20;
y2 = f(a2);
a3 = w31 * y1 + w32 * y2 - w30;
y3 = f(a3);

// Backward
Y3 = (y3 - y) * f_prime(y3);
Y1 = f_prime(y1) * Y3 * w31;
Y2 = f_prime(y2) * Y3 * w32;

// Update weigths
w11 = w11 - lambda * x1 * Y1;
w12 = w12 - lambda * x2 * Y1;
w10 = w10 + lambda * Y1;

w21 = w21 - lambda * x1 * Y2;
w22 = w22 - lambda * x2 * Y2;
w20 = w20 + lambda * Y2;

w31 = w31 - lambda * y1 * Y3;
w32 = w32 - lambda * y2 * Y3;
w30 = w30 + lambda * Y3;

// Compute MSE
mse = mse + 0.5 * (y3 - y) * (y3 - y);


//*****************************
//
// Example 4: x = {-1, -1} y = 1
x1 = -1.0;
x2 = -1.0;
y = target1;

// Forward
a1 = w11 * x1 + w12 * x2 - w10;
y1 = f(a1);
a2 = w21 * x1 + w22 * x2 - w20;
y2 = f(a2);
a3 = w31 * y1 + w32 * y2 - w30;
y3 = f(a3);

// Backward
Y3 = (y3 - y) * f_prime(y3);
Y1 = f_prime(y1) * Y3 * w31;
Y2 = f_prime(y2) * Y3 * w32;

// Update weights
w11 = w11 - lambda * x1 * Y1;
w12 = w12 - lambda * x2 * Y1;
w10 = w10 + lambda * Y1;

w21 = w21 - lambda * x1 * Y2;
w22 = w22 - lambda * x2 * Y2;
w20 = w20 + lambda * Y2;

w31 = w31 - lambda * y1 * Y3;
w32 = w32 - lambda * y2 * Y3;
w30 = w30 + lambda * Y3;

// Compute MSE
mse = mse + 0.5 * (y3 - y) * (y3 - y);

//*****************************
//
// print the MSE in a file
fprintf(pf, "%f\n", mse);
printf("."); fflush(stdout);

if(mse < mse_min) break;
}
printf("\n");

//
fclose(pf);


//*****************************
// Print info about training
//
printf("Number of iterations = %d\n", t);
printf("Final MSE = %f\n", mse);


//*****************************
// Print info about the MLP
//
printf("Final weights:\n");
printf(" hidden neuron 1: %f %f [%f]\n", w11, w12, w10);
printf(" hidden neuron 2: %f %f [%f]\n", w21, w22, w20);
printf(" output neuron: %f %f [%f]\n", w31, w32, w30);


//*****************************
// Print outputs of the MLP
printf("\n");
printf("MLP outputs:\n");

// Example 1: x = {1, 1} y = 1
x1 = 1.0;
x2 = 1.0;
y = target1;

a1 = w11 * x1 + w12 * x2 - w10;
y1 = f(a1);
a2 = w21 * x1 + w22 * x2 - w20;
y2 = f(a2);
a3 = w31 * y1 + w32 * y2 - w30;
y3 = f(a3);

printf(" MLP(%f, %f)=%f \t y=%f\n", x1, x2, y3, y);

// Example 2: x = {1, 1} y = 1
x1 = 1.0;
x2 = -1.0;
y = target0;

a1 = w11 * x1 + w12 * x2 - w10;
y1 = f(a1);
a2 = w21 * x1 + w22 * x2 - w20;
y2 = f(a2);
a3 = w31 * y1 + w32 * y2 - w30;
y3 = f(a3);

printf(" MLP(%f, %f)=%f \t y=%f\n", x1, x2, y3, y);

// Example 3: x = {1, 1} y = 1
x1 = -1.0;
x2 = 1.0;
y = target0;

a1 = w11 * x1 + w12 * x2 - w10;
y1 = f(a1);
a2 = w21 * x1 + w22 * x2 - w20;
y2 = f(a2);
a3 = w31 * y1 + w32 * y2 - w30;
y3 = f(a3);

printf(" MLP(%f, %f)=%f \t y=%f\n", x1, x2, y3, y);

// Example 4: x = {1, 1} y = 1
x1 = -1.0;
x2 = -1.0;
y = target1;

a1 = w11 * x1 + w12 * x2 - w10;
y1 = f(a1);
a2 = w21 * x1 + w22 * x2 - w20;
y2 = f(a2);
a3 = w31 * y1 + w32 * y2 - w30;
y3 = f(a3);

printf(" MLP(%f, %f)=%f \t y=%f\n", x1, x2, y3, y);

printf("End of program reached !!\n");

return 0;
}

Last edited by barnix : 05-13-2008 at 07:55 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #173 (permalink)  
Old 05-13-2008, 07:59 AM
barnix barnix is offline
Senior Member
 
Join Date: Mar 2006
Posts: 684
barnix is on a distinguished road
using a Multi Layer Perceptron
Sbastien Marcel - Lab: Solving the Canon-ball problem using a Multi Layer Perceptron
Quote:
/* This program implements a simple Multi Layer Perceptron to solve the canonball problem (regression)

Adapted by Sebastien Marcel (2003-2004) from D. Collobert

The goal is to estimate the position X of a bullet at time t (fixed) given the initial speed (v) and angle (a)

y

/ \
|
|
|
| . X
| .
| .
| .
| .
| .
| .
| .
| .
| .
|. (v,a)
--------------------------> x

*/

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

//
// Datasets
#define N_PATTERNS_TRAIN 500
#define N_PATTERNS_TEST 500

//*****************************
// Inputs
//
struct DataIn
{
float v; // speed of bullet
float a; // angle of bullet
} X[N_PATTERNS_TRAIN + N_PATTERNS_TEST];

//*****************************
// Targets
//
struct DataOut
{
float x; // x position at time t
float y; // y position at time t
} Y[N_PATTERNS_TRAIN + N_PATTERNS_TEST];

//*****************************
// to create the data
//
const float vmax = 1.0/10;
const float gravity = 1.0/200;

//*****************************
// to train the MLP
//
const float lambda = 0.01; // learning rate
const float mu = 0.6; // inertia momentum rate
const float mse_min = 0.001; // minimum Mean Squared Error
const int max_iterations = 500; // maximum number of iterations

//*****************************
// MLP data
//
#define N_HU 3

// weights between hidden neurons and inputs
float w1[N_HU + 1][3];
float w1old[N_HU + 1][3];

// weights between outputs and hidden neurons
float w2[2][N_HU + 1];
float w2old[2][N_HU + 1];

// values of integration function
float aHidden[N_HU + 1];
float aOutput[2];

// values of transfert function
float yHidden[N_HU + 1];

// constant value of bias
float xBias = 1.0;


//*****************************
// Sigmoid transfer function
//
float f(float x)
{
return (1.0 /(1.0 + exp(-x)));
}

//*****************************
// Derivative of Sigmoid
//
float f_prime(float x)
{
float z = exp(-x);
float one_plus_z = 1.0 + z;

return (z / (one_plus_z * one_plus_z));
}

#define MY_PI 3.141592

//*****************************
// Compute the x position of bullet at time t
//
float xpos(float t, float v, float teta)
{
return v * t * cos(teta*MY_PI/180.0);
}

//*****************************
// Compute the y position of bullet at time t
//
float ypos(float t, float v, float teta)
{
return -0.5 * gravity * t * t + v * t * sin(teta*MY_PI/180.0);
}

//*****************************
// Compute the MSE
//
float MSE(struct DataOut a, struct DataOut b)
{
return 0.5*((a.x - b.x)*(a.x - b.x) + (a.y - b.y)*(a.y - b.y));
}

//*****************************
// Random
//
float Random(float inf, float sup)
{
return( ((sup - inf)*((float)(random() & 0x7fffffffL) / (float) 0x7fffffffL) ) + inf);
}

//*****************************
// Create the MLP
//
void createMLP()
{
int i, j;
for (i = 0; i<=2; i++)
{
for (j = 0; j<= N_HU; j++)
{
w1[j][i] = Random(-1.0, 1.0);
w1old[j][i] = w1[j][i];
}
}

for (i = 0; i<2; i++)
{
for (j = 0; j<= N_HU; j++)
{
w2[i][j] = Random(-1.0, 1.0);
w2old[i][j] = w2[i][j];
}
}
}

//*****************************
// Create the datasets
//
void createDatasets()
{
int i;

i = 0;
while (i < (N_PATTERNS_TRAIN + N_PATTERNS_TEST))
{
X[i].v = (Random(0.0, vmax)) / vmax;
X[i].a = (Random(0.0, 90.0)) / (float)90;

Y[i].x = xpos(10, X[i].v * vmax, (X[i].a)*90.0);
Y[i].y = ypos(10, X[i].v * vmax, (X[i].a)*90.0);

if (Y[i].y > 0.0) i = i + 1;
}
}

//*****************************
// Forward the input in the MLP
//
void forward(struct DataIn In, struct DataOut *out)
{
int i;

aHidden[0] = xBias;
yHidden[0] = xBias;

for (i = 1; i <= N_HU; i++)
{
aHidden[i] = xBias*w1[i][0] + (In.v)*w1[i][1] + (In.a)*w1[i][2];
yHidden[i] = f(aHidden[i]);
}

aOutput[0] = 0.0;
aOutput[1] = 0.0;

for (i = 0; i <= N_HU; i++)
{
aOutput[0] = aOutput[0] + yHidden[i]*w2[0][i];
aOutput[1] = aOutput[1] + yHidden[i]*w2[1][i];
}

out->x = f(aOutput[0]);
out->y = f(aOutput[1]);
}

//*****************************
// Backward (back-propagate the gradient of error)
//
void backward(struct DataOut Yestimate, struct DataOut Outwant, struct DataIn In, float lambda, float mu)
{
float wnew, Goutput[2], Ghidden[N_HU + 1];
int i,j;

//
Goutput[0] = (Yestimate.x - Outwant.x) * f_prime(aOutput[0]);
Goutput[1] = (Yestimate.y - Outwant.y) * f_prime(aOutput[1]);

//
for (i = 0; i<=N_HU; i++)
Ghidden[i] = (Goutput[0]*w2[0][i] + Goutput[1]*w2[1][i])*f_prime(aHidden[i]);

//
for (j = 0; j<2; j++)
{
for (i = 0; i<=N_HU; i++)
{
wnew = w2[j][i] - lambda * yHidden[i] * Goutput[j] + mu * (w2[j][i] - w2old[j][i]);
w2old[j][i] = w2[j][i];
w2[j][i] = wnew;
}
}

//
for (i = 0; i<=N_HU; i++)
{
wnew = w1[i][0] - lambda * xBias * Ghidden[i] + mu * (w1[i][0] - w1old[i][0]);
w1old[i][0] = w1[i][0];
w1[i][0] = wnew;

wnew = w1[i][1] - lambda * In.v * Ghidden[i] + mu * (w1[i][1] - w1old[i][1]);
w1old[i][1] = w1[i][1];
w1[i][1] = wnew;

wnew = w1[i][2] - lambda * In.a * Ghidden[i] + mu * (w1[i][2] - w1old[i][2]);
w1old[i][2] = w1[i][2];
w1[i][2] = wnew;
}
}

//*****************************
// Stochastic gradient training
//
float train(int P)
{
struct DataOut Yestimate;
float mse_;
float mse_total;

mse_total = 0.0;

// For each train patterns
for(int p = 0 ; p < P ; p++)
{
// Forward current train pattern into the MLP
forward(X[p], &Yestimate);

// Computes the MSE
mse_ = MSE(Y[p], Yestimate);

// Accumulate the MSE
mse_total = mse_total + mse_;

// Backward MSE gradient
backward(Yestimate, Y[p], X[p], lambda, mu);
}

// Return normalized train MSE
return mse_total / (float) P;
}

//
int main()
{
float mse_train;
float mse_test;
float mse_;
struct DataOut Yestimate;

//*****************************
//
createMLP();

//*****************************
//
createDatasets();

//for (int i = 0; i< N_PATTERNS_TRAIN; i++) printf(" TRN: x=[%f %f] y=[%f %f]\n", X[i].v, X[i].a, Y[i].x, Y[i].y);
//for (int i = N_PATTERNS_TRAIN; i<(N_PATTERNS_TRAIN + N_PATTERNS_TEST); i++) printf(" TST: x=[%f %f] y=[%f %f]\n", X[i].v, X[i].a, Y[i].x, Y[i].y);

printf("Stochastic gradient training:\n");

//
FILE *pf_train = fopen("mse_train.txt", "w");
FILE *pf_test = fopen("mse_test.txt", "w");

int iter;

for(iter = 1 ; iter <= max_iterations ; iter++)
{
//*****************************
//
// train
mse_train = train(N_PATTERNS_TRAIN);

fprintf(pf_train, "%f\n", mse_train);


//*****************************
//
// test
mse_test = 0.0;

// For each test pattern
for(int i = N_PATTERNS_TRAIN ; i < (N_PATTERNS_TRAIN + N_PATTERNS_TEST) ; i++)
{
Yestimate.x = 0.0;
Yestimate.y = 0.0;

// forward current pattern into the MLP
forward(X[i], &Yestimate);

// computes MSE
mse_ = MSE(Y[i], Yestimate);

// accumulate MSE
mse_test += mse_;
}

// Normalize the MSE
mse_test /= (float)N_PATTERNS_TEST;

fprintf(pf_test, "%f\n", mse_test);
printf("."); fflush(stdout);

if (mse_train < mse_min) break;
}
printf("\n");

//
fclose(pf_test);
fclose(pf_train);

//*****************************
// Print info about training
//
printf("Number of iterations = %d\n", iter);
printf("Final MSE train = %f\n", mse_train);
printf("Final MSE test = %f\n", mse_test);

printf("End of program.\n");

return 0;
}
Attached Images
File Type: jpg canonball.jpg (5.6 KB, 679 views)

Last edited by barnix : 05-13-2008 at 08:01 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #174 (permalink)  
Old 05-13-2008, 09:36 AM
superluz superluz is offline
Junior Member
 
Join Date: Feb 2006
Posts: 19
superluz is on a distinguished road
Well done Barnix!

I found some interesting tutorials

K Nearest Neighbors Tutorial
Q-Learning By Examples
Machine Learning Algorithm Tutorial

Fast Classifiers (needs a registration)
Fast Classifiers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #175 (permalink)  
Old 05-13-2008, 02:21 PM
superluz superluz is offline
Junior Member
 
Join Date: Feb 2006
Posts: 19
superluz is on a distinguished road
MT4 FANN integration


Neural Network Trading Serious PEOPLE ONLY!

Price Analysis with Neural Networks - Page 2
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #176 (permalink)  
Old 05-13-2008, 07:15 PM
dmeliki dmeliki is offline
Junior Member
 
Join Date: May 2007
Posts: 14
dmeliki is on a distinguished road
Optimal Sigma for PNN

Hello there
I have been reading the post and following them for a while, I have used Erics idea for pnn from FXreal.ru with some changes. It works fine now in the expert, however, you have to optimize it for say two months to get the sigma and stop loss to get good results. I have been looking at the posts and have seen the RBF-DDA algorithm, seems much better and it looks you do not have to find optimum sigma for each pair(by the way sigma will change depending on time).
Looks interesting, does anyone has the code for RBF-DDA?

By the way if anyone wants a separate thread opened it might be a good idea...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #177 (permalink)  
Old 05-13-2008, 09:17 PM
barnix barnix is offline
Senior Member
 
Join Date: Mar 2006
Posts: 684
barnix is on a distinguished road
#_LinRegres_Neuro_GA.mq4
Attached Files
File Type: mq4 #_LinRegres_Neuro_GA.mq4 (15.0 KB, 172 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #178 (permalink)  
Old 05-14-2008, 04:15 AM
denisl denisl is offline
Junior Member
 
Join Date: Dec 2007
Posts: 2
denisl is on a distinguished road
Quote:
Originally Posted by dmeliki View Post
Hello there
I have been reading the post and following them for a while, I have used Erics idea for pnn from FXreal.ru with some changes. It works fine now in the expert, however, you have to optimize it for say two months to get the sigma and stop loss to get good results. I have been looking at the posts and have seen the RBF-DDA algorithm, seems much better and it looks you do not have to find optimum sigma for each pair(by the way sigma will change depending on time).
Looks interesting, does anyone has the code for RBF-DDA?

By the way if anyone wants a separate thread opened it might be a good idea...
Hello all,
Here is my implementation of rbf-dda, according to the algorithms described in the papers. It was first written in matlab, then translated in C, then in mt4 . But I guess it is free of bugs now. I have included the 'embedded spirals' test, which works pretty well. Beware this code works for two classes only, -1 and +1.
The authors are right, the choice of the two parameters is not critical at all, so maybe it will be of interest for you, dmeliki.
About the settings of the network for predicting the forex, it is another issue. My best tuning for now on is the following:

Pair: EUR/USD, 15 mn
Objective function: zigzag with 5 pips min excursion (it is better to filter the input data of the zigzag with a little EMA to avoid false pivots).
Input training data: a vector of the difference of the current price and somme of its moving averages (50 bars to 150 bars by step of 10 bars, a vector of 11 values).
Training data span: 5000 samples (around 50 days)
The output of the rbf-dda gives directly the probability of the corresponding class, -1 or +1. The strategy is simple: if the output > A buy, if < -A sell, always in the market. The system can be refined by including Sl and TP, but it is not mandatory in the begining.
The problem is that the optimal settings are very unstable (a small change in the settings and the performance vanishes out). This is not robust enough to be a viable option. I am still searching but I am afraid I have no more ideas .


Best,
Denis
Attached Files
File Type: mq4 rbf-dda.mq4 (5.1 KB, 110 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #179 (permalink)  
Old 05-14-2008, 06:22 AM
lvsefa lvsefa is offline
Junior Member
 
Join Date: Mar 2008
Posts: 12
lvsefa is on a distinguished road
Hi all:
I think what be trained by NN or SVM is the most important, isn't it?
Better said he use indicator(MA) as the input of his PNN, I think it maybe a custom indicator develop from MA like AC ? AO ? or macd ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #180 (permalink)  
Old 05-14-2008, 09:35 AM
barnix barnix is offline
Senior Member
 
Join Date: Mar 2006
Posts: 684
barnix is on a distinguished road
berthold98constructive.pdf
Attached Images
File Type: pdf berthold98constructive.pdf (660.7 KB, 108 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/expert-advisors-metatrader-4/11096-better-nn-ea-development.html
Posted By For Type Date
国外有人在研究PNN(神经EA)有点看不懂 - 「外汇交易」 - 『火线投资论坛』 外汇,外汇入门,外汇论坛,外汇社区,外汇保证金,外汇交易,投资,投资论坛,A股,股票 This thread Refback 07-01-2008 06:04 PM
פורום - STRATEGY BANK Post #41 Refback 06-28-2008 09:59 PM
:: Ķ - Better's EA - Զ״ھ This thread Refback 06-26-2008 12:41 PM
פורום - STRATEGY BANK This thread Refback 06-19-2008 12:03 PM
פורום - STRATEGY BANK Post #41 Refback 06-19-2008 10:43 AM
Forex Otomatik Islem Mekanizmalar - hisse.net : Ekonomi ve Borsa Forumu Post #18 Refback 06-18-2008 03:06 PM
Комментарии - Automated Trading Championship 2007 This thread Refback 06-16-2008 06:54 PM
Fraktale , Sieci neuronowe ,Algorytmy genetyczne... This thread Refback 06-06-2008 12:41 PM
:: Ķ - Better's EA - Զ״ھ This thread Refback 06-06-2008 12:44 AM
DELPHI与热动 - 频道预览 - 抓虾 This thread Refback 06-05-2008 08:24 PM
Профиль Better - 2007自动交易锦标赛 This thread Refback 05-23-2008 10:58 PM
Profile better - Automated Trading Championship 2007 This thread Refback 05-18-2008 12:21 PM
Профиль Better - Automated Trading Championship 2007 This thread Refback 05-12-2008 05:14 PM
Better's EA - Զ״ھ - This thread Refback 05-06-2008 03:56 AM
svm dll(Example for testing the svm dll) й˹ܴҵзֲ - ˹||Ŵ㷨|ģʽʶ|Ӿ|ҵ|Ŀ This thread Refback 05-01-2008 06:31 AM
Profile Better - Automated Trading Championship 2007 This thread Refback 04-14-2008 04:18 PM
EAForex :: View topic - Combo NN This thread Refback 04-14-2008 07:14 AM
Comments - Automated Trading Championship 2007 This thread Refback 03-30-2008 07:25 AM
Sieci neuronowe na giedzie Forex - system, dyskusja This thread Refback 03-23-2008 01:59 PM
svm dll(Example for testing the svm dll) й˹ܴҵзֲ - ˹||Ŵ㷨|ģʽʶ|Ӿ|ҵ|Ŀ This thread Refback 03-14-2008 09:24 AM
פורום - STRATEGY BANK This thread Refback 03-08-2008 06:05 PM
国外有人在研究PNN(神经EA)有点看不懂 - 「外汇交易」 - 『火线投资论坛』 外汇,外汇入门,外汇论坛,外汇社区,外汇保证金,外汇交易,投资,投资论坛,A股,股票 This thread Refback 03-02-2008 04:09 AM