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

RE: [amibroker] Rel Strength - Market Cap - Dan Clark



PureBytes Links

Trading Reference Links

Ara,

 

One more point I forgot – to implement this, we need to use the PlotOHLC() function, not the Plot() function.

 

Regards,

 

Dan.

 


From: Dan Clark [mailto:dan_public@xxxxxxxxxxx]
Sent: Sunday, December 11, 2005 10:10 AM
To: 'amibroker@xxxxxxxxxxxxxxx'
Subject: RE: [amibroker] Rel Strength - Market Cap - Dan Clark

 

Ara,

 

One additional point...  I found an “issue” with my ATC code.  (Whether is a bug or not is open to question.) 

 

The issue was that the count of each stock was being set to 1.   The code for Count was:

 

iCount   = 1 ;

 

This is a single value, not an array.   So the count of stock symbols in an ATC symbol would always be the latest count, not the count at a point in time (which I think is more valid).  For example…

 

Based on my filtering of the data (mostly just filtering out the very low priced and very low volume stocks), the entire energy sector currently has 133 stocks.   With the original coding, it was ALWAYS 133 stocks.   

 

I modified the code to:

 

iCount   = IIf(Nz(C) > 0, 1, 0);

 

This is an array that changes over time.   In Dec, ’05, there are 133 stocks.  From August, ’05 through the middle of November, ’05, there are 132 stocks.

 

I think this approach is more valid.

 

Note, however, that this will NOT modify my current results because the ATC data is a simple summation. Shortly, I’ll modify this so that the ATC data will be summed and then divided by the number of stocks.   

 

In many cases, this will provide better results.  Especially with indexes containing a low number of stocks, the impact could be very significant. 

 

Look at the two attached GIFs.  They are charts of my Mid Cap Energy index.   The red line overlay is the number of symbols in the index at a point in time.   The index contains two stocks prior to Dec 04, changes to three stocks from Dec, 04 to February 05, and then changes to four stocks from Feb 05 to current.

 

With the first chart (NOTDividedByStockCount), note the large gaps precisely at the point where the number of stocks increases!   Now look at the second chart.  I temporarily modified the chart to divide the OHLC values by iCount.   MASSIVE difference!   This looks much more reasonable.   And, it explains some of the issues I’ve seen with my indexes.   This may be a “silver bullet” to standardize the data!

 

In summary, I still believe that my ROC percentage methods provide valid data.      However, I now believe that my basic indices are flawed!  As of about 20 minutes ago, I realized that I have to immediately change my indices so that they need to be normalized by number of stocks in the index.

 

Many thanks for this discussion!!!   If not for you challenging my methodologies, I might not have noticed this problem.

 

Regards,

 

Dan.


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Dan Clark
Sent: Sunday, December 11, 2005 8:55 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Rel Strength - Market Cap - Dan Clark

 

Ara,

 

I’m not sure why the difference, either.

 

Regarding results, remember that I’m doing a simple ROC of the Sector/Industry indexes.   So, the data is already normalized.  I.e., if the index of the Energy sector changes by positive 2% and the Information Sector changes by minus 3%, the percentage values should still be valid regardless of the difference in amount values.

 

Regarding the number of stocks in each cap group…   The way I’ve coded it, a stock is categorized as “Small Cap” based on its latest Market Cap.  I.e., number of shares outstanding times latest day’s Close price as of the time the ATC load is run. 

 

Below is the “cap” code that I use.  The bold, red text retrieves the close value of the latest bar (using LastValue() might be better).

 

Using this method, the components of a Sector or Industry Market Cap index will not change.   Therefore, charted Market Cap indexes should be valid for all time periods and times.

 

Notes:

 

·         One caveat obviously is new and delisted stocks.    These could changes the number of stocks from bar to bar.   I’m working on changing my code to further normalize the indexes by dividing OHLC (and maybe volume) values by the number of stocks in the index on that day.  

 

·         Also, remember that I’m using a Relative Performance Chart.  It charts the ROC from a zero point which is the left edge of the chart.

 

·         I also chart the ROC in two ways - “raw” and relative to a market index (my own or a standard index like S&P 500 or “VTI”).    The values relative to the market index are computed by subtracting the market value ROC bar value from all symbols ROC values for that bar.  That the market ROC always will be 0 and the others will be relative to the market.

 

Does this shed any light on the differences?

 

Regards,

 

Dan.

 

 

 

function MarketCapGet()

      {

      CurDatabase = GetDatabaseName();

     

      if(CurDatabase == "QuotesPlus_Stocks")

            {

            MarketCap = round(Close[BarCount -1] * GetExtraData("shares")/1000);

            }

      else

            {

            MarketCap = 666;  //indicating N/A

            }

      return MarketCap ;

      }

 

function MarketCapCategoryGet(MarketCap)

      {

      CurDatabase = GetDatabaseName();

     

      if(CurDatabase == "QuotesPlus_Stocks")

            {

            if (MarketCap < 1000)

                  MarketCapCategory= "Small";

            else

                  {

                  if (MarketCap >= 1000 AND MarketCap < 5000)

                        MarketCapCategory= "Mid";

                  else

                        MarketCapCategory= "Large";

                  }

            }

      else

            {

            MarketCapCategory=      "N/A";      //indicating N/A

            }

      return MarketCapCategory;

      }


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Ara Kaloustian
Sent: Saturday, December 10, 2005 10:27 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Rel Strength - Market Cap - Dan Clark

 

Dan,

 

Can not understand why our results ae so different ... and agree that data purity issues would not change much.

 

Wondering if you are normalizing you data....  I removed my normalizzation and got results more like yours ...

 

By normalization I mean converting results into relative form, easiest would be %

 

When using ATCs, the number of stocks in each cap group can change based on price fluctuations. This in turn changes the total values in ATCs wrt to each other, such that if ROC is defined as Close - Ref(Close,-x) the results will be affected by this phenomena.

 

A normalized form would be if dividing above by reference value (and x 100):

ROC = ((Close - Ref(Close,-x)) * 100 / Ref(Close,-x)) ;

 

Ara

----- Original Message -----

From: Dan Clark

Sent: Wednesday, December 07, 2005 3:42 AM

Subject: RE: [amibroker] Rel Strength - Market Cap - Dan Clark (QP3 Bad Data Problems)

 

Ara,

 

My chart looks significantly different from yours.  I’m seeing different performance by Sector and what appears to be rollover from Small to Large cap stocks and vice-versa.    That said…

 

While I was writing this memo, I discovered some serious data problems – primarily spikes in the data.   I don’t think that it affects the outcome, but I have to be sure. So, I’m cleaning out my database.  

 

I found many delisted stocks still in the QP3 database.   I’m cleaning them out.   When complete, I’ll rerun my ATC scans and respond again.

 

Regards,

 

Dan.  

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Ara Kaloustian
Sent: Tuesday, December 06, 2005 4:57 PM
To: AB-Main
Subject: [amibroker] Rel Strength - Market Cap - Dan Clark

 

Dan,

 

here is a chart that's a bit more useful

 

This is ROC (rather than RS). This compares in style with yours, but I still don't see the Small Caps having any sytematic larger movements.

 

The chart shows percent ROC for Transportation. Othe sectors may be different, but there seems no systematic trend based on mkt cap.

 

Ara 

 






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