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

RE: [amibroker] CategoryCreateSymbol !!! - Some code to get you started



PureBytes Links

Trading Reference Links

To add to what Tomasz wrote…

 

I use AddToComposite to create various indicators and indexes for Sectors and Industries.   Below is some example code to get you started.

 

Note that some features of your code may depend on your data provider.  Who provides your data?

 

Regards,

 

Dan.

 

 

Here is the code that returns the native Market, Sector and Industry symbols and names for a stock symbol:

 

SectorSymbol         =  NumToStr(SectorID(0), 1.0); 

SectorName           =  SectorID(1);  

IndustrySymbol             =  NumToStr(IndustryID(0), 1.0);  

IndustryName         =  IndustryID(1);  

MarketName           =  MarketID(1);

 

And here is a procedure that adds a stock symbol’s data to AddToComposite:

 

// Instantiate Broker.Application

AB = CreateStaticObject("Broker.Application");

 

procedure CompositeLoad(Sym, SymName, CloseVal, OpenVal, HighVal, LowVal, VolVal, OpenIntVal, ATCFlags)

   {

   //Add To Composite

   AddToComposite(CloseVal,     Sym,   "C", ATCFlags);

   AddToComposite(OpenVal,      Sym,   "O", ATCFlags);

   AddToComposite(HighVal,      Sym,   "H", ATCFlags);

   AddToComposite(LowVal,       Sym,   "L", ATCFlags);

   AddToComposite(VolVal,       Sym,   "V", ATCFlags);

   AddToComposite(OpenIntVal,   Sym,   "I", ATCFlags);

  

   //Modify Names

   cs          = AB.Stocks(Sym)   ;                   

   cs.FullName = SymName          ;                

  }

 

And here is the call to the CompositeLoad Procedure.  Note that “1” (after “V/1000”) just indicates is the count of symbols.  When the ATC symbol is created, the Open Interest field (where the “1” is loaded) contains the count of symbols in that index.   Here’s the code:

 

//AddToCompositeFlags

atcCurrentFlags = atcFlagResetValues + atcFlagCompositeGroup + atcFlagEnableInExplore;

 

//Procedure calls

CompositeLoad("~Index_USSec_" + SectorSymbol,"~Index_USSec_" + SectorName, Close, Open, High, Low, V/1000, 1, atcCurrentFlags);

 

CompositeLoad("~Index_USInd_" + IndustrySymbol , "~Index_USInd_" + IndustryName, Close, Open, High, Low, V/1000, 1, atcCurrentFlags);

 

 

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Tomasz Janeczko
Sent: Tuesday, November 15, 2005 6:52 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] CategoryCreateSymbol !!!

 

> I like to create a industry index symbol from all the tickers in a industry.
And I just wrote you how to do this (i.e. use AddToComposite).
There is a whole big section in the User's Guide that covers AddToComposite.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "TaMeR" <yahoo@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, November 15, 2005 3:37 PM
Subject: Re: [amibroker] CategoryCreateSymbol !!!


>
> Thank you for the try Tomasz
> Let me retrace.
> I am not trying to add a symbol in to a industry which already exists.
> I like to create a industry index symbol from all the tickers in a industry.
>
> --
>
> Cheers,
> TaMeR
>
>
> Tomasz Janeczko wrote:
>> AddToComposite to create symbol
>> CategoryAddSymbol to add it to industry/sector.
>>
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>> ----- Original Message -----
>> From: "TaMeR" <yahoo@xxxxxxxxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Tuesday, November 15, 2005 11:52 AM
>> Subject: [amibroker] CategoryCreateSymbol !!!
>>
>>
>>
>>>
>>>Hello Guys;
>>>
>>>I like to create Industry Index Symbols.
>>>
>>>Good would be something like "CategoryCreateSymbol" or is there some
>>>other solution?
>>>
>>>--
>>>
>>>Cheers,
>>>TaMeR
>>>
>
>
>
>
> 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
>
>
>
>
>
>
>



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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS