PureBytes Links
Trading Reference Links
|
Divide by zero error.
You are dividing by zero in RSV2 when HHV is equal to LLV.
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "itmwh" <toxutao@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, November 22, 2006 1:34 PM
Subject: [amibroker] user-defined function error
>I want to write a stochastic indicator, during which I define an
> fuction SMA(input,n,m). Could some one kindly advise why in the
> following code, PLOT RSV1 is OK, but plot RSV2 is not ?
>
> ----------------------------------------------
>
>
>
> RSV1= (Close-LLV(Low,35))/HHV(High,35);
> RSV2= (Close-LLV(Low,35))/(HHV(High,35)-LLV(Low,35))*100;
>
>
> function SMA(x,n,m)
>
> {
> result[ 0 ] = x[ 0 ];
>
>
> for( i = 1; i < BarCount; i++ )
> {
> result[ i ] = (x[i] *m +(n-m)* result[ i -1 ])/n;
> }
>
> return result;
> }
>
> Plot(sma(RSV1,10,1),"sma10 for rsv1",colorRed);// this plot is ok
>
> Plot(sma(RSV2,10,1),"sma10 for rsv2",colorgreen); // this plot is
> wrong
>
>
>
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
> Yahoo! Groups Links
>
>
>
>
>
>
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.13/546 - Release Date: 11/22/2006
|