SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Oct 28, 2020 11:18 am

All times are UTC + 3 hours

Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun Feb 27, 2011 6:14 am 

Joined: Mon Sep 08, 2008 2:20 am
Posts: 40
Location: Toronto, Ontario, Canada
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.

The code is as easy as...

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.


May all your positions be filled!


PostPosted: Mon May 16, 2011 6:12 am 

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
Nice post, thank you. Have you found that most things interface between NinjaTrader and OQ without major code rewrites?

PostPosted: Sun May 13, 2012 4:00 pm 

Joined: Tue Aug 10, 2010 9:28 pm
Posts: 2
I wrote an API for OQ , it's already inside the Encog-core (was submitted and accepted in the git 6 - 7 months ago).

You can basically load any data and process it in Encog framework.

see :

public static LoaderTypes OpenquantDataLoader(string instrument, DateTime dtfrom, DateTime dtto, Data.Data.BarType bartype, long barsize);
public static double[] FromBarSeriestoDouble(Encog.App.Quant.Loader.OpenQuant.IDataSeries thebarserie);

You start first by :

public LoaderTypes(string instrument, DateTime StartingDate, DateTime ToDate,Data.Data.BarType Type, long SizeOfBars);

I posted a strategy in Encog forums..

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 3 hours

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group