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

Re: [amibroker] Trouble with Coding Vidya In AFL



PureBytes Links

Trading Reference Links

People,  I get a syntax error and it says  expecting an identifier. Marshall   
 
-------Original Message-------
 
From: bilbod
Date: 07/08/05 13:57:53
Subject: Re: [amibroker] Trouble with Coding Vidya In AFL
 
Below is Vidya someone posted here a while back.

Bill
---
Length=21;
Smooth=5;

Change = C - Ref( C, -1 );
SU = Sum( C - Ref( C, -1 ) > 0, Length );
SD = Sum( C - Ref( C, -1 ) < 0, Length );
CMO = 100 * ( SU - SD ) / ( SU + SD );

AbsCMO=( abs(CMO) )/100;

SC=2/(Smooth+1);

VIDYA=AMA( C, SC*AbsCMO );

Plot( Close, "Price", 4, 64 );
Plot( VIDYA, "Vidya", 5 );
---
rajak1981 wrote:

> I am using the following code for vidya.
> When I plot Vidya , Vidya[0] is initialized fine
> But after that its all empty.
> Any idea as to what I am doing wrong?
> Factor[i] is being computed correctly as can be seen from the plot.
> The problem is occuring due to Vidya[i-1]. I am not sure why.
>
>       SC=0.5;
>       Vidya[0]=C[0];
>       CMO_Up=Sum( IIf( C > Ref(C,-1) ,  C-Ref(C,-1) ,0 ) ,Length ) ;
>       CMO_Dn=Sum( IIf( C < Ref(C,-1) , Ref(C,-1) -
> C  ,0 ) ,Length );
>
>
>
> for(i=1;i<BarCount;i++)
> {
>       CMO[i]=(( CMO_Up[i] -CMO_DN[i])  /( CMO_Up[i]+CMO_Dn[i]));
>       AbsCMO[i]=(abs(CMO[i]));
>       Factor[i]=SC*AbsCMO[i];
>     Vidya[i]=(Factor[i]*C[i])+(1-Factor[i])*Vidya[i-1];
> }
>
> Plot(Vidya,"Vidya("+Length+")",styleLine);
> Plot(Factor,"Factor("+Length+")",styleLine);
>
> Thanks,
> Raja
>
>
>
>
>
> 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 other support material please check also:
> http://www.amibroker.com/support.html
>
>
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
>     *  Visit your group "amibroker
>       <http://groups.yahoo.com/group/amibroker>" on the web.
>       
>     *  To unsubscribe from this group, send an email to:
>        amibroker-unsubscribe@xxxxxxxxxxxxxxx
>       <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>       
>     *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>



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 other support material please check also:
http://www.amibroker.com/support.html



 
Add FUN to your email - CLICK HERE!

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 other support material please check also:
http://www.amibroker.com/support.html





YAHOO! GROUPS LINKS