Forecasting with neural networks

  • Follow


Hi

I'm currently working on my master thesis where the objective is to test the performance of various neural networks on forecasting of foreign exchange rates.

I have constructed the models, been doing some data manipulation and found some starting models with lagged variables against my target vector, which are all stationary and everything is, in a theoretically sense alright, but I in practice I have great problems!

No matter which network I simulate, no matter how many layers and neurons in each layer and no matter which transfer functions I use I get almost the same MSE!

I don't expect to find the "best model out there", but would expect the different models and structures would return different results.

Here's an example of a newff with 2 hidden layers and 13 neurons in each and how I use it:

net = newff(P,T,[13 13], {'tansig 'tansig'})
Y = sim(net,P);
net.trainParam.epochs = 1000;
net = train(net,P,T);
Y = sim(net,P);
d=[T-Y].^2;
MSE=mean(d)


Do I use it wrong, or should I improve it somehow?? And as another strange thing; my models always converges after 8-12 epochs. Should I change the number of validation checks? If so, how is this done?

Help on this subject would be very much appreciated.
0
Reply nicolaj 8/25/2010 10:06:05 AM

On Aug 25, 6:06=A0am, "nicolaj " <nicolajjeppe...@hotmail.com> wrote:
> Hi
>
> I'm currently working on my master thesis where the objective is to test =
the performance of various neural networks on forecasting of foreign exchan=
ge rates.
>
> I have constructed the models, been doing some data manipulation and foun=
d some starting models with lagged variables against my target vector, whic=
h are all stationary and everything is, in a theoretically sense alright, b=
ut I in practice I have great problems!
>
> No matter which network I simulate, no matter how many layers and neurons=
 in each layer and no matter which transfer functions I use I get almost th=
e same MSE!
>
> I don't expect to find the "best model out there", but would expect the d=
ifferent models and structures would return different results.
>
> Here's an example of a newff with 2 hidden layers and 13 neurons in each =
and how I use it:
>
> net =3D newff(P,T,[13 13], {'tansig 'tansig'})
> Y =3D sim(net,P);
> net.trainParam.epochs =3D 1000;
> net =3D train(net,P,T);

[net tr] =3D train(net,P,T);
Nepochs =3D tr.epoch(end)
MSE       =3D tr.perf(end)

> Y =3D sim(net,P);
> d=3D[T-Y].^2;
> MSE=3Dmean(d)

help mse

> Do I use it wrong, or should I improve it somehow?? And as another strang=
e thing; my models always converges after 8-12 epochs. Should I change the =
number of validation checks? If so, how is this done?

help trainlm
net.trainParam.max_fail     5  Maximum validation failures

> Help on this subject would be very much appreciated.

Hard to make an intelligent comment without knowing

[I N]  =3D size(P)
[O N] =3D size(T)
minmax(T(:))
MSE00 =3D mean(var(T'))   % ~MSE for the naive constant model
R2 =3D 1-MSE/MSE00        % Rsquare statistic

Hope this helps.

Greg


0
Reply Greg 8/25/2010 11:38:53 AM


Greg Heath <heath@alumni.brown.edu> wrote in message <a463b23a-022a-4edd-9e3c-f5b3fb80b01a@f6g2000yqa.googlegroups.com>...
> On Aug 25, 6:06 am, "nicolaj " <nicolajjeppe...@hotmail.com> wrote:
> > Hi
> >
> > I'm currently working on my master thesis where the objective is to test the performance of various neural networks on forecasting of foreign exchange rates.
> >
> > I have constructed the models, been doing some data manipulation and found some starting models with lagged variables against my target vector, which are all stationary and everything is, in a theoretically sense alright, but I in practice I have great problems!
> >
> > No matter which network I simulate, no matter how many layers and neurons in each layer and no matter which transfer functions I use I get almost the same MSE!
> >
> > I don't expect to find the "best model out there", but would expect the different models and structures would return different results.
> >
> > Here's an example of a newff with 2 hidden layers and 13 neurons in each and how I use it:
> >
> > net = newff(P,T,[13 13], {'tansig 'tansig'})
> > Y = sim(net,P);
> > net.trainParam.epochs = 1000;
> > net = train(net,P,T);
> 
> [net tr] = train(net,P,T);
> Nepochs = tr.epoch(end)
> MSE       = tr.perf(end)
> 
> > Y = sim(net,P);
> > d=[T-Y].^2;
> > MSE=mean(d)
> 
> help mse
> 
> > Do I use it wrong, or should I improve it somehow?? And as another strange thing; my models always converges after 8-12 epochs. Should I change the number of validation checks? If so, how is this done?
> 
> help trainlm
> net.trainParam.max_fail     5  Maximum validation failures
> 
> > Help on this subject would be very much appreciated.
> 
> Hard to make an intelligent comment without knowing
> 
> [I N]  = size(P)
> [O N] = size(T)
> minmax(T(:))
> MSE00 = mean(var(T'))   % ~MSE for the naive constant model
> R2 = 1-MSE/MSE00        % Rsquare statistic
> 
> Hope this helps.
> 
> Greg

Thank you for your reply. It helped to consider the R2 instead. But now I ran into some problems which I don't know how to evaluate. I currently run two different networks, both newff but with different training algorithms:

1: 
net = newff(Pbestneg,TNEG,[9],{'tansig' 'tansig'});
Y=sim(net,Pbestneg);
net.trainParam.epochs=1000;
net.trainParam.max_fail=200;
net.trainParam.mc = 0.4; %don't know if this makes sense with train default
net.trainParam.lr = 0.05; %%don't know if this makes sense with train default
net.trainParam.goal = 1e-5;
[net tr]=train(net,Pbestneg,TNEG);
Y=sim(net,Pbestneg);
e=TNEG-Y;
MSE=mse(e)
MSE00=mean(var(TNEG'));
R2=1-MSE/MSE00

2:
net = newff(Pbestneg,TNEG,[5 5],{'tansig' 'tansig' 'purelin'},'traingdm');
net.trainParam.lr = 0.03;
net.trainParam.epochs = 1000;
net.trainParam.goal = 1e-5;
net.trainParam.max_fail=10;
net.trainParam.mc = 0.6;
net = train(net,Pbestneg,TNEG);
Y=sim(net,Pbestneg);
e=TNEG-Y;
MSE=mse(e)
MSE00=mean(var(TNEG'));
R2=1-MSE/MSE00

#1 consistently gives an positive R2 around 7-9 %, which for this study seems alright as a starting point. It always start validating after 2-3 epochs.

#2 consistently gives an negative R2 with the exact same variables. This never reach the performance goal, so never starts validating. (I've tried up to 4000 epochs, with the same conclusion) I tried different combinations of learning rate and momentum.

I haven't been taught in NN, but how I understand it is that the second model is more advanced in the sense that the chance og finding global min is better?

I'm afraid #1 gives some kind of spurious results i'm not aware of. I hope you can steer me in the right direction. 

Pbestneg is a 21x2610 matrix with stationary economic(day t) variables (interest rates, stock indices and so on) all in returns
TNEG is a 1x2610 vector of realised returns(day t+1) on a currency cross 

MinTNEG  -0,0377
Max TNEG 0,0473 
0
Reply nicolaj 8/27/2010 9:00:28 AM

"nicolaj " <nicolajjeppesen@hotmail.com> wrote in message <i57urc$n4u$1@fred.mathworks.com>...
> Greg Heath <heath@alumni.brown.edu> wrote in message <a463b23a-022a-4edd-9e3c-f5b3fb80b01a@f6g2000yqa.googlegroups.com>...
> > On Aug 25, 6:06 am, "nicolaj " <nicolajjeppe...@hotmail.com> wrote:
> > > Hi
> > >
> > > I'm currently working on my master thesis where the objective is to test the performance of various neural networks on forecasting of foreign exchange rates.
> > >
> > > I have constructed the models, been doing some data manipulation and found some starting models with lagged variables against my target vector, which are all stationary and everything is, in a theoretically sense alright, but I in practice I have great problems!
> > >
> > > No matter which network I simulate, no matter how many layers and neurons in each layer and no matter which transfer functions I use I get almost the same MSE!
> > >
> > > I don't expect to find the "best model out there", but would expect the different models and structures would return different results.
> > >
> > > Here's an example of a newff with 2 hidden layers and 13 neurons in each and how I use it:
> > >
> > > net = newff(P,T,[13 13], {'tansig 'tansig'})
> > > Y = sim(net,P);
> > > net.trainParam.epochs = 1000;
> > > net = train(net,P,T);
> > 
> > [net tr] = train(net,P,T);
> > Nepochs = tr.epoch(end)
> > MSE       = tr.perf(end)
> > 
> > > Y = sim(net,P);
> > > d=[T-Y].^2;
> > > MSE=mean(d)
> > 
> > help mse
> > 
> > > Do I use it wrong, or should I improve it somehow?? And as another strange thing; my models always converges after 8-12 epochs. Should I change the number of validation checks? If so, how is this done?
> > 
> > help trainlm
> > net.trainParam.max_fail     5  Maximum validation failures
> > 
> > > Help on this subject would be very much appreciated.
> > 
> > Hard to make an intelligent comment without knowing
> > 
> > [I N]  = size(P)
> > [O N] = size(T)
> > minmax(T(:))
> > MSE00 = mean(var(T'))   % ~MSE for the naive constant model
> > R2 = 1-MSE/MSE00        % Rsquare statistic
> > 
> > Hope this helps.
> > 
> > Greg
> 
> Thank you for your reply. It helped to consider the R2 instead. But now I ran into some problems which I don't know how to evaluate. I currently run two different networks, both newff but with different training algorithms:
> 
> 1: 
> net = newff(Pbestneg,TNEG,[9],{'tansig' 'tansig'});
> Y=sim(net,Pbestneg);
> net.trainParam.epochs=1000;
> net.trainParam.max_fail=200;
> net.trainParam.mc = 0.4; %don't know if this makes sense with train default
> net.trainParam.lr = 0.05; %%don't know if this makes sense with train default
> net.trainParam.goal = 1e-5;
> [net tr]=train(net,Pbestneg,TNEG);
> Y=sim(net,Pbestneg);
> e=TNEG-Y;
> MSE=mse(e)
> MSE00=mean(var(TNEG'));
> R2=1-MSE/MSE00
> 
> 2:
> net = newff(Pbestneg,TNEG,[5 5],{'tansig' 'tansig' 'purelin'},'traingdm');
> net.trainParam.lr = 0.03;
> net.trainParam.epochs = 1000;
> net.trainParam.goal = 1e-5;
> net.trainParam.max_fail=10;
> net.trainParam.mc = 0.6;
> net = train(net,Pbestneg,TNEG);
> Y=sim(net,Pbestneg);
> e=TNEG-Y;
> MSE=mse(e)
> MSE00=mean(var(TNEG'));
> R2=1-MSE/MSE00
> 
> #1 consistently gives an positive R2 around 7-9 %, which for this study seems alright as a starting point. It always start validating after 2-3 epochs.
> 
> #2 consistently gives an negative R2 with the exact same variables. This never reach the performance goal, so never starts validating. (I've tried up to 4000 epochs, with the same conclusion) I tried different combinations of learning rate and momentum.
> 
> I haven't been taught in NN, but how I understand it is that the second model is more advanced in the sense that the chance og finding global min is better?
> 
> I'm afraid #1 gives some kind of spurious results i'm not aware of. I hope you can steer me in the right direction. 
> 
> Pbestneg is a 21x2610 matrix with stationary economic(day t) variables (interest rates, stock indices and so on) all in returns
> TNEG is a 1x2610 vector of realised returns(day t+1) on a currency cross 
> 
> MinTNEG  -0,0377
> Max TNEG 0,0473 


Hi,

how did it go? I am also trying to build up a NN model for forecasting exchange rates. Maybe we can share some experience and code....

What inputs do you use for your model? I currently have some technicals such as Moving Averages (5d,10,20,40,60,120) and RSI, coupled with Eurostoxx 50, Dow Jones, Yen and VIX data for forecasting the daily return of the EuroDollar.
0
Reply Peter 10/8/2010 10:53:04 AM

"Peter " <hazard1@gmx.net> wrote in message <i8mt6g$fqj$1@fred.mathworks.com>...
> "nicolaj " <nicolajjeppesen@hotmail.com> wrote in message <i57urc$n4u$1@fred.mathworks.com>...
> > Greg Heath <heath@alumni.brown.edu> wrote in message <a463b23a-022a-4edd-9e3c-f5b3fb80b01a@f6g2000yqa.googlegroups.com>...
> > > On Aug 25, 6:06 am, "nicolaj " <nicolajjeppe...@hotmail.com> wrote:
> > > > Hi
> > > >
> > > > I'm currently working on my master thesis where the objective is to test the performance of various neural networks on forecasting of foreign exchange rates.
> > > >
> > > > I have constructed the models, been doing some data manipulation and found some starting models with lagged variables against my target vector, which are all stationary and everything is, in a theoretically sense alright, but I in practice I have great problems!
> > > >
> > > > No matter which network I simulate, no matter how many layers and neurons in each layer and no matter which transfer functions I use I get almost the same MSE!
> > > >
> > > > I don't expect to find the "best model out there", but would expect the different models and structures would return different results.
> > > >
> > > > Here's an example of a newff with 2 hidden layers and 13 neurons in each and how I use it:
> > > >
> > > > net = newff(P,T,[13 13], {'tansig 'tansig'})
> > > > Y = sim(net,P);
> > > > net.trainParam.epochs = 1000;
> > > > net = train(net,P,T);
> > > 
> > > [net tr] = train(net,P,T);
> > > Nepochs = tr.epoch(end)
> > > MSE       = tr.perf(end)
> > > 
> > > > Y = sim(net,P);
> > > > d=[T-Y].^2;
> > > > MSE=mean(d)
> > > 
> > > help mse
> > > 
> > > > Do I use it wrong, or should I improve it somehow?? And as another strange thing; my models always converges after 8-12 epochs. Should I change the number of validation checks? If so, how is this done?
> > > 
> > > help trainlm
> > > net.trainParam.max_fail     5  Maximum validation failures
> > > 
> > > > Help on this subject would be very much appreciated.
> > > 
> > > Hard to make an intelligent comment without knowing
> > > 
> > > [I N]  = size(P)
> > > [O N] = size(T)
> > > minmax(T(:))
> > > MSE00 = mean(var(T'))   % ~MSE for the naive constant model
> > > R2 = 1-MSE/MSE00        % Rsquare statistic
> > > 
> > > Hope this helps.
> > > 
> > > Greg
> > 
> > Thank you for your reply. It helped to consider the R2 instead. But now I ran into some problems which I don't know how to evaluate. I currently run two different networks, both newff but with different training algorithms:
> > 
> > 1: 
> > net = newff(Pbestneg,TNEG,[9],{'tansig' 'tansig'});
> > Y=sim(net,Pbestneg);
> > net.trainParam.epochs=1000;
> > net.trainParam.max_fail=200;
> > net.trainParam.mc = 0.4; %don't know if this makes sense with train default
> > net.trainParam.lr = 0.05; %%don't know if this makes sense with train default
> > net.trainParam.goal = 1e-5;
> > [net tr]=train(net,Pbestneg,TNEG);
> > Y=sim(net,Pbestneg);
> > e=TNEG-Y;
> > MSE=mse(e)
> > MSE00=mean(var(TNEG'));
> > R2=1-MSE/MSE00
> > 
> > 2:
> > net = newff(Pbestneg,TNEG,[5 5],{'tansig' 'tansig' 'purelin'},'traingdm');
> > net.trainParam.lr = 0.03;
> > net.trainParam.epochs = 1000;
> > net.trainParam.goal = 1e-5;
> > net.trainParam.max_fail=10;
> > net.trainParam.mc = 0.6;
> > net = train(net,Pbestneg,TNEG);
> > Y=sim(net,Pbestneg);
> > e=TNEG-Y;
> > MSE=mse(e)
> > MSE00=mean(var(TNEG'));
> > R2=1-MSE/MSE00
> > 
> > #1 consistently gives an positive R2 around 7-9 %, which for this study seems alright as a starting point. It always start validating after 2-3 epochs.
> > 
> > #2 consistently gives an negative R2 with the exact same variables. This never reach the performance goal, so never starts validating. (I've tried up to 4000 epochs, with the same conclusion) I tried different combinations of learning rate and momentum.
> > 
> > I haven't been taught in NN, but how I understand it is that the second model is more advanced in the sense that the chance og finding global min is better?
> > 
> > I'm afraid #1 gives some kind of spurious results i'm not aware of. I hope you can steer me in the right direction. 
> > 
> > Pbestneg is a 21x2610 matrix with stationary economic(day t) variables (interest rates, stock indices and so on) all in returns
> > TNEG is a 1x2610 vector of realised returns(day t+1) on a currency cross 
> > 
> > MinTNEG  -0,0377
> > Max TNEG 0,0473 
> 
> 
> Hi,
> 
> how did it go? I am also trying to build up a NN model for forecasting exchange rates. Maybe we can share some experience and code....
> 
> What inputs do you use for your model? I currently have some technicals such as Moving Averages (5d,10,20,40,60,120) and RSI, coupled with Eurostoxx 50, Dow Jones, Yen and VIX data for forecasting the daily return of the EuroDollar.

Hi
My models seem to work alright. I've gotten pretty good R2 results and also out of sample profits. 
I still have some problems though, I would like to be able to run several simulations where I use the found weights from the last simulation as starting weights for the next, but I can't seem to get it to work. Do you know how this should be done? Or do you use other strategies to avoid the problem of local optimum?

I use mainly fundamental variables since my professors have this disbelief in technical indicators. It is a mix of 21 different price indices, long/short interest rates, commodities and different exchange rates.
But how are the results with your variables? I was thinking to use some of these technicals to find if any enhancements can be made.
Actually my code is rather simple and not much is changed from the above, but they seem to work nevertheless... 250 days out of sample generates between 15-30 % profit depending the cross.(simple trading strategy without any risk-/money managent)

Which networks and algorithms do you use? Could you post the code you use?  
0
Reply nicolaj 10/15/2010 7:58:05 AM

> Hi
> My models seem to work alright. I've gotten pretty good R2 results and also out of sample profits. 
> I still have some problems though, I would like to be able to run several simulations where I use the found weights from the last simulation as starting weights for the next, but I can't seem to get it to work. Do you know how this should be done? Or do you use other strategies to avoid the problem of local optimum?
> 
> I use mainly fundamental variables since my professors have this disbelief in technical indicators. It is a mix of 21 different price indices, long/short interest rates, commodities and different exchange rates.
> But how are the results with your variables? I was thinking to use some of these technicals to find if any enhancements can be made.
> Actually my code is rather simple and not much is changed from the above, but they seem to work nevertheless... 250 days out of sample generates between 15-30 % profit depending the cross.(simple trading strategy without any risk-/money managent)
> 
> Which networks and algorithms do you use? Could you post the code you use?  

Hi,

sorry for the late response.

well, i run several simulations and save those 16 trained networks (or 16 seeds) that yield good results with respect to draw down and sharpe ratio. each seed will tell me to buy (+1) or sell (-1). then by taking the sum from all seeds will give me my trading signal (strong buy, buy, neutral, sell, strong sell). 
eg. if 15 seeds tell me to buy and 1 seed suggests to sell, the summation then will give me 14 (=15-1) as my trading signal.

Here is my code:

Y=zeros(times,n);  %16 times
    for t=1:times
        net=newff(P,T,min(m,60),{'tansig' 'purelin'},'trainlm','learngdm');
        net.trainParam.epochs=100;
        net.trainParam.goal=0.000001;
        net.trainParam.max_fail=25;
        net.trainParam.mem_reduc=1;
        net.performFcn='msereg';    
        net.divideFcn='divideint';
        if t==1;net1=train(net,P,T);Y_Sim=sim(net1,P);save net1;elseif t==2;net2=train(net,P,T);Y_Sim=sim(net2,P);save net2;
        elseif t==3;net3=train(net,P,T);Y_Sim=sim(net3,P); save net3;
..........
        Y(t,:)=Y_Sim;            
    end  

Mean=sum(CheckData)/n;
Var=sqrt((sum(CheckData.^2)-Mean^2)/(n-1));
FY=Y';

b1=sum(FY<=Var & FY>0,2);                                       % buy signal
b2=sum(FY>Var,2);                                               % buy signal
s1=sum(FY<0 & FY>=-Var,2);                                      % sell signal
s2=sum(FY<-Var,2);                                              % strong sell signal

Signals=b1*1+b2*1+s1*-1+s2*-1;


My code is also rather simple. But if you could elaborate on the inputs you use, i could try to feed those to my networks and see what happens. Maybe we can exchange some m files?
0
Reply Peter 10/31/2010 11:10:05 AM

> Hi
> My models seem to work alright. I've gotten pretty good R2 results and also out of sample profits. 
> I still have some problems though, I would like to be able to run several simulations where I use the found weights from the last simulation as starting weights for the next, but I can't seem to get it to work. Do you know how this should be done? Or do you use other strategies to avoid the problem of local optimum?
> 
> I use mainly fundamental variables since my professors have this disbelief in technical indicators. It is a mix of 21 different price indices, long/short interest rates, commodities and different exchange rates.
> But how are the results with your variables? I was thinking to use some of these technicals to find if any enhancements can be made.
> Actually my code is rather simple and not much is changed from the above, but they seem to work nevertheless... 250 days out of sample generates between 15-30 % profit depending the cross.(simple trading strategy without any risk-/money managent)
> 
> Which networks and algorithms do you use? Could you post the code you use?  

Hi,

sorry for the late response.

well, i run several simulations and save those 16 trained networks (or 16 seeds) that yield good results with respect to draw down and sharpe ratio. each seed will tell me to buy (+1) or sell (-1). then by taking the sum from all seeds will give me my trading signal (strong buy, buy, neutral, sell, strong sell). 
eg. if 15 seeds tell me to buy and 1 seed suggests to sell, the summation then will give me 14 (=15-1) as my trading signal.

Here is my code:

Y=zeros(times,n);  %16 times
    for t=1:times
        net=newff(P,T,min(m,60),{'tansig' 'purelin'},'trainlm','learngdm');
        net.trainParam.epochs=100;
        net.trainParam.goal=0.000001;
        net.trainParam.max_fail=25;
        net.trainParam.mem_reduc=1;
        net.performFcn='msereg';    
        net.divideFcn='divideint';
        if t==1;net1=train(net,P,T);Y_Sim=sim(net1,P);save net1;elseif t==2;net2=train(net,P,T);Y_Sim=sim(net2,P);save net2;
        elseif t==3;net3=train(net,P,T);Y_Sim=sim(net3,P); save net3;
..........
        Y(t,:)=Y_Sim;            
    end  

Mean=sum(CheckData)/n;
Var=sqrt((sum(CheckData.^2)-Mean^2)/(n-1));
FY=Y';

b1=sum(FY<=Var & FY>0,2);                                       % buy signal
b2=sum(FY>Var,2);                                               % buy signal
s1=sum(FY<0 & FY>=-Var,2);                                      % sell signal
s2=sum(FY<-Var,2);                                              % strong sell signal

Signals=b1*1+b2*1+s1*-1+s2*-1;


My code is also rather simple. But if you could elaborate on the inputs you use, i could try to feed those to my networks and see what happens. Maybe we can exchange some m files?
0
Reply Peter 10/31/2010 11:11:04 AM

> Hi
> My models seem to work alright. I've gotten pretty good R2 results and also out of sample profits. 
> I still have some problems though, I would like to be able to run several simulations where I use the found weights from the last simulation as starting weights for the next, but I can't seem to get it to work. Do you know how this should be done? Or do you use other strategies to avoid the problem of local optimum?
> 
> I use mainly fundamental variables since my professors have this disbelief in technical indicators. It is a mix of 21 different price indices, long/short interest rates, commodities and different exchange rates.
> But how are the results with your variables? I was thinking to use some of these technicals to find if any enhancements can be made.
> Actually my code is rather simple and not much is changed from the above, but they seem to work nevertheless... 250 days out of sample generates between 15-30 % profit depending the cross.(simple trading strategy without any risk-/money managent)
> 
> Which networks and algorithms do you use? Could you post the code you use?  

Hi,

sorry for the late response.

well, i run several simulations and save those 16 trained networks (or 16 seeds) that yield good results with respect to draw down and sharpe ratio. each seed will tell me to buy (+1) or sell (-1). then by taking the sum from all seeds will give me my trading signal (strong buy, buy, neutral, sell, strong sell). 
eg. if 15 seeds tell me to buy and 1 seed suggests to sell, the summation then will give me 14 (=15-1) as my trading signal.

Here is my code:

Y=zeros(times,n);  %16 times
    for t=1:times
        net=newff(P,T,min(m,60),{'tansig' 'purelin'},'trainlm','learngdm');
        net.trainParam.epochs=100;
        net.trainParam.goal=0.000001;
        net.trainParam.max_fail=25;
        net.trainParam.mem_reduc=1;
        net.performFcn='msereg';    
        net.divideFcn='divideint';
        if t==1;net1=train(net,P,T);Y_Sim=sim(net1,P);save net1;elseif t==2;net2=train(net,P,T);Y_Sim=sim(net2,P);save net2;
        elseif t==3;net3=train(net,P,T);Y_Sim=sim(net3,P); save net3;
..........
        Y(t,:)=Y_Sim;            
    end  

Mean=sum(CheckData)/n;
Var=sqrt((sum(CheckData.^2)-Mean^2)/(n-1));
FY=Y';

b1=sum(FY<=Var & FY>0,2);                                       % buy signal
b2=sum(FY>Var,2);                                               % buy signal
s1=sum(FY<0 & FY>=-Var,2);                                      % sell signal
s2=sum(FY<-Var,2);                                              % strong sell signal

Signals=b1*1+b2*1+s1*-1+s2*-1;


My code is also rather simple. But if you could elaborate on the inputs you use, i could try to feed those to my networks and see what happens. Maybe we can exchange some m files?
0
Reply Peter 10/31/2010 11:14:04 AM

7 Replies
329 Views

(page loaded in 0.152 seconds)

Similiar Articles:













7/24/2012 11:38:51 AM


Reply: