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

Type mismatch in vbscript



PureBytes Links

Trading Reference Links

Hello,

I'm trying to write a vbscript which will pass back an array of 
closing prices in a desired date range.

However, I keep getting type mismatch in the statement:

AFL("myPrices") = VBmyprices 'Pass array back to AFL

Here is the complete AFL. What am I doing wrong ?


Period = 40;

Prices = Close;
myPrices = Close; // this array will contain the prices I want

EnableScript("vbscript");

<% 'Start of VB script

VBperiod = AFL("Period")

Prices = AFL("Close")

Dim VBmyprices(39) ' this array will contain the prices I want

Dim Counter
Counter = 0

FOR i = UBound(Prices)-VBperiod) to UBound(Prices)
VBmyprices(Counter) = Prices(i) ' put closing price into my array
Counter = Counter+1
Next 'End of loop

AFL("myPrices") = VBmyprices 'Pass array back to AFL

%>


//Plot the results in AFL
Plot(myPrices,"myPrices",1,1);

//////////////////////////////////////