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

[amibroker] Re: ATC code help



PureBytes Links

Trading Reference Links

Graham,

If I just place the data in the composite I don't think I'll be able 
to do some of the post calculations I want to do such as RS, sorting 
and ranking , etc....at least not easily that I can see....

I tried padding but it didn't help. I am thinking that I may need to
reference the elements of my arrays by date...so instead of the 
first element being array[0] it would be array[datenum]. This might 
allow me to keep the various length symbols aligned through my 
calculations but I haven't been able to figure out how to index the  
arrays referenced by datenum.

Any suggestions?

Thanks for your advice.
Tom

--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> wrote:
>
> You could try just placing the data into a composite and the actual
> final calculation in the plot AFL
> eg for number of stocks just use ATC(1,"~name","V")
> so you could jsut add the price changes for each stock to the
> composite and record the number of stocks in V.
> 
> I also find it best to pad the calculation in the AA settings when
> creating the composite, pad to an index that would have all the 
market
> days although this can also make it difficult when averaging 
results
> later, worht trying.
> 
> hopefully I have understood your problem
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
> 
> 
> On 3/10/06, trb0428 <trbrowne@xxx> wrote:
> > Hi - below is my code for calculating a composite index for a 
group
> > of stocks in a watchlist. All the stocks are within the same
> > industry.
> > I run the scan over the watchlist and all works fine except for:
> >
> > 1) it only works if all the stocks have the same number of bars. 
For
> > example if there are 10 stocks with 2 years of quotes - it 
works -
> > but if I add the 11th which has only 6 months of quotes, my
> > composite index is only 6 months instead of 2 years - I have
> > attempted to debug this but cannot figure out the issue - is it
> > something within the ATC function???
> >
> > 2) My second issue with the code is the looping structure. I have
> > used _TRACE function in de-bugging and in doing discovered that 
it
> > is encountering this "for loop" -
> >               for( i = 0;  i <= (BarCount -1); i++)
> > for each stock in the watchlist. This was not my original intent 
and
> > is not needed to accomplish the index calculation but must be a
> > consequence of the scan/atc procedure. Is there any way to avoid
> > this and only go through the index calculation once since that is
> > all that I think is needed???
> >
> > Your help is appreciated.....
> >
> > -----------------Here's the Code---------------------------------
----
> >
> >    global j; // this is the number of stocks in the list
> >    global average_change;
> >    average_change = 0; // just in case no watch list members
> >
> > function Plot_Index(Listnum)
> > {
> >
> > list = CategoryGetSymbols( categoryWatchlist,Listnum ); //retrive
> > comma-separated list of symbols in watch list
> >
> > //   list = CategoryGetSymbols( categoryIndustry, Listnum );
> > // retrive comma-separated list of symbols in industry
> >
> >
> >
> >    for( j = 0; ( sym = StrExtract( list, j ) ) != ""; j++ )
> >    {
> >       f = Foreign( sym, "C");
> >                av_perc_ch_temp = ((f-Ref(f,-1))/Ref(f,-1));
> >                average_change = average_change + av_perc_ch_temp;
> >    }
> >
> >    average_change = average_change / j; // divide by number of
> > stocks
> >
> >    return average_change;
> >  }
> >
> > average_change = Plot_Index(0);
> >
> >      for( i = 0;  i <= (BarCount -1); i++)
> >      {
> >       if(i == 0) index[i] = 100;
> >       else index[i] = index[i-1] + (index[i-1] * average_change
[i]);
> >      }
> >
> > AddToComposite(index, "~" + IndustryID(1) ,"C");
> >
> > Buy = 0;
> >
> >
> >
> >
> >
> >
> >
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/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/