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

RE: [amibroker] Guppy Count Back Lines - VBscript HELP !!! - Type Mismatch



PureBytes Links

Trading Reference Links

Geoff,

Actually here is the correct solution. I'm not saying that the rest of your code is or isn't correct but this will solve the 'type mismatch' problem, from here you will have to ensure the rest of your code does what you think it should.

NOTE: You need to declare the array in the vbscript using the 'Dim' statement and then re-dimension using the 'ReDim' statement and the number of elements. (see below)

EnableScript("Vbscript");
<%
LowArray = AFL("low")
Dim StopArray
CurrentLow = LowArray(UBound(LowArray))
Redim StopArray(UBound(LowArray))



Regards,
William Peters











-----Original Message-----
From: William Peters [mailto:williampeters1@xxxxxxxxxxxx]
Sent: February 15, 2003 12:33 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Guppy Count Back Lines - VBscript HELP !!! -
Type Mismatch


Geoff,

You may firstly need to dimension the StopArray as an array within the AFL section of your code. It doesn't really matter what array you use as long as you remember that you have assigned this array to your variable and ensure you take care of it later in your vbscript code. This is done so vbs knows it's an array your referencing. I dont know of any other way to do this.

William

ie.

StopArray = L;

/* Guppy Count Back Lines */
/* Geoff Mulhall 12-02-2003 */

EnableScript("Vbscript");
<%
StopArray = AFL("low")
etc etc





-----Original Message-----
From: grmulhall <gmulhall@xxxxxxxxxxxx> [mailto:gmulhall@xxxxxxxxxxxx]
Sent: February 14, 2003 8:20 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Guppy Count Back Lines - VBscript HELP !!! - Type
Mismatch


Hi,

In coding Guppy's count back lines (which I'll post in the AFL 
library when complete) I get a 'Type Mismatch' error. Presumably the 
datatype for the graph I'm creating doesn't match Ami's Low array 
type.

The script is below if anyone can assist.

Thanks,

Geoff

/* Guppy Count Back Lines */
/* Geoff Mulhall 12-02-2003 */

EnableScript("Vbscript");

<%

LowArray = AFL("low")

CurrentLow = LowArray(UBound(LowArray))

For I = UBound(LowArray) to LBound(LowArray) Step -1
   J = I - 1
   Hits = 0
   While Hits < 3 AND J > 0
      If LowArray (J) < CurrentLow then
         Hits = Hits + 1
         CurrentLow = LowArray (J)                  ' Type Mismatch
      End If
      J = J - 1
   Wend
   If Hits = 3 Then
      StopArray(I) = CurrentLow
   End If
Next

AFL.Var("CBLStop") = StopArray 

%>

GraphXSpace = 5;

/* Candlestick Chart */

Plot(Close," ",1,64);

Plot(CBLStop,"Count Back Line", colorBlue,styleLine);


Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/