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

Re: [amibroker] Re: Question regarding AddToComposite



PureBytes Links

Trading Reference Links

Acesheet,

'atcFlagResetValues' do?

When the Flag is set to the default of 1.....each time you run the composite
scan...it is like you are running it for the first time.....( that is why it
is the recommended value)...

If you set the flag to 0....then the values are added after each scan...

At least that is how I see it.

Anthony

----- Original Message ----- 
From: "acesheet" <acesheet@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Thursday, December 18, 2003 4:52 PM
Subject: [amibroker] Re: Question regarding AddToComposite


> This was from my original post. A couple of others sort of changed
> the subject, but the question was really what
> does 'atcFlagResetValues' do?
>
> >> I've been using AddToComposite to create various reference indices
> >> and industry indices lately and I'm wondering what this statement
> >> from the AB help file really means?
> >> atcFlagResetValues = 1 - reset values at the beginning of scan
> >> (recommended)
>
> --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
> wrote:
> > a. There was a wrong word in my text : "loopless", instead
> > of "scanless".
> > b. If your solution works, then everything is OK.
> > But, what was the question then ?
> > Dimitris Tsokakis
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, acesheet@xxxx wrote:
> > > Dmitris,
> > >
> > > It took me awhile to get back to this. Isn't there a loop in the
> > > function 'Population'? Is what you suggested somehow
> fundamentally
> > > different than the code I've got listed below:
> > >
> > > //-------------------------------------------------------------
> > > // Get Running total for number of stocks in the group vs. time
> > > //-------------------------------------------------------------
> > > m=0;
> > > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> > > {
> > > Val = Nz(Foreign( sym, "Close" ));
> > > n=Nz(IIf(Val!=0,1,0));
> > > m=m+n;
> > > }
> > >
> > > Is what you suggested more efficent code?  It seems the two will
> > > calculate the same things. Mine works, but if yours is better I
> > > won't mind adopting it.
> > >
> > > -ace
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS"
> > > <TSOKAKIS@xxxx> wrote:
> > > > For a loopless calculation you should take more care for some
> > > details:
> > > > Go first to Symbol->Categories and define your base index.
> > > > Then you should use fixup=0 to avoid filling the existing holes.
> > > > The population for my WL17 comes from the
> > > > function Population( listnum )
> > > > {
> > > >  list = GetCategorySymbols( categoryWatchlist, listnum );
> > > >  p = 0;
> > > >  for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> > > >  {
> > > >    f = IsTrue(Foreign( sym, "C",0 ));
> > > >    if( i == 0 ) p = f;
> > > >    else p = p + f;
> > > >  }
> > > >  return p;
> > > > }
> > > > Plot(population(17),"",1,1);
> > > > I hope it will help.
> > > > Dimitris Tsokakis
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS"
> > > <TSOKAKIS@xxxx>
> > > > wrote:
> > > > > There is a simple and safe way to count the population of
> your
> > > > > database.
> > > > > Run for all quotations the
> > > > > addtocomposite(1,"~count","v");
> > > > > buy=0;
> > > > > Now, the
> > > > > pop=foreign("~count","v");
> > > > > will give you the population vs time.
> > > > > Dimitris Tsokakis
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "acesheet" <acesheet@xxxx>
> > > wrote:
> > > > > > I've been using AddToComposite to create various reference
> > > > indices
> > > > > > and industry indices lately and I'm wondering what this
> > > statement
> > > > > > from the AB help file really means?
> > > > > >
> > > > > > atcFlagResetValues = 1 - reset values at the beginning of
> > scan
> > > > > > (recommended)
> > > > > >
> > > > > > I occassionaly get corrupted values of zero in the middle
> of
> > > the
> > > > > > price arrays even though I try to correct for this. Usually
> > it
> > > > goes
> > > > > > away if I completely delete the data in my composite index
> > and
> > > > > rerun
> > > > > > the composite calculation routine. I would really like to
> not
> > > > have
> > > > > > to do this as its a manual process. I;d like it to be
> > > completely
> > > > > > automatic.
> > > > > >
> > > > > > -ace
> > > > > >
> > > > > > Here's my code. Maybe I'm doing something wrong. Feel free
> to
> > > use
> > > > > > it. It seems to work quite well.
> > > > > >
> > > > > > //----------------------------------------------------------
> --
> > -
> > > > > > //             INDUSTRY COMPOSITE CALCULATOR
> > > > > > //----------------------------------------------------------
> --
> > -
> > > > > > // AFL Script Version date 12/7/03
> > > > > > //----------------------------------------------------------
> --
> > -
> > > > > > // NOTES: Prior to running place your settings to this
> > > arrangement
> > > > > > //        1. Set the 'Apply to' filter to a watchlist
> > > containing
> > > > > one
> > > > > > //           stock from each industry group and click 'use
> > > filter'
> > > > > > //        2. Set the 'Range' to 'n last quotations' where
> n=1
> > > > > > //        3. Run a 'Scan'
> > > > > > //----------------------------------------------------------
> --
> > -
> > > > > > function CreateIndustryAverage( listnum, price )
> > > > > > {
> > > > > >  // retrieve comma-separated list of symbols in watch list
> > > > > >  list = GetCategorySymbols( categoryIndustry, listnum );
> > > > > >  Average = 0; // just in case there are no watch list
> members
> > > > > >  m=0;
> > > > > >  for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> > > > > >  {
> > > > > >     Val = Nz(Foreign( sym, "Close" ));
> > > > > >     n=Nz(IIf(Val!=0,1,0));
> > > > > >     m=m+n;
> > > > > >     f = Nz(Foreign( sym, price ));
> > > > > >     if( i == 0 ) Average = Average;
> > > > > >     else Average = Average + f;
> > > > > >  }
> > > > > >   // 'm' is the running total of the number of stocks in the
> > > > > >   // group vs. time. This account for differing lengths of
> > > > > >   // historical data by stock
> > > > > >  return Average / m;
> > > > > > }
> > > > > > //----------------------------------------------------------
> --
> > -
> > > > > > // Create the industry averages and store the values in
> > > temporary
> > > > > > // price arrays
> > > > > > //----------------------------------------------------------
> --
> > -
> > > > > > indticker="~"+IndustryID(1);
> > > > > > IO=CreateIndustryAverage( IndustryID(0), "O" )*10;
> > > > > > IH=CreateIndustryAverage( IndustryID(0), "H" )*10;
> > > > > > IL=CreateIndustryAverage( IndustryID(0), "L" )*10;
> > > > > > IC=CreateIndustryAverage( IndustryID(0), "C" )*10;
> > > > > > IV=CreateIndustryAverage( IndustryID(0), "V" );
> > > > > > list = GetCategorySymbols( categoryIndustry, IndustryID
> (0) );
> > > > > > //----------------------------------------------------------
> --
> > -
> > > > > > // Get Running total for number of stocks in the group vs.
> > time
> > > > > > //----------------------------------------------------------
> --
> > -
> > > > > > m=0;
> > > > > > for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
> > > > > >  {
> > > > > >    Val = Nz(Foreign( sym, "Close" ));
> > > > > >    n=Nz(IIf(Val!=0,1,0));
> > > > > >    m=m+n;
> > > > > >  }
> > > > > > sf=1;
> > > > > > //----------------------------------------------------------
> --
> > -
> > > > > > // Create scale factors to correct for step changes in the
> > > > > > // number of stocks in the group
> > > > > > //----------------------------------------------------------
> --
> > -
> > > > > > for( i = 1; i<LastValue(Cum(IIf(m!=0,1,0))); i++ )
> > > > > > {
> > > > > >    if(m[i]>m[i-1]) sf[i]=sf[i-1]*IC[i-1]/IO[i];
> > > > > >    else sf[i]=sf[i-1];
> > > > > > }
> > > > > > IO1=sf*IO;
> > > > > > IH1=sf*IH;
> > > > > > IL1=sf*IL;
> > > > > > IC1=sf*IC;
> > > > > > IO=IIf(IO1==0,Ref(IO1,-1),IO1);
> > > > > > IH=IIf(IH1==0,Ref(IH1,-1),IH1);
> > > > > > IL=IIf(IL1==0,Ref(IL1,-1),IL1);
> > > > > > IC=IIf(IC1==0,Ref(IC1,-1),IC1);
> > > > > > IV=IIf(IV==0,Ref(IV,-1),IV);
> > > > > > //----------------------------------------------------------
> --
> > -
> > > > > > // Now correct for any zero values
> > > > > > for( i = 1; i<BarCount; i++ )
> > > > > > {
> > > > > >    if(IO[i]==0) IO[i]=IO[i-1];
> > > > > >    if(IH[i]==0) IH[i]=IH[i-1];
> > > > > >    if(IL[i]==0) IL[i]=IL[i-1];
> > > > > >    if(IC[i]==0) IC[i]=IC[i-1];
> > > > > >    if(IV[i]==0) IV[i]=IV[i-1];
> > > > > > }
> > > > > > AddToComposite(IO,indticker,"O", 3);
> > > > > > AddToComposite(IH,indticker,"H", 3);
> > > > > > AddToComposite(IL,indticker,"L", 3);
> > > > > > AddToComposite(IC,indticker,"C", 3);
> > > > > > AddToComposite(IV,indticker,"V", 3);
> > > > > >
> > > > > > Buy=0;
> > > > > > Sell=0;
>
>
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.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/
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.552 / Virus Database: 344 - Release Date: 12/15/2003


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/