BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > BullScript
  New Posts New Posts RSS Feed: Number of New Daily Highs indicator
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Number of New Daily Highs indicator

 Post Reply Post Reply Page  12>
Author
Message / View First Unread Post
cudderbean View Drop Down
Regular
Regular
Avatar

Joined: 02 Oct 2006
Location: Thailand
Posts: 40
Post Options Post Options   Quote cudderbean Quote  Post ReplyReply Direct Link To This Post Topic: Number of New Daily Highs indicator
    Posted: 03 Feb 2013 at 4:02pm

I am trying ultimately to code Elder and Lovvorn’s The New High - New Low Index. It creates a line indicator showing the running total of new daily (and weekly) highs minus the new daily (and weekly) lows looking back over various periods of up to one year.

The concept seems quite good...looking for exceptional spikes, and divergences heralding a possible trend change etc Although I’m not sure it would tell you anything fundamentally different from extreme RSI readings for the XAO, or RSI divergence. But it would be fun to find out using Bullcharts (and Tradesim)... I’m like a kid in a lolly shop when I discover new indicators.

I can roughly figure out how to do it in Excel but my coding skills aren’t up to it in Bullcharts yet..or they were once but I’ve forgotten how. I need to lock myself in a room for a week doing nothing but working my way through the BC help file and every BC indicator/scan to get my head around the coding. I wish I lived next door to Robert Brain! (I can highly recommend his very helpful site for BC users   http://www.robertbrain.com)

I can do the code for a scan for new highs for a single day.

Eg for 1st Feb 2013 data I find by looking at the scan progress toolbar that there are 43 new highs from a total of 484 codes when I use the All Ordinaries as the Securities database

{"New Daily Highs in 250 days" scan}

{Variables}

prevhhi := hist(hhv(H,249),1);

 

{Condition}

filter := (h > prevhhi);

filter;

 

{Columns}

[name="High"; dp="3"] High;

[name="Prev highest hi"; dp="3"] prevhhi;

1.     How do I code for this scan (or any other), so that the count of the “pass filter number”   43   is shown in one of the columns? [name=.....]

    2    How do I change this very basic scan coding for one day only into a running total line indicator stretching back years.

Eg. This scan run individually on a daily basis for the codes in All Ordinaries this last rolling week produces the figures

25/1/13           47 new highs from 484 codes

29/1/13           72

30/1/13           40

31/1/13           29

1/2/13             43

How can I turn this scan into an indicator that incorporate those figures 47,72,40,29,43 as points on an indicator line chart.

Pointing out errors and suggestions most welcome

Thank you for your help.

Back to Top
maximo View Drop Down
BullCharts Guru
BullCharts Guru
Avatar

Joined: 02 Sep 2006
Location: Australia
Posts: 232
Post Options Post Options   Quote maximo Quote  Post ReplyReply Direct Link To This Post Posted: 07 Feb 2013 at 12:33pm

A simple solution is to use the Stochastic indicator %K fast which does not lag or use averaging as opposed to %D.     A value of 250 will show which are making new highs or lows for the year.  The downside may be that this indicator doesn't have  a value greater than 100%.   Perhaps a modified version that goes to 200% would suffice.



Edited by maximo - 07 Feb 2013 at 12:35pm
Back to Top
cudderbean View Drop Down
Regular
Regular
Avatar

Joined: 02 Oct 2006
Location: Thailand
Posts: 40
Post Options Post Options   Quote cudderbean Quote  Post ReplyReply Direct Link To This Post Posted: 07 Feb 2013 at 11:26pm

Thank you for your reply, Maximo.

>> A value of 250 will show which are making new highs or lows for the year.

In the scan I don’t want to know which code names are making new highs. I simply want to know the raw number of codes making new highs, and have that number appear in a results table, not just in a corner of the toolbar at the bottom.

I tried fiddling with k% but by the time I had finished it did not look much different from my original coding above with a list of stocks that are making new highs. I think I may be missing your point.

Please could you demonstrate the basic scan for the stochastic K% you suggest..none of the fancy bits (if that’s too time consuming for you) just the core.

Thank you for your help

Back to Top
maximo View Drop Down
BullCharts Guru
BullCharts Guru
Avatar

Joined: 02 Sep 2006
Location: Australia
Posts: 232
Post Options Post Options   Quote maximo Quote  Post ReplyReply Direct Link To This Post Posted: 09 Feb 2013 at 11:46pm
I got this to work, though it currently only includes 3 stocks you can add as many symbols as you wish to create an index of new highs. 
 
It sums the new highs of included symbols and shows them as an indicator line chart.
 

s1 := inputsymbol("Symbol #1", "BHP");

p1 := if(s1="",0,loadsymbol(s1,H));

h1 := hist(hhv(p1,249),1); f1 := (p1 > h1);

s2 := inputsymbol("Symbol #2", "CBA");

p2 := if(s2="",0,loadsymbol(s2,H));

h2 := hist(hhv(p2,249),1); f2 := (p2 > h2);

s3 := inputsymbol("Symbol #3", "WOW");

p3 := if(s3="",0,loadsymbol(s3,H));

h3 := hist(hhv(p3,249),1); f3 := (p3 > h3);

f1+f2+f3;

  


Edited by maximo - 09 Feb 2013 at 11:53pm
Back to Top
cudderbean View Drop Down
Regular
Regular
Avatar

Joined: 02 Oct 2006
Location: Thailand
Posts: 40
Post Options Post Options   Quote cudderbean Quote  Post ReplyReply Direct Link To This Post Posted: 10 Feb 2013 at 11:57am
Thank you so much, Maximo.
 
I will post the ASX20 and ASX50 for new highs when I've done it and new lows also. If not too slow I will go onto the ASX 200. Maybe there'll be a useful indicator in there somewhere to confirm or tell us something slightly different about RSI spikes and divergences.
 
If it's any good, we could maybe ask Brendon to include a faster version in future versions of BC.
 
I can do some of this stuff in XL. But the beauty of Bullcharts is that you can try out your theories so much more quickly in BC. And of course if it's programmable in BC, then its just one small step further to test it in Tradesim.
 
Thank you so kindly once more, Maximo. Thumbs Up ... Shift+R improves the quality of this image. CTRL+F5 reloads the whole page.
 
Back to Top
cudderbean View Drop Down
Regular
Regular
Avatar

Joined: 02 Oct 2006
Location: Thailand
Posts: 40
Post Options Post Options   Quote cudderbean Quote  Post ReplyReply Direct Link To This Post Posted: 10 Feb 2013 at 7:14pm

I have completed the new highs indicator for the ASX20 and ASX50 following Maximo’s template.

The problem is what BC includes in its ASX50 and what the ASX itself says composes its top 50 are different.  Which one should I go with? The ASX site itself http://www.asx.com.au/asx/widget/topCompanies.do looks to be more up to date.

Then I got to thinking...of course these index compositions change over time. Some codes weren’t even trading 12 years ago.

Should I create an ASX Longevity 50 index?

So what I have done is take the top 50 today from all the codes in today’s XJO that were also trading  on July 1st 2000. Am I skewing things statistically or am I actually doing something more statistically valid in that I am looking at the exact same companies today as were in the index 12 years ago?

Slow loading, but that doesn’t matter, my computer never complains. Is it worthwhile or possible even to go to an index of 100 or 200? More valid statistically?

Before I do a similar indicator for the new lows and NH-NL , any comments, errors, suggestions eg. MA smoothing   would be most welcome.

Thank you.
 
s1 := inputsymbol("Symbol #1", "abc");
p1 := if(s1="",0,loadsymbol(s1,H));
h1 := hist(hhv(p1,249),1); f1 := (p1 > h1);
s2 := inputsymbol("Symbol #2", "aix");
p2 := if(s2="",0,loadsymbol(s2,H));
h2 := hist(hhv(p2,249),1); f2 := (p2 > h2);
s3 := inputsymbol("Symbol #3", "bhp");
p3 := if(s3="",0,loadsymbol(s3,H));
h3 := hist(hhv(p3,249),1); f3 := (p3 > h3);
s4 := inputsymbol("Symbol #4", "all");
p4 := if(s4="",0,loadsymbol(s4,H));
h4 := hist(hhv(p4,249),1); f4 := (p4 > h4);
s5 := inputsymbol("Symbol #5", "alz");
p5 := if(s5="",0,loadsymbol(s5,H));
h5 := hist(hhv(p5,249),1); f5 := (p5 > h5);
s6 := inputsymbol("Symbol #6", "amc");
p6 := if(s6="",0,loadsymbol(s6,H));
h6 := hist(hhv(p6,249),1); f6 := (p6 > h6);
s7 := inputsymbol("Symbol #7", "amp");
p7 := if(s7="",0,loadsymbol(s7,H));
h7 := hist(hhv(p7,249),1); f7 := (p7 > h7);
s8 := inputsymbol("Symbol #8", "anz");
p8 := if(s8="",0,loadsymbol(s8,H));
h8 := hist(hhv(p8,249),1); f8 := (p8 > h8);
s9 := inputsymbol("Symbol #9", "apa");
p9 := if(s9="",0,loadsymbol(s9,H));
h9 := hist(hhv(p9,249),1); f9 := (p9 > h9);
s10 := inputsymbol("Symbol #10", "asx");
p10 := if(s10="",0,loadsymbol(s10,H));
h10 := hist(hhv(p10,249),1); f10 := (p10 > h10);
s11 := inputsymbol("Symbol #11", "ben");
p11 := if(s11="",0,loadsymbol(s11,H));
h11 := hist(hhv(p11,249),1); f11 := (p11 > h11);
s12 := inputsymbol("Symbol #12", "bld");
p12 := if(s12="",0,loadsymbol(s12,H));
h12 := hist(hhv(p12,249),1); f12 := (p12 > h12);
s13 := inputsymbol("Symbol #13", "cba");
p13 := if(s13="",0,loadsymbol(s13,H));
h13 := hist(hhv(p13,249),1); f13 := (p13 > h13);
s14 := inputsymbol("Symbol #14", "ccl");
p14 := if(s14="",0,loadsymbol(s14,H));
h14 := hist(hhv(p14,249),1); f14 := (p14 > h14);
s15 := inputsymbol("Symbol #15", "coh");
p15 := if(s15="",0,loadsymbol(s15,H));
h15 := hist(hhv(p15,249),1); f15 := (p15 > h15);
s16 := inputsymbol("Symbol #16", "cpa");
p16 := if(s16="",0,loadsymbol(s16,H));
h16 := hist(hhv(p16,249),1); f16 := (p16 > h16);
s17 := inputsymbol("Symbol #17", "cpu");
p17 := if(s17="",0,loadsymbol(s17,H));
h17 := hist(hhv(p17,249),1); f17 := (p17 > h17);
s18 := inputsymbol("Symbol #18", "csl");
p18 := if(s18="",0,loadsymbol(s18,H));
h18 := hist(hhv(p18,249),1); f18 := (p18 > h18);
s19 := inputsymbol("Symbol #19", "ctx");
p19 := if(s19="",0,loadsymbol(s19,H));
h19 := hist(hhv(p19,249),1); f19 := (p19 > h19);
s20 := inputsymbol("Symbol #20", "flt");
p20 := if(s20="",0,loadsymbol(s20,H));
h20 := hist(hhv(p20,249),1); f20 := (p20 > h20);
s21 := inputsymbol("Symbol #21", "gnc");
p21 := if(s21="",0,loadsymbol(s21,H));
h21 := hist(hhv(p21,249),1); f21 := (p21 > h21);
s22 := inputsymbol("Symbol #22", "gpt");
p22 := if(s22="",0,loadsymbol(s22,H));
h22 := hist(hhv(p22,249),1); f22 := (p22 > h22);
s23 := inputsymbol("Symbol #23", "hvn");
p23 := if(s23="",0,loadsymbol(s23,H));
h23 := hist(hhv(p23,249),1); f23 := (p23 > h23);
s24 := inputsymbol("Symbol #24", "ilu");
p24 := if(s24="",0,loadsymbol(s24,H));
h24 := hist(hhv(p24,249),1); f24 := (p24 > h24);
s25 := inputsymbol("Symbol #25", "lei");
p25 := if(s25="",0,loadsymbol(s25,H));
h25 := hist(hhv(p25,249),1); f25 := (p25 > h25);
s26 := inputsymbol("Symbol #26", "llc");
p26 := if(s26="",0,loadsymbol(s26,H));
h26 := hist(hhv(p26,249),1); f26 := (p26 > h26);
s27 := inputsymbol("Symbol #27", "mgr");
p27 := if(s27="",0,loadsymbol(s27,H));
h27 := hist(hhv(p27,249),1); f27 := (p27 > h27);
s28 := inputsymbol("Symbol #28", "mnd");
p28 := if(s28="",0,loadsymbol(s28,H));
h28 := hist(hhv(p28,249),1); f28 := (p28 > h28);
s29 := inputsymbol("Symbol #29", "nab");
p29 := if(s29="",0,loadsymbol(s29,H));
h29 := hist(hhv(p29,249),1); f29 := (p29 > h29);
s30 := inputsymbol("Symbol #30", "ncm");
p30 := if(s30="",0,loadsymbol(s30,H));
h30 := hist(hhv(p30,249),1); f30 := (p30 > h30);
s31 := inputsymbol("Symbol #31", "org");
p31 := if(s31="",0,loadsymbol(s31,H));
h31 := hist(hhv(p31,249),1); f31 := (p31 > h31);
s32 := inputsymbol("Symbol #32", "ori");
p32 := if(s32="",0,loadsymbol(s32,H));
h32 := hist(hhv(p32,249),1); f32 := (p32 > h32);
s33 := inputsymbol("Symbol #33", "osh");
p33 := if(s33="",0,loadsymbol(s33,H));
h33 := hist(hhv(p33,249),1); f33 := (p33 > h33);
s34 := inputsymbol("Symbol #34", "pna");
p34 := if(s34="",0,loadsymbol(s34,H));
h34 := hist(hhv(p34,249),1); f34 := (p34 > h34);
s35 := inputsymbol("Symbol #35", "pry");
p35 := if(s35="",0,loadsymbol(s35,H));
h35 := hist(hhv(p35,249),1); f35 := (p35 > h35);
s36 := inputsymbol("Symbol #36", "qan");
p36 := if(s36="",0,loadsymbol(s36,H));
h36 := hist(hhv(p36,249),1); f36 := (p36 > h36);
s37 := inputsymbol("Symbol #37", "qbe");
p37 := if(s37="",0,loadsymbol(s37,H));
h37 := hist(hhv(p37,249),1); f37 := (p37 > h37);
s38 := inputsymbol("Symbol #38", "rhc");
p38 := if(s38="",0,loadsymbol(s38,H));
h38 := hist(hhv(p38,249),1); f38 := (p38 > h38);
s39 := inputsymbol("Symbol #39", "rio");
p39 := if(s39="",0,loadsymbol(s39,H));
h39 := hist(hhv(p39,249),1); f39 := (p39 > h39);
s40 := inputsymbol("Symbol #40", "sgp");
p40 := if(s40="",0,loadsymbol(s40,H));
h40 := hist(hhv(p40,249),1); f40 := (p40 > h40);
s41 := inputsymbol("Symbol #41", "shl");
p41 := if(s41="",0,loadsymbol(s41,H));
h41 := hist(hhv(p41,249),1); f41 := (p41 > h41);
s42 := inputsymbol("Symbol #42", "sto");
p42 := if(s42="",0,loadsymbol(s42,H));
h42 := hist(hhv(p42,249),1); f42 := (p42 > h42);
s43 := inputsymbol("Symbol #43", "tah");
p43 := if(s43="",0,loadsymbol(s43,H));
h43 := hist(hhv(p43,249),1); f43 := (p43 > h43);
s44 := inputsymbol("Symbol #44", "tcl");
p44 := if(s44="",0,loadsymbol(s44,H));
h44 := hist(hhv(p44,249),1); f44 := (p44 > h44);
s45 := inputsymbol("Symbol #45", "tls");
p45 := if(s45="",0,loadsymbol(s45,H));
h45 := hist(hhv(p45,249),1); f45 := (p45 > h45);
s46 := inputsymbol("Symbol #46", "tol");
p46 := if(s46="",0,loadsymbol(s46,H));
h46 := hist(hhv(p46,249),1); f46 := (p46 > h46);
s47 := inputsymbol("Symbol #47", "wbc");
p47 := if(s47="",0,loadsymbol(s47,H));
h47 := hist(hhv(p47,249),1); f47 := (p47 > h47);
s48 := inputsymbol("Symbol #48", "wes");
p48 := if(s48="",0,loadsymbol(s48,H));
h48 := hist(hhv(p48,249),1); f48 := (p48 > h48);
s49 := inputsymbol("Symbol #49", "wow");
p49 := if(s49="",0,loadsymbol(s49,H));
h49 := hist(hhv(p49,249),1); f49 := (p49 > h49);
s50 := inputsymbol("Symbol #50", "wpl");
p50 := if(s50="",0,loadsymbol(s50,H));
h50 := hist(hhv(p50,249),1); f50 := (p50 > h50);
 
f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14+f15+f16+f17+f18+f19+f20+f21+f22+f23+f24+f25+f26+f27+f28+f29+f30+f31 +f32+f33+f34+f35+f36+f37+f38+f39+f40+f41+f42+f43+f44+f45+ f46+f47+f48+f49+f50;
Back to Top
maximo View Drop Down
BullCharts Guru
BullCharts Guru
Avatar

Joined: 02 Sep 2006
Location: Australia
Posts: 232
Post Options Post Options   Quote maximo Quote  Post ReplyReply Direct Link To This Post Posted: 11 Feb 2013 at 1:06am

Good job CB,

They add and subtract stocks from the indices every 3 months.  If you are wanting reliable testing from an index then it gets more difficult the further back in history you go.    I used to be able to get new index announcements and archives of changes from http://www.standardandpoors.com/home/en/au   The info may still be there.  Some info requires a free registration.

Survivorship bias and look-ahead bias can definitely complicate the testing process of indices.
 
I think the top 50 which you have selected is good.   Results should be statistically sound considering fewer changes to the smaller index and them having more weight carried by those 50.
 
If you want to eliminate those index bias issues and looking up the index changes then don't use an index.
Use liquidity as the selection filter, such as:  ma(V * C, 50, S) > 500000 
Liquidity/$Turnover is how they get into the indices anyhow.   If they aren't doing a good turnover then Standard's & Poors wont have them in the index.  That's mostly their rating system.   You can check this for yourself by verifying the stocks with the highest turnover being in the smallest numbered index, so ASX20 has the most liquid.
 


Edited by maximo - 11 Feb 2013 at 1:37am
Back to Top
cudderbean View Drop Down
Regular
Regular
Avatar

Joined: 02 Oct 2006
Location: Thailand
Posts: 40
Post Options Post Options   Quote cudderbean Quote  Post ReplyReply Direct Link To This Post Posted: 11 Feb 2013 at 9:51am
Thanks for your suggestion, Maximo.
 
Maybe I'll fiddle a little more. There were 82 companies out of today's XJO that were actually trading 12 years ago too. Maybe I should use your liquidity criteria to find the best candidates that suit those criteria both then and now.
Back to Top
maximo View Drop Down
BullCharts Guru
BullCharts Guru
Avatar

Joined: 02 Sep 2006
Location: Australia
Posts: 232
Post Options Post Options   Quote maximo Quote  Post ReplyReply Direct Link To This Post Posted: 11 Feb 2013 at 12:18pm
I created a turnover indicator a while back and it's useful to visualize candidates.
 
There is a stability factor which ensures the turnover is stable for 100 days.   Those settings will catch stocks just entering or leaving the ASX200 without issues.
 
Red = no pass, Amber = pass but not yet 100 days, Green = pass.
 
{ Turnover > $1m every day for the last 100 days }
volsize := input("Volume",1000000,100);
period:= input("Average period",50,1);
VX:=ma(Close*Volume,period,S);
TO:=If(VX < volsize or barnumber=1,1,0);
{[linestyle=solid; color=blue]
VX;}
[linestyle=Grounded Bar; width=2]
[Color=red]
If(VX < volsize,V,undefined);
[Color=coral]
If(VX >= volsize and barssince(TO) < 100,V,undefined);
[Color=lime green]
If(VX >= volsize and barssince(TO) >= 100,V,undefined);


Edited by maximo - 11 Feb 2013 at 12:52pm
Back to Top
rbbrain View Drop Down
BullCharts Staff
BullCharts Staff
Avatar

Joined: 22 Jul 2006
Location: Melbourne
Posts: 169
Post Options Post Options   Quote rbbrain Quote  Post ReplyReply Direct Link To This Post Posted: 11 Feb 2013 at 2:04pm
Hi folks,

Regarding index rebalancing, we can now see the news from S&P here:
http://www.standardandpoors.com/indices/index-announcements/en/us/?numDaysVal=archived&category=Equity&index=sp-asx-200&type=All
(There was a time where they put this stuff behind a pay-wall, but it is now freely available again).

Also, one minor point regarding selection of stocks for participation in an index. Don't forget that it is not only based on market cap. There are other "rules" that qualify some stocks to be listed in an index, and which disqualify others. The ASX web site offers this information here:
http://www.asx.com.au/products/capitalisation-indices.htm

(For my Share Market Toolbox members, these links are included within the Share Market information pages, and I frequently remind my members the details are there.)

Cheers

Robert B
Robert Brain (Brainy)
Convenor - Australian BullCharts User Group
Brainy's Share Market Toolbox and BullCharts Tips
[/CENTER
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.69
Copyright ©2001-2010 Web Wiz