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

Re: VB script i give up what is wrong with this code



PureBytes Links

Trading Reference Links

I know it built in but this is special.
it not going to be a normal bollenger.




--- In amibroker@xxxx, "Tomasz Janeczko" <tj@xxxx> wrote:
> Hi,
> 
> There is no need to write bollinger bands using scripting
> - they are BUILT-IN into AFL.
> a.. 
> 1.. BBANDBOT 
> 1.. SYNTAX 
> bbandbot( ARRAY, periods = 15, width = 2 ) 
> RETURNS ARRAY 
> FUNCTION Calculates the bottom Bollinger Band of ARRAY 
shifted down width standard deviations (using periods averaging 
range ). 
> EXAMPLE bbandbot( close, 10, 2 ) 
> SEE ALSO 
> 
> a.. 
> 1.. BBANDTOP 
> 1.. SYNTAX 
> bbandtop( ARRAY, periods = 15, width = 2 ) 
> RETURNS ARRAY 
> FUNCTION Calculates the bottom Bollinger Band of ARRAY 
shifted upwidth standard deviations (using periods averaging range ). 
> EXAMPLE bbandtop( close, 10, 2 ) 
> SEE ALSO 
> 
> Best regards,
> Tomasz Janeczko
> ===============
> AmiBroker - the comprehensive share manager.
> http://www.amibroker.com
> 
> ----- Original Message ----- 
> From: nickhere@xxxx 
> To: amibroker@xxxx 
> Sent: Friday, June 15, 2001 9:09 PM
> Subject: [amibroker] VB script i give up what is wrong with this 
code
> 
> 
> 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 );
> 
> 
> 
> 
> Yahoo! Groups Sponsor 
> 
> Click for Details 
> 
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.