You can not reference past value of variable via
IEasyLanguageVariable interface ! BUG !
Exampel:
void __stdcall mycalc( IEasyLanguageObject *pEL, ...
{
IEasyLanguageVariable *pVar = pEL->Variables["mydata"];
myvalue = pVar->GetAsDouble[0]; //return current value of variable "mydata"
myvalue1 = pVar->GetAsDouble[1]; //return still current value and not value of mydata[1], <- BUG !!!;
ciao
radekj
PLKIT GetAsDouble can not reference past values of variable!
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: PLKIT GetAsDouble can not reference past values of varia
Dear radekj,
Everything works fine on our end. Here is the example of the code:
And DLL file:
void __stdcall mycalc(IEasyLanguageObject* pEL, LPCSTR varName, double newprice)
{
IEasyLanguageVariable *pVar = pEL->Variables[ varName ] ;
if ( pVar )
pVar->AsDouble[1] = newprice;
}
Please come to our Live Chat between 6:30AM and 12AM EST so we can connect to your computer remotely and analyze the situation.
Everything works fine on our end. Here is the example of the code:
Code: Select all
external: "c:\mcdll.dll", void, "mycalc", IEasyLanguageObject, string, double ;
var:
mydata(0);
value1 = mydata[10];
mycalc( self, "mydata", 200 ) ;
Plot1(mydata[1]);
void __stdcall mycalc(IEasyLanguageObject* pEL, LPCSTR varName, double newprice)
{
IEasyLanguageVariable *pVar = pEL->Variables[ varName ] ;
if ( pVar )
pVar->AsDouble[1] = newprice;
}
Please come to our Live Chat between 6:30AM and 12AM EST so we can connect to your computer remotely and analyze the situation.
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: PLKIT GetAsDouble can not reference past values of varia
Dear radekj,
Please find attached the archive showing that it is working fine.
Please note that only serial variables may have different previous values. For simple variables previous value is equal to current value.
Screenshot and pla archive:
screen.PNG
arhive.pla
Please find attached the archive showing that it is working fine.
Please note that only serial variables may have different previous values. For simple variables previous value is equal to current value.
Code: Select all
// C++ code
double __stdcall GetPrevValue(IEasyLanguageObject* pEL, LPCSTR varName)
{
double res = 0;
IEasyLanguageVariable *pVar = pEL->Variables[ varName ] ;
if ( pVar )
res = pVar->AsDouble[1];
return res;
}
//------------------------
// PL Script
external: "mcdll.dll", double, "GetPrevValue", IEasyLanguageObject, string;
var:
mydata(0);
value2 = mydata[1]; // make variable mydata serial.
mydata = close;
value1 = GetPrevValue( self, "mydata");
if currentbar > 1 then
begin
Plot1(mydata);
Plot2(value1);
end;
screen.PNG
arhive.pla
- Attachments
-
- PrevValues.zip
- (126.65 KiB) Downloaded 147 times