Encog has posted a tutorial and training software for a neural network implementations for trading.
The tutorial is based around Ninja but all the code is C# and quite applicable to OpenQuant.
http://www.heatonresearch.com/ninjatrader/articles/starting-encog25-ninjatraderThe code is as easy as...
Code:
protected override void OnBarUpdate()
{
if (CurrentBar < INPUT_WINDOW) return;
//Next we allocate space for the input.
//The number 3 is because we have 3 indicator inputs(the three values of the MACD).
//If you add more, you must up this number.
INeuralData input = new BasicNeuralData(3*INPUT_WINDOW);
//We must now fill the input with the correct time values,
//this is the MACD indicator trailing backwards.
//This must match the order that the network was trained with.
int index = 0;
for(int i=0;i<INPUT_WINDOW;i++)
{
input[index++] = stats[3].Normalize( MACD(12,26,9)[i] );
input[index++] = stats[4].Normalize( MACD(12,26,9).Avg[i] );
input[index++] = stats[5].Normalize( MACD(12,26,9).Diff[i] );
}
//We are now ready to compute the output from the neural network. We call Encog to do this.
INeuralData output = network.Compute(input);
double d = output[0];
d = stats[6].DeNormalize(d);Finally, we display the output from the neural network.
BestReturn.Set(d);
}
May all your positions be filled!
CS