You will not be able to make it work correctly. (as it stands)
IEasyLanguageObject is the top most object address provided by TradeStation to reference all variables defined within that study.
Without that address you have no means to address the proper variables.
Announcement
Collapse
No announcement yet.
How do I use a DLL written for Tradestation in PB
Collapse
X
-
You know it would have been a lot easier to just say "the implied or express ALIAS in the DECLARE statement for an external function must match the implied or express ALIAS under which the procedure is exported from the library named in the LIB clause."
Leave a comment:
-
I thought the Alias statement is only used to make an external call reference to the DLL. By having the same name , don't you just call yourself?
The ALIAS clause in a procedure header or DECLARE statement is used to override the compiler's default alias name in the import table (for DECLAREd external functions) or the export table (for EXPORTed function) of the PE exectuable being compiled.
The default alias name is the upper-cased version of the procedure name as typed.
eg
Code:' FILE: MOD1.BAS #COMPILE EXE ' or DLL but that would just confuse the issue) DECLARE FUNCTION Foo LIB "Mydll.dll" ALIAS "LicketySplit" () AS LONG
Code:'FILE: MyDll.BAS #COMPILE DLL FUNCTION Thursday ALIAS "LicketySplit" () EXPORT AS LONG
The ALIAS clause would have to read "THURSDAY" in the DECLARE statement of MOD1 if there were no ALIAS clause in the procedure header in MYDLL.
Just make yourself a rule: ALWAYS use the ALIAS clause where allowed and you won't ever have to worry about it.
MCM
Leave a comment:
-
Michael I followed up your suggestion. The Exception unknow code doesn't present itself anymore, but another message occurs instead: Program tried to read or write an invalid memory adres.
I thought the Alias statement is only used to make an external call reference to the DLL. By having the same name , don't you just call yourself?
Thanks for the replies, any kind of help is welcome here.
Kind Regards,
Rob
Leave a comment:
-
Try a search on "TradeStation" (whatever that is???)
I know I had a discussion with someone trying to port VB examples to PB and involved "TradeStation" somewhere in the past year or 2. So that should give you something to search for (even if its just my name, that may get the search to find a result)
Honestly though, when in doubt, I would use POFFS (I hear they updated database) if nothing creeps up. (Don't know about anyone else, but when I search lately, most results involve some post I made and not so much the question I was searching on) but maybe its just a setting I accidentally set?
Leave a comment:
-
However, this could be simpler than that...
I wonder if...
Code:external: "TSLpp.dll", float, "ProcessData", ...
Code:DECLARE FUNCTION ProcessData [B][COLOR="Red"]ALIAS "ProcessData" .....[/COLOR][/B]
Leave a comment:
-
>I looked around but I can't find a answer to my question.
> When I call the TSLpp.DLL, I get: Exception unknown, code = &HC0000139
If the exception occurs in that module, you'll have to ask the publisher of that module.
But that looks like a Windows message... so you'd have to ask the publisher of that module why 'something' in that module resulted in this exception.
As far as what "elkit32.DLL" would do vis-a-vis forwarding your calls from a function in tslpp.dll to a function in another module, you'd have to ask the publisher of that module.
(I am starting to see a pattern here. Are you?)
FWIW, I have to believe there is either a newsgroup, an on-line forum, or both for "Interfacing with Tradestation." You might get better quantity and quality answers there.
MCM
Leave a comment:
-
Originally posted by Michael Mattias View PostAnd I suspect this is an unlicensed use of the licensed product.
I looked around but I can't find a answer to my question.
When I call the TSLpp.DLL, I get: Exception unknown, code = &HC0000139.
So the hooks are there alright, but the Com browser doesn't come up with anything on the subject.
Maybe replacing ELKit32.DLL with my own version would refer back the calls from TSLpp to my own DLL.
Any thoughts on this?
Kind Regards,
Rob
Leave a comment:
-
I suspect Tradestation passes an adres to that pointer which is not available in my DLL.
But if I am wrong about that and this would be a permitted use....
A. I know tradestation provides 'hook points' where it will call functions in YOUR DLL and allow you to modify or use data. try a search here on "TradeStation" there should be a bunch of posts over the years.
B. If the tradestation DLL exposes a COM interface, the COM browser should be able to find it and generate an #INCLUDE file for it.
MCM
Leave a comment:
-
How do I use a DLL written for Tradestation in PB
I'm trying to use a DLL original written for Tradestation in my PB DLL without having to use Tradestation.
The syntax of an external statement in EasyLanguage is:
external: ["<PATH>”,] [RETURN TYPE,] "<DLL FUNCTION NAME>",
[ARGUGMENT 1 TYPE, ARGUMENT 2 TYPE, …] ;
In EasyLanguage the code used with these DLL's is:
external: "TSLpp.dll", float, "ProcessData", IEasyLanguageObject, LPSTR, double, double, double, double, double, double, double, int;
external: "TSLpp.dll", float, "GetArray1", IEasyLanguageObject, LPSTR;
ProcessData(self, "MyArrayOut1", Open, High, Low, Close, dayofweek(date), 0, 0, 1{put});
ProcessData(self, "MyArrayOut1", Open, High, Low, Close, dayofweek(date), 1, 0, 2{get});
for n=1 to 62 begin
v1[n]=MyArrayOut1[n];
end;
Code:DECLARE FUNCTION ProcessData LIB "TSLpp.dll" (BYVAL pELObject AS PTR, BYVAL ArrayName AS ASCIIZ PTR, BYVAL SetOpen AS DOUBLE, BYVAL SetHigh AS DOUBLE, BYVAL SetLow AS DOUBLE, BYVAL SetClose AS DOUBLE, BYVAL SetDayofWeek AS DOUBLE, BYVAL PreprocessType AS DOUBLE, BYVAL unused4 AS DOUBLE, BYVAL SetPutGet AS INTEGER) AS SINGLE DECLARE FUNCTION GetArray1 LIB "TSLpp.dll" (BYVAL pELObject AS PTR, BYVAL ArrayName AS ASCIIZ PTR) AS SINGLE FOR i=0 TO Barcounter-1 CALL ProcessData(i, STRPTR("MyArrayOut1"), Open, High, Low, Close, dayofweek(),0,0,1) CALL ProcessData(i, STRPTR("MyArrayOut1"),Open, High, Low, Close, Dayofweek,1,0,2) CALL GetArray1(i ,STRPTR("MyArrayOut1")) FOR n=1 to 62 v1(n)=MyArrayOut1(n) Next n 'My Applicationcode Next i
I suspect Tradestation passes an adres to that pointer which is not available in my DLL.
Kind Regards,
Rob
Leave a comment: