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

[amibroker] Trouble with Coding Vidya In AFL



PureBytes Links

Trading Reference Links

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





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/DldnlA/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/