Here is what you seek. Please use it trading the ER2 e-mini in the
U.S. market (I need the order flow):
#include
<math.h>
#include <stdlib.h>
#include
<iostream>
double
input_hidden_weights[5][6]=
{
{9.40985654649721e-001,
9.23136985641824e+000, -
2.86994950445746e+000,
-1.26803931926022e+000, -
7.70008830456271e+000,
1.25421731000059e+000 },
{3.08886279182467e+000,
5.78057919510794e+000,
1.10741139003555e+001,
-3.65436515636221e+000, -
1.46817775035674e+001,
2.22520984659718e+001 },
{1.69160825877441e-001,
-9.91646811530742e+000, -
1.05635083282757e+001,
4.25517810226395e+000, 2.50631134577816e+000,
-
2.91169885599088e+000 },
{-6.47564626574024e-001,
-6.79555863835188e+000, -
4.77495170169956e+000,
1.35029793165373e+000, 2.78079262918906e+000,
-
1.90795645602409e+000 },
{1.43573516935369e+000,
7.90014107622549e+000,
1.34639286162717e+000,
-4.87454998380292e-001, -
5.75300672778634e+000,
2.44385407464775e+000 }
};
double hidden_bias[5]={
-1.72504436049218e+000, -
1.12353474266980e+001,
1.05782985606737e+001, 6.38618458656671e+000,
-
4.76099367812151e+000 };
double
hidden_output_wts[1][5]=
{
{4.85655076789677e+000,
5.85365165791789e-001,
3.11879288899187e+000,
-8.48772823147294e+000, -
9.35987517826960e+000 }
};
double
output_bias[1]={ 5.51616000361064e+000 };
double
max_input[6]={ 3.02200000000000e-001, 6.05400000000000e-001,
1.81400000000000e-001, 1.59000000000000e-002,
6.06600000000000e-001,
2.43900000000000e-001 };
double
min_input[6]={ -2.82000000000000e-001, -8.46700000000000e-
001,
-1.95700000000000e-001, -9.70000000000000e-003,
-
5.52700000000000e-001, -2.45100000000000e-001 };
double
max_target[1]={ 1.35100000000000e-001 };
double
min_target[1]={ -1.50800000000000e-001 };
double
input[6];
double hidden[5];
double output[1];
void FindMax(double*
vec, double* max, long* maxIndex,int len)
{
long i;
*max =
vec[0];
*maxIndex = 0;
for(i=1; i<len;
i++)
{
if(vec[i]>*max)
{
*max = vec[i];
*maxIndex =
i;
}
}
}
void FindMin(double* vec, double* min, long* minIndex,int
len)
{
long i;
*min = vec[0];
*minIndex = 0;
for(i=1; i<len;
i++)
{
if(vec[i]<*min)
{
*min = vec[i];
*minIndex =
i;
}
}
}
void ScaleInputs(double* input, double min, double
max, int size)
{
double delta;
long i;
for(i=0; i<size;
i++)
{
delta =
(max-min)/(max_input[i]-min_input[i]);
input[i] = min -
delta*min_input[i]+ delta*input[i];
}
}
void
UnscaleTargets(double* output, double min, double max, int
size)
{
double delta;
long i;
for(i=0; i<size;
i++)
{
delta =
(max-min)/(max_target[i]-min_target[i]);
output[i] =
(output[i] - min + delta*min_target[i])/delta;
}
}
double
logistic(double x)
{
if(x > 100.0) x = 1.0;
else if (x <
-100.0) x = 0.0;
else x = 1.0/(1.0+exp(-x));
return x;
}
void
ComputeFeedForwardSignals(double* MAT_INOUT,double* V_IN,double*
V_OUT, double* V_BIAS,int size1,int size2,int layer)
{
int
row,col;
for(row=0;row < size2; row++)
{
V_OUT[row]=0.0;
for(col=0;col<size1;col++)V_OUT[row]+=(*(MAT_INOUT+(row*size1)+col)
*V_IN[col]);
V_OUT[row]+=V_BIAS[row];
if(layer==0)
V_OUT[row] = logistic(V_OUT[row]);
if(layer==1) V_OUT[row] =
tanh(V_OUT[row]);
}
}
void RunNeuralNet_Regression ()
{
ComputeFeedForwardSignals((double*)
input_hidden_weights,input,hidden,hidden_bias,6,
5,0);
ComputeFeedForwardSignals((double*)
hidden_output_wts,hidden,output,output_bias,5,
1,1);
}
--- In amibroker@xxxxxxxxxps.com,
"Vinay Gakkhar," <vgakkhar@xx.>
wrote:
>
> Dear
Prashanth, Dear Ton, Dear John,
>
> This is with reference to my
following request of 5th Oct 2007 to
> Prashanth, and your following
interaction.
>
> Can i have the AFL John had posted in this forum
on 23rd Sept,
2007, which
> was reproduced by Prashanth in his reply
to Ton on 6th October ,
2007 ? I
> have not been able to locate
it.
>
> Best regards,
>
> Vinay
>
>
> Re: [amibroker] NEURAL ANALYSIS IN AMIBROKER
>
> Ton
Sieverding
> Sat, 06 Oct 2007 12:07:16 -0700
>
> Thanks
John. Most important part for me is to hear that you got AB
running
> a
> NN. Please let me know the Intermaket data you
were using. Also
what's the
> learning procedure for the NN ? In
other words, can you please give
us a
> little
> more
background music ?
>
> Regards, Ton.
>
> -----
Original Message -----
> From: [EMAIL PROTECTED]
> To: amibroker@xxxxxxxxxps.com
>
Sent: Saturday, October 06, 2007 11:05 AM
> Subject: Re: [amibroker]
NEURAL ANALYSIS IN AMIBROKER
>
> PLease bare in mind that this is
only the source code to the NN
in C++
> You would still need to
create the function and feed data in.
> Thsi network is based on an
example network i built a while
back to
> predict
> the log
return of the Aussie Dollar futures contract over the next
50
>
days. It
> needs to be fed the log returns of 6 intermarkets to provide
a
relevant
> output.
> the reason i posted the code was not so
someone could use it as
a NN, but
> to
> emphasise teh fact
that a NN built using a 3rd party tool COULD be
> integrated
>
into AB using ADK and used in a trading system.
>
> John
>
> Prashanth <[EMAIL PROTECTED]> wrote:
> Hello Ton,
>
> Attached is the AFL that a person by name John had posted in
this
> forum on
> 23-09-07.
>
> Cheers
>
> Prashanth
>
> ----- Original Message -----
> From:
"Ton Sieverding" <[EMAIL PROTECTED]>
> To: <amibroker@xxxxxxxxxps.com>
>
Sent: Saturday, October 06, 2007 12:11 AM
> Subject: Re: [amibroker]
NEURAL ANALYSIS IN AMIBROKER
>
> > Prashanth do you still know
where to find the code for a
NN ? I
> really
> would
>
> like to see how this works because I just don't understand
what
AB
> has to
> do
> > with NN ...
> >
>
> Regards, Ton.
> >
> > ----- Original Message
-----
> > From: "Prashanth" <[EMAIL PROTECTED]>
> >
To: <amibroker@xxxxxxxxxps.com>
>
> Sent: Friday, October 05, 2007 7:49 PM
> > Subject: Re:
[amibroker] NEURAL ANALYSIS IN AMIBROKER
> >
> >
>
> > Hello Vinay,
> > >
> > > I think this
question of you rs was answered a while
back. As far
> as my
>
> > belief and knowledge is concerned, No, you cant create a
Neural
> Network
> > > using just AB.
> >
>
> > > Someone had posted a formula which he said that proved
that NN can
> infact
> > be
> > > coded in AB,
but since my C++ files have a compliation
error, I
> havent
>
> been
> > > able to test out the same.
> >
>
> > > There are a lot of NN based trading products in the
market though
> I am
> not
> > > sure as to
whether they really can make money for the
buyer since
> if
it
> > > could, it woudnt be for sale in the first place.
>
> >
> > > Cheers
> > >
> > >
Prashanth
> > >
> > > ----- Original Message
-----
> > > From: "Vinay Gakkhar." <[EMAIL
PROTECTED]>
> > > To: "amibroker" <amibroker@xxxxxxxxxps.com>
>
> > Sent: Friday, October 05, 2007 3:40 PM
> > > Subject:
[amibroker] NEURAL ANALYSIS IN AMIBROKER
> > >
> >
>
> > > > Dear Prashanth,
> > > >
>
> > > Can you please tell me whether there is any formula or
add-on
> for
> > > > Amibroker which analyses the
available past data like a
neural
> network
> > > >
does, finds the common pattern, and shows the result
like neural
>
> network?
> > > >
> > > > Thanks,
>
> > >
> > > > vinay
>