logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
nobel_1101  
#1 Posted : Sunday, July 8, 2007 3:23:09 PM(UTC)
nobel_1101

Rank: Member

Groups: Registered, Registered Users
Joined: 5/17/2005(UTC)
Posts: 24
Location: London

Hi all

Not sure if solution already exists on this site but I've managed to implement use of the MSFL.dll using C# 2005. Basically I've converted the c++ msfl.h file into a C# compatible form and have used Platform Invoke to call methods on the msfl.dll.

I can make the msfl.cs source code freely available to anyone who wants it.

Regards

Craig

wabbit  
#2 Posted : Sunday, July 8, 2007 6:07:05 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Craig,

I, for one, would like a copy of the code, and maybe a sample function?

Are there any benefits to compiling a C# app over a non-.NET app? I never got onboard with the whole .NET thing and didn't like the direction Microsoft was going with its program environments, but if there are benefits to be had, then I had better take another look?



wabbit [:D]


nobel_1101  
#3 Posted : Tuesday, July 10, 2007 7:41:50 AM(UTC)
nobel_1101

Rank: Member

Groups: Registered, Registered Users
Joined: 5/17/2005(UTC)
Posts: 24
Location: London

Hi Scott

I'll upload the code to my website when I get home tonight. I have a sample function which uses the MSFL1_GetDataRec() function to retrive all price data for a particular security.

Unfortunately the MSFL2_GetMultipleDataRecs() function doesn't work. So I have to make multiple calls to MSFL1_GetDataRec(), but the performance isn't noticably different.

I'm not sure why MSFL2_GetMultipleDataRecs() doesn't work. I pass the function an array of price record structs but it doesn't populate them.

Brandan - Not sure if you have come across this problem in your dealings with .NET?

----------------------------

As for benefits to compling a C# app instead of C++6, where do I start! [:)]

Its main benefits are that it is very simple to write in (comparable with Visual Basic) and the code runs almost as fast as C++ (approx 1.1 seconds for every 1 second in C++).

For me, writing a function of medium complexity in C++ would take 4 times longer than in C# purely as C# environment is so much easier to use and bug handling/fixing is a dream compared to C++. I now spend more time thinking about trading logic rather than technical programming issues.

I was sceptical of .NET before, it looked like there were lots of incompatibility issues with unmanaged code. However I've found that not to be the case.

C# / .NET has a namespace called InteropServices which allows you to call C# dlls from C++ code.

I use a C++ MSX dll wrapper so that my C# dll can interface with Metastock.

Regards

Craig

nobel_1101  
#4 Posted : Tuesday, July 10, 2007 12:15:57 PM(UTC)
nobel_1101

Rank: Member

Groups: Registered, Registered Users
Joined: 5/17/2005(UTC)
Posts: 24
Location: London

Administrator has moderated this post.

It is in violation of the Equis Software license agreement to distribute the MDK source code in this manner.

carot  
#5 Posted : Monday, August 6, 2007 10:10:22 AM(UTC)
carot

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/9/2007(UTC)
Posts: 2

I have write this code, and it return -170 from MSFL1_AddSecurity function, means MSFL_ERR_INVALID_FIELD_ORDER , can anyone help me fix this. Thanks in advance.

private void CreateCK()
{
string folder = txtDesPath.Text;
int iErr;
byte nDirNum=0;
iErr = MSFL.MSFL1_OpenDirectory(folder,ref nDirNum,MSFL.MSFL_DIR_FORCE_USER_IN);
if(iErr == 1)
{
iErr = MSFL.MSFL1_BuildMetaStockDirectory(nDirNum);
}
int iDate;
iDate = DateTime.Now.Year * 10000 + DateTime.Now.Month * 100 + DateTime.Now.Day;
// create CK
MSFLSecurityInfo_struct objSec = new MSFLSecurityInfo_struct();
//MSFLSecurityInfo_struct8 objSec = new MSFLSecurityInfo_struct8();
objSec.dwTotalSize = MSFL.MSFL_SEC_INFO_SIZE;
objSec.szName = "VCD";//item[0].ToString();
objSec.szSymbol = "VCD";//item[0].ToString();
objSec.bCompositel = MSFL.MSFL_FALSE; // not a composite
objSec.cPeriodicity = 73; // daily
objSec.wInterval = 0; //not know
objSec.ucDisplayUnits = 0; // not know
//Set the available data
objSec.wDataAvailable = MSFL.MSFL_DATA_DATE + MSFL.MSFL_DATA_CLOSE + MSFL.MSFL_DATA_VOLUME + MSFL.MSFL_DATA_TIME;
//objSec.wDataAvailable = MSFL.MSFL_DATA_DATE + MSFL.MSFL_DATA_CLOSE + MSFL.MSFL_DATA_HIGH + MSFL.MSFL_DATA_LOW + MSFL.MSFL_DATA_OPEN + MSFL.MSFL_DATA_VOLUME;
/*objSec.wDataAvailable = MSFL.MSFL_DATA_DATE + MSFL.MSFL_DATA_CLOSE +
MSFL.MSFL_DATA_VOLUME + MSFL.MSFL_DATA_HIGH + MSFL.MSFL_DATA_LOW +
MSFL.MSFL_DATA_OPEN;*/
objSec.lFirstDate = iDate;
objSec.lLastDate = iDate;

iErr = MSFL.MSFL1_AddSecurity(nDirNum,ref objSec,0);

if(iErr == 0)
{
MessageBox.Show("OK");
}
}
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.