[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on .dll files and Tradestation



PureBytes Links

Trading Reference Links

Todd

Following on from the example below ... dll's are vey useful but do not let
them take control e.g. producing a message box, this will cause TS to hang.

Paul Williams (programmer)
www.futurenets.co.uk

----- Original Message -----
From: "Mark Smeets" <mark@xxxxxxxxxxx>
To: <todd@xxxxxxxxxxxx>; <omega-list@xxxxxxxxxx>
Sent: Monday, December 30, 2002 1:13 PM
Subject: RE: Question on .dll files and Tradestation


> Maybe I can help you. Here is some code for a simple moving average:
>
> Here is the movavg.cpp file:
>
> #include "movavg.h"
> #include <stdio.h>
> int __stdcall MyMovAvg(LPLONG lpClose, int n, float scale, LPFLOAT
> result)
>

> float x = 0.0;
> for (int i = 0; i < n; i++) {
> x += *FindAddress_Close(lpClose,i);
> }
> *result = x/static_cast<float>(n*scale);
> return 0;
> }
>
> BOOL APIENTRY DllMain( HANDLE hModule,
> DWORD ul_reason_for_call,
> LPVOID lpReserved )
> {
> switch( ul_reason_for_call )
> {
> case DLL_PROCESS_ATTACH:
>  MessageBox(NULL,"Inside case DLL_PROCESS_ATTACH",
>  "Made it this far",MB_OK);
> case DLL_THREAD_ATTACH:
> ;
> case DLL_THREAD_DETACH:
> ;
> case DLL_PROCESS_DETACH:
> ;
> }
> return TRUE;
> }
>
> Here is the movavg.h file:
>
> #include <windows.h>
> #include "elkit32.h"
>
> int __stdcall MyMovAvg(LPLONG lpClose,int n, float scale, LPFLOAT
> result);
>
> And you need a movavg.def file:
>
> EXPORTS
> MyMovAvg
>
> Please note that you will need to add the .def file to your project. By
> the way, I've only been succesful using visual C++; There are issues
> with a dll built with borland C++ builder and tradestation.
>
> I've had only moderate success using dlls with tradestation. I get all
> sorts of spurious floating point errors. Furthermore, the speedup was
> far less than I had expected.
>
> Good luck,
>
> Mark.
>
> > -----Original Message-----
> > From: Todd Hanson [mailto:todd@xxxxxxxxxxxx]
> > Sent: vrijdag 27 december 2002 23:11
> > To: omega-list@xxxxxxxxxx
> > Subject: Question on .dll files and Tradestation
> >
> >
> > Does anyone out there have any sample .dll files in C++ programmed for
> > tradestation that I can take a look at? Any help would be greatly
> > appreciated. Thank you.
> >
> > -----Original Message-----
> > From: omega-digest-request@xxxxxxxxxx
> > [mailto:omega-digest-request@xxxxxxxxxx]
> > Sent: Friday, December 27, 2002 1:52 PM
> > To: omega-digest@xxxxxxxxxx
> > Subject: omega-digest Digest V102 #420
> >
> >
> >
> >
>