Use staticvarset and seticvarget to store and retrevie geometric product
use status("stocknum") as a switch
ie.
if(status("stocknum") == 0
{
   staticvarset("VLG", 1);
}
tmp = staticvarget("VLG") * roc(C, 1);
staticvarset("VLG", tmp);
// that is your product function.
 
You can write the rest yourself.

  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of personal592002
Sent: Saturday, 25 November 2006 9:46 AM
To: [email protected]
Subject: [amibroker] How to code Unweighted Arithmetic Price Index using
ATC?



How to code Unweighted Arithmetic Price Index using ATC?
I am stuck. I can export/import to/from Excel but was hoping someone 
could suggest an easier way. 

/*Unweighted Arithmetic Price Index
http://www.valuelin <http://www.valueline.com/news/vlv030328x.html*/>
e.com/news/vlv030328x.html*/

AddToComposite( C/Ref(C,-1), "~UPI", "X", flags = 1 ) ;
AddToComposite( 1, "~UPI", "I" );
Buy = 0; 
Factor = Foreign("~UPI","C") / Foreign("~UPI","I");

// needs PRODUCT function like in Excel not Cum() 
UAPI = 100 * Cum(Factor); 

Plot(UAPI,"Unweighted Arithimetic Index",colorGreen,styleLine);



 

Reply via email to