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

vbScript Problem



PureBytes Links

Trading Reference Links

Folks,

Can anyone spot the cause of the error

"ActiveScriptSite::OnScriptError()
Line 8, Character 5
Line text:"

in the script below pls ?


Geoff (getting desperate !)


/* Buy on Gann Swing Gap AFL Implementation by Geoff Mulhall 4/6/2001 
*/

dollars = 5000;
AtrRange = 200;

EnableScript("vbscript");
<%
vbH = AFL( "high" )
vbL = AFL( "low" )

rem---------Initialize Arrays

For i = 0 To UBound(vbH)
vbUpBar(i) = 0
vbDownBar(i) = 0
vbOutsideBar(i) = 0
vbInsideBar(i) = 0
vbPeakBar(i) = 0
vbTroughBar(i) = 0
Next

rem---------Flag UpBars, Downbars, InsideBars, OutsideBars

For i = 0 To Ubound(vbH)
Select Case True
Case (vbH(i + 1) > vbH(i) And vbL(i + 1) >= vbL(i))
vbUpBar(i + 1) = 1
Case (vbL(i + 1) < vbL(i + 1) And vbH(i + 1) <= vbH(I))
vbDownBar(i + 1) = 1
Case (vbH(i + 1) > vbH(i) And vbLow(i + 1) < vbLow(i))
vbOutsideBar(i + 1) = 1
Case (vbH(i + 1) <= vbH(i) And vbL(i + 1) >= vbL(i))
vbInsideBar(i + 1) = 1
End Select
Next

rem------------Flag Peak and Trough Bars

For i = 1 To UBound(vbH)
Select Case True
Case (vbUpBar(i) = 1 And vbDownBar(i + 1) = 1)
vbPeakBar(i) = 1
Case (vbDownBar(i) And vbUpBar(i + 1))
vbTroughBar = 1
Case (vbOutsideBar = 1)
For j = i + 1 To UBound(vbH)
Select Case True
Case (vbUpBar(j) = 1)
vbTroughBar(i) = 1
Exit For
Case (vbDownBar(j) = 1)
vbPeakBar(i) = 1
Exit For
End Select
Next
End Select
Next

rem--------------Scan for Gaps

i = Ubound(vbH)

Do While i > 0

vb1stTroughFound = False
vb2ndTroughFound = False
vb1stPeakFound = False
vb2ndPeakFound = False

For j = i To 0 Step -1

Select Case True
Case (Not vb1stTroughFound And vbTroughBar(j) = 1)
Trough1 = vbL(j)
vb1stTroughFound = True
Case (Not vb1stPeakFound And vbPeakBar(j) = 1)
Peak1 = vbH(j)
vb1stPeakFound = True
Case (Not vb2ndTroughFound And vb1stTroughFound And 
vbTroughBar(j) = 1)
Trough2 = vbL(j)
vb2ndTroughFound = True
vbNextStart = j
Case (Not vb2ndPeakFound And vb1stPeakFound And vbPeakBar
(j) = 1)
Peak2 = vbH(j)
vb2ndPeakFound = True
End Select

If vb1stPeakFound And vb2ndPeakFound And _
vb1stTroughFound And vb2ndTroughFound Then
If Trough1 > Peak2 And (Peak1 - Trough2) / 2 < Trough1 
Then
vbBuy(i) = 1
End If
End If

If vb2ndTroughFound Then
i = vbNextStart
Exit For
Else
i = j
End If
Next

Loop

AFL ("buy" ) = vbBuy
%>

BangForBucks = (dollars/close) * atr(AtrRange);

filter = buy; 

numcolumns = 2;
column0 = close;
column0format = 3.2;
column0name = "Close";
column1= BangForBucks;
column1ormat = 5.2;
column1name = "BangForBucks"; 

sell = 0;

/* buy = exrem(buy,sell); 
sell = exrem(sell,buy);*/