I am trying to get access to Array elements of an Array in EasyLanguage (A language used in TradeStation - a stand alone Application) from my PB Dll.
(Ultimatly I would like to be able to access an array element, do some calculations and then stuff the result back in place of the original element so i can have access to it in EasyLanguage)
Anyways, Part1 of this problem is to get access to an array element in my PB Dll. Omega (who make TradeStation) have a developers kit (a Dll) for C++ and VB users. Here is what they say about accessing array elements:
ELKIT32.DLL
Functionality
The EasyLanguage Tool Kit Library is implemented in the form of a dynamic-link library. It provides useful functions that can be called from any user DLL. It is commonly used to find the address of an offset of an EasyLanguage data object from within a user DLL.
Components
There are four components in the EasyLanguage Tool Kit Library: a header file (ELKIT32.H), two link-time library files (ELKITVC.LIB and ELKITBOR.LIB), and an executable DLL file (ELKIT32.DLL). 'ELKIT32.H' is a standard C header file. It contains the function headers for all the functions that are available in 'ELKIT32.DLL'. The '.LIB' files should be used when linking a user DLL that calls the ELKIT32.DLL functions. 'ELKITVC.LIB' should be used when working in the Microsoft Visual C++ environment while 'ELKITBOR.LIB' should be used in the C++ Builder environment.
Functions Available:
FindAddress_Array
FindAddress_Open
FindAddress_Close
FindAddress_OpenInt
FindAddress_Date
FindAddress_Time
FindAddress_DownTicks
FindAddress_UpTicks
FindAddress_High
FindAddress_Var
FindAddress_Low
FindAddress_Volume
...................................................................................................................................
FindAddress_Array:
LPFLOAT FindAddress_Array( LPFLOAT lpArray[ArrayPosition], int nSpaceOfs, int nOfs, DWORD wStartAddr, DWORD wArraySize );
Parameters:
lpArray
A pointer to an Array in EasyLanguage.
nSpaceOfs
Specifies the offset of array elements. The offset is forward if nSpaceOfs is positive and backwards if nSpaceOfs is negative.
nOfs
Specifies the bar offset. The offset is backwards if Ofs is positive or forward if Ofs is negative.
wStartAddr
The starting address of the buffer as determined by the EasyLanguage keyword ArrayStartAddr.
wArraySize
The size of the buffer associated with the array as determined by the EasyLanguage keyword ArraySize.
Returns:
A pointer to the value of an Array element offset by nOfs.
Remarks:
wArraySize is the size of the buffer associated with the array. This value is obtained from EasyLanguage by calling the ArraySize function. wStartAddr is the starting address of the buffer. The ArrayStartAddr function should be called to obtain this value.
....................................................................................................................................
{ Omega Research TradeSatation EasyLanguage Example }
DefineDLLFunc: "MYLIB.DLL",float,"FindArray",multiple;
Var: wStartAddr(0), wArraySize(0),Counter(0), Result(0);
Array: MyArray [10](0);
If CurrentBar = 11 then Begin
For Counter = 0 to 10 Begin
MyArray[Counter] = Close[Counter];
End;
End;
wStartAddr = ArrayStartAddr(MyArray);
wArraySize = ArraySize(MyArray);
Result = FindArray((LPFLOAT)&MyArray[7], (int) -3, (int) 2, (DWORD)wStartAddr, (DWORD)wArraySize );
Plot1(Result, "FindArray");
...................................................................................................................................
// Example of FindAddress_Var in MYLIB.DLL
// starting at element 7, go back 3 elements and 2 bars
float FindArray( LPFLOAT lpVar, int nSpaceOfs, int nOfs, DWORD wStartAddr, DWORD wArraySize )
{
LPFLOAT lpNewAddr;
lpNewAddr = FindAddress_Array(lpArray, nSpaceOfs, nOfs, wStartAddr, wVarSize);
return *lpNewAddr;
}
...................................................................................................................................
So first I want to declare the elkit32.dll in my Dll. I tried like this:
DECLARE FUNCTION FindAddress_Array LIB "C:\Program Files\Omega Research\Program\elkit32.dll" _
(lpArray AS SINGLE PTR, nSpaceOfs AS INTEGER, nOfs AS INTEGER, wStartAddr AS DWORD, wArraySize AS DWORD) AS SINGLE PTR
But I get the error - "end of Statement expected"
So thats my first question.
Second is: Once I have declared the function FindAddress_Array in the elkit32.dll and then called it with
lpNewAddr = FindAddress_Array(lpArray, nSpaceOfs, nOfs, wStartAddr, wVarSize
can I just get the array element with:
Element = @ lpNewAddr
And Finally, can i put a new value in that memory location with:
lpNewAddr = VARPTR(SomeNewValue)
and be able to retrieve SomeNewValue in the TradeStation EasyLanguage Array Element?
------------------
Kind Regards
Mike
(Ultimatly I would like to be able to access an array element, do some calculations and then stuff the result back in place of the original element so i can have access to it in EasyLanguage)
Anyways, Part1 of this problem is to get access to an array element in my PB Dll. Omega (who make TradeStation) have a developers kit (a Dll) for C++ and VB users. Here is what they say about accessing array elements:
ELKIT32.DLL
Functionality
The EasyLanguage Tool Kit Library is implemented in the form of a dynamic-link library. It provides useful functions that can be called from any user DLL. It is commonly used to find the address of an offset of an EasyLanguage data object from within a user DLL.
Components
There are four components in the EasyLanguage Tool Kit Library: a header file (ELKIT32.H), two link-time library files (ELKITVC.LIB and ELKITBOR.LIB), and an executable DLL file (ELKIT32.DLL). 'ELKIT32.H' is a standard C header file. It contains the function headers for all the functions that are available in 'ELKIT32.DLL'. The '.LIB' files should be used when linking a user DLL that calls the ELKIT32.DLL functions. 'ELKITVC.LIB' should be used when working in the Microsoft Visual C++ environment while 'ELKITBOR.LIB' should be used in the C++ Builder environment.
Functions Available:
FindAddress_Array
FindAddress_Open
FindAddress_Close
FindAddress_OpenInt
FindAddress_Date
FindAddress_Time
FindAddress_DownTicks
FindAddress_UpTicks
FindAddress_High
FindAddress_Var
FindAddress_Low
FindAddress_Volume
...................................................................................................................................
FindAddress_Array:
LPFLOAT FindAddress_Array( LPFLOAT lpArray[ArrayPosition], int nSpaceOfs, int nOfs, DWORD wStartAddr, DWORD wArraySize );
Parameters:
lpArray
A pointer to an Array in EasyLanguage.
nSpaceOfs
Specifies the offset of array elements. The offset is forward if nSpaceOfs is positive and backwards if nSpaceOfs is negative.
nOfs
Specifies the bar offset. The offset is backwards if Ofs is positive or forward if Ofs is negative.
wStartAddr
The starting address of the buffer as determined by the EasyLanguage keyword ArrayStartAddr.
wArraySize
The size of the buffer associated with the array as determined by the EasyLanguage keyword ArraySize.
Returns:
A pointer to the value of an Array element offset by nOfs.
Remarks:
wArraySize is the size of the buffer associated with the array. This value is obtained from EasyLanguage by calling the ArraySize function. wStartAddr is the starting address of the buffer. The ArrayStartAddr function should be called to obtain this value.
....................................................................................................................................
{ Omega Research TradeSatation EasyLanguage Example }
DefineDLLFunc: "MYLIB.DLL",float,"FindArray",multiple;
Var: wStartAddr(0), wArraySize(0),Counter(0), Result(0);
Array: MyArray [10](0);
If CurrentBar = 11 then Begin
For Counter = 0 to 10 Begin
MyArray[Counter] = Close[Counter];
End;
End;
wStartAddr = ArrayStartAddr(MyArray);
wArraySize = ArraySize(MyArray);
Result = FindArray((LPFLOAT)&MyArray[7], (int) -3, (int) 2, (DWORD)wStartAddr, (DWORD)wArraySize );
Plot1(Result, "FindArray");
...................................................................................................................................
// Example of FindAddress_Var in MYLIB.DLL
// starting at element 7, go back 3 elements and 2 bars
float FindArray( LPFLOAT lpVar, int nSpaceOfs, int nOfs, DWORD wStartAddr, DWORD wArraySize )
{
LPFLOAT lpNewAddr;
lpNewAddr = FindAddress_Array(lpArray, nSpaceOfs, nOfs, wStartAddr, wVarSize);
return *lpNewAddr;
}
...................................................................................................................................
So first I want to declare the elkit32.dll in my Dll. I tried like this:
DECLARE FUNCTION FindAddress_Array LIB "C:\Program Files\Omega Research\Program\elkit32.dll" _
(lpArray AS SINGLE PTR, nSpaceOfs AS INTEGER, nOfs AS INTEGER, wStartAddr AS DWORD, wArraySize AS DWORD) AS SINGLE PTR
But I get the error - "end of Statement expected"
So thats my first question.
Second is: Once I have declared the function FindAddress_Array in the elkit32.dll and then called it with
lpNewAddr = FindAddress_Array(lpArray, nSpaceOfs, nOfs, wStartAddr, wVarSize
can I just get the array element with:
Element = @ lpNewAddr
And Finally, can i put a new value in that memory location with:
lpNewAddr = VARPTR(SomeNewValue)
and be able to retrieve SomeNewValue in the TradeStation EasyLanguage Array Element?
------------------
Kind Regards
Mike
Comment