I’m familiar with Ninjatrader, being able to code directly in C#, although I want to step up my game and get MatLab functions into Ninjatrader.
I know MatLab interface is not supported but maybe someone on the forum already had the same need and difficulties and will be kind enough to help me out. Would appreciate the assistance very much and this thread could be a step by step explanation of the interface process useful to others.
The moment where I get an error message is when I am calling my exported matlab function.
Can anyone provide the line of code I should be using to call the MatLab function considering the attachments I added to the thread?
Attached the matlab function, word file with images of the steps done and ninja indicator that tries to interface with DLL and gives an error...
ACFTest.cs
acf.zip
MatLab Forum Question to post.doc
System INFO
OS Windows 7 professional
NT 7
MatLab R2013a (8.1.0.604), Win32
What I have done so far
Using the information I found in NT Forum this is what I did to create an example of a custom dll of the open-source MATLAB package spatial-econometrics.com’s ACF(x,k,p) Autocorrelation Coefficient Estimation function:
- Create .NET 3.5 Custom DLL of ACF Matlab function in “Documents\NinjaTrader 7\bin\custom”
- MWArray.dll was copied into Documents\NinjaTrader 7\bin\custom
- Reference MWArray and ACF DLL in Ninjatrader
- In Ninjatrader code an Indicator, called ACFTest, that uses ACF(x,k,p) function:
ACFTest Ninja Indicator:
In Using declarations added:
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;
using ACF;
Variable for sample size:
privateint sampleSize = 100; // Default setting for SampleSize
OnBarUpdate:
MWNumericArray data= new MWNumericArray( MWArrayComplexity.Real, MWNumericType.Double, sampleSize);
for (int idx= 1; idx <= sampleSize; idx++)
{
data[idx]= Close[sampleSize - idx];
}
But when I try to call ACF function I guess I’m doing something wrong….what I’m doing is:
MWArray[] argsOut= ACF(data,1,1);
And I get the error:
'ACF' is a 'namespace' but is used like a 'variable'
can anyone show me what I should be doing in the data array?
MWArray[] argsOut= ?????;
or is the error somewhere else?
many thanks
Paulo
Comment