Thanks @gregid. My programming skills are still very basic and limited to what I have learned to do inside NT in the past 6 months. My question is when I download projects or libraries, what are the steps to being able to use them inside NT? Do I have to move the files to a certain location? Do I have to declare "using" statements? I appreciate all your help and I am trying to learn more in depth programming.
There are 2 options:
1) You can locate LibSharpTave.dll in the downloaded code for OctaveSharp. Then add reference to this file from your ninjascript (right click in the NinjaScript editor "References", "Add" then browse for the LibSharpTave.dll
2) You can locate Octave.cs file from source code and copy it to your Strategy or Indicator folder in NT. Compile some indicator/strategy
Whichever option you choose - you need to use the following statement:
The rest is just as in the snippet above. Please bear in mind I haven't tested it so I may have missed something, but I don't think so.
Obviously when you instantiate Octave you need to provide correct path
Good luck and let us know how are you doing!
The following user says Thank You to gregid for this post:
Thanks for this information. I just started going through the Octave Manual page by page, and should be able to start using it by next week. Would tick by tick calculations take too long with C# and a standard PC? I don't want to start experimenting with tick data just to find out any reasonably priced setup would be too slow, or that NT running on C# would be too slow.
I have adapted the OctaveSharp from CodeProject to .NET 3.5 for NT7 and so it doesn't need a DLL which looked like it would be .NET 4.0 and NT7 would not load it. I have also added some features and the ability to maintain a single copy of Octave per strategy. Without the changes you could end up with many copies of Octave running in the background.
The Strategy has example code on sending Matrix's and receiving Scalar's, Vector's, and Matrix's. Also how to access the matrix values.
This approach does use Standard output so keep in mind the logic will want to use it to minimize IO size. Create a way to append to arrays and only import data you need.
There are a few major sections (In Startup)
m_Octave=new Octave(m_OctavePath,false); // Makes the connection to Octave
// Creates a vector "c" of the current bar with offset depending on depth in vector
// scalar is set to the 9th element of "c" (starting index in Octave is 1 not 0)
// Dot wise addition
// Creates a 3x10 matrix by combining the row vectors into a matrix
//Get the Scalar, Vector, & Matrix values from Octave back into C# val = m_Octave.GetScalar("scalar");
double  a = m_Octave.GetVector("a");
double  b = m_Octave.GetVector("b");
double  c = m_Octave.GetVector("c");
double  m = m_Octave.GetVector("m");
double  aa = m_Octave.GetMatrix("aa");
Here is a sample run from the strategy (Print statements in Strategy):
Bear with me guys, I haven't looked at this level mathematics in over 6 years. Could someone post a simple example of finding the least squares solution of a system of linear equations, returning the solution and the residual matrix?