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

Reply via email to