PureBytes Links
Trading Reference Links
|
This code return nothing
EnableScript("vbscript");
<%
price = AFL ( "high" )
bb=bbband(price,9,2)
Function bbband(price, length, StandardDev)
bbband = Average(price, length) + (StandardDev * Stddev(price,
length))
End Function
Function Average(price, length)
Sum = 0
Counter = 0
For Counter = 0 To length - 1
Sum = Sum + price(Counter)
Next
If length > 0 Then
Average = Sum / length
Else
Average = 0
End If
End Function
Function Stddev(price, length)
SumSqr = 0
Avg = 0
Counter = 0
If length <> 0 Then
Avg = Average(price, length)
SumSqr = 0
For Counter = 0 To length - 1
SumSqr = SumSqr + (price(Counter) - Avg) * (price(Counter) - Avg)
Next
Stddev = Sqr(SumSqr / length)
Else
Stddev = 0
End If
End Function
AFL.Var("graph1") = bb
%>
WriteVal( graph1 );
|