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

Re: [amibroker] Percentage Based Index Code



PureBytes Links

Trading Reference Links

Don't give up.  You've taken a step in the right direction.

The ATC in afl code is not executed until the code is run with the appropriate flag enabled or you can just run Scan.  So, to start, just run scan (I suggest on either a watch list with only one or a couple of equities, to make debugging easier).  Then look in Symbols>Markets>Market253, and you will see ~MyIndex.  Click on it and you should see it plotted in a window that is shows price.

>From the editor select "Insert Indicator".  This will open a new pain with the results of:
Graph0=(Foreign("~MyIndex", "C" ) / Foreign("~MyIndex", "I" ));

Notice, that this graph shows the average % change for each day; not the accumulated change that you really want for an index.

However, what you want is definitely doable.  So, carry on!!
-- Keith

BTW, you probably ought to use Ref(Close, -1) in place of Open in your code.

G_R_O_W_L_Y wrote:

Hello

I have created an Amibroker index creation script that uses percentage
change in each security added, rather than price movement to ensure
equal weighting for each security.

It still is not functioning correctly and if anyone would like to
give it a try and maybe recommend any changes that would be greatly
appreciated.

Simply run it in Automatic Analysis on a group of securites and it
will create an index name "~MyIndex"

AddToComposite( ((Close - Open) / Open ) * 100, "~MyIndex", "X" );
AddToComposite( 1, "~MyIndex", "I");
Buy=0;
Graph0=(Foreign("~MyIndex", "C" ) / Foreign("~MyIndex", "I" ));

Thanks

__._,_.___

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___