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 Posted: 12 Feb 2013 at 3:41pm

Thank you again, Maximo and Robert. I have left the 50 symbols in the index for individual tinkering. They will perhaps need to be changed as time goes by anyway.

 

I have included a lookback periods option to make it more versatile...and also runs faster on <249 days for testing.

 

I ran the indicator then grabbed the values “Copy Plot Data”...that’s why I love BC so much, so compatible with Excel...and looked at them in Excel. I examined  the average and the standard deviation of the “count” whenever the new highs were >0, and similarly when the new lows were <0

 

New highs average >0                       =          3.29

New highs ave+ 1*stdev >0   =          5.75 (quite high)

New highs ave + 2*stdev >0  =          8.21 (very high)

 

New lows average <0             =          -3.19

New lows ave - 1*stdev >0    =          -7.21 (quite low)

New lows ave - 2*stdev >0    =          -11.22 (very low)

 

Can someone more skilful than I please put a few more lines of code in so that the line indicator changes colour to dark green whenever it is > 5.75 and red whenever it is <-7.21.

 

I can already see some divergences, but maybe I’m just seeing things...sizzling hot in Perth today!

 

Hopefully others will add their two cents worth if they find something useful.

 

I’m just a novice coder, so as always errors, shortcuts, and neater coding suggestions most welcome.

 

Thank you for your help.

 

{Symbols in Index. All from 2013 XJO but were also trading in 2000 ...may need some tinkering but I don't think results will differ widely}

 

lbk :=input("Lookback Periods",249,5);

 

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

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

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

s4 := inputsymbol("Symbol #4", "all");

s5 := inputsymbol("Symbol #5", "alz");

s6 := inputsymbol("Symbol #6", "amc");

s7 := inputsymbol("Symbol #7", "amp");

s8 := inputsymbol("Symbol #8", "anz");

s9 := inputsymbol("Symbol #9", "apa");

s10 := inputsymbol("Symbol #10", "asx");

s11 := inputsymbol("Symbol #11", "ben");

s12 := inputsymbol("Symbol #12", "bld");

s13 := inputsymbol("Symbol #13", "cba");

s14 := inputsymbol("Symbol #14", "ccl");

s15 := inputsymbol("Symbol #15", "coh");

s16 := inputsymbol("Symbol #16", "cpa");

s17 := inputsymbol("Symbol #17", "cpu");

s18 := inputsymbol("Symbol #18", "csl");

s19 := inputsymbol("Symbol #19", "ctx");

s20 := inputsymbol("Symbol #20", "flt");

s21 := inputsymbol("Symbol #21", "gnc");

s22 := inputsymbol("Symbol #22", "gpt");

s23 := inputsymbol("Symbol #23", "hvn");

s24 := inputsymbol("Symbol #24", "ilu");

s25 := inputsymbol("Symbol #25", "lei");

s26 := inputsymbol("Symbol #26", "llc");

s27 := inputsymbol("Symbol #27", "mgr");

s28 := inputsymbol("Symbol #28", "mnd");

s29 := inputsymbol("Symbol #29", "nab");

s30 := inputsymbol("Symbol #30", "ncm");

s31 := inputsymbol("Symbol #31", "org");

s32 := inputsymbol("Symbol #32", "ori");

s33 := inputsymbol("Symbol #33", "osh");

s34 := inputsymbol("Symbol #34", "pna");

s35 := inputsymbol("Symbol #35", "pry");

s36 := inputsymbol("Symbol #36", "qan");

s37 := inputsymbol("Symbol #37", "qbe");

s38 := inputsymbol("Symbol #38", "rhc");

s39 := inputsymbol("Symbol #39", "rio");

s40 := inputsymbol("Symbol #40", "sgp");

s41 := inputsymbol("Symbol #41", "shl");

s42 := inputsymbol("Symbol #42", "sto");

s43 := inputsymbol("Symbol #43", "tah");

s44 := inputsymbol("Symbol #44", "tcl");

s45 := inputsymbol("Symbol #45", "tls");

s46 := inputsymbol("Symbol #46", "tol");

s47 := inputsymbol("Symbol #47", "wbc");

s48 := inputsymbol("Symbol #48", "wes");

s49 := inputsymbol("Symbol #49", "wow");

s50 := inputsymbol("Symbol #50", "wpl");

 

{New Highs}

 

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

h1 := hist(hhv(p1,lbk),1); u1 := (p1 > h1);

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

h2 := hist(hhv(p2,lbk),1); u2 := (p2 > h2);

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

h3 := hist(hhv(p3,lbk),1); u3 := (p3 > h3);

p4 := if(s4="",0,loadsymbol(s4,H));

h4 := hist(hhv(p4,lbk),1); u4 := (p4 > h4);

p5 := if(s5="",0,loadsymbol(s5,H));

h5 := hist(hhv(p5,lbk),1); u5 := (p5 > h5);

p6 := if(s6="",0,loadsymbol(s6,H));

h6 := hist(hhv(p6,lbk),1); u6 := (p6 > h6);

p7 := if(s7="",0,loadsymbol(s7,H));

h7 := hist(hhv(p7,lbk),1); u7 := (p7 > h7);

p8 := if(s8="",0,loadsymbol(s8,H));

h8 := hist(hhv(p8,lbk),1); u8 := (p8 > h8);

p9 := if(s9="",0,loadsymbol(s9,H));

h9 := hist(hhv(p9,lbk),1); u9 := (p9 > h9);

p10 := if(s10="",0,loadsymbol(s10,H));

h10 := hist(hhv(p10,lbk),1); u10 := (p10 > h10);

p11 := if(s11="",0,loadsymbol(s11,H));

h11 := hist(hhv(p11,lbk),1); u11 := (p11 > h11);

p12 := if(s12="",0,loadsymbol(s12,H));

h12 := hist(hhv(p12,lbk),1); u12 := (p12 > h12);

p13 := if(s13="",0,loadsymbol(s13,H));

h13 := hist(hhv(p13,lbk),1); u13 := (p13 > h13);

p14 := if(s14="",0,loadsymbol(s14,H));

h14 := hist(hhv(p14,lbk),1); u14 := (p14 > h14);

p15 := if(s15="",0,loadsymbol(s15,H));

h15 := hist(hhv(p15,lbk),1); u15 := (p15 > h15);

p16 := if(s16="",0,loadsymbol(s16,H));

h16 := hist(hhv(p16,lbk),1); u16 := (p16 > h16);

p17 := if(s17="",0,loadsymbol(s17,H));

h17 := hist(hhv(p17,lbk),1); u17 := (p17 > h17);

p18 := if(s18="",0,loadsymbol(s18,H));

h18 := hist(hhv(p18,lbk),1); u18 := (p18 > h18);

p19 := if(s19="",0,loadsymbol(s19,H));

h19 := hist(hhv(p19,lbk),1); u19 := (p19 > h19);

p20 := if(s20="",0,loadsymbol(s20,H));

h20 := hist(hhv(p20,lbk),1); u20 := (p20 > h20);

p21 := if(s21="",0,loadsymbol(s21,H));

h21 := hist(hhv(p21,lbk),1); u21 := (p21 > h21);

p22 := if(s22="",0,loadsymbol(s22,H));

h22 := hist(hhv(p22,lbk),1); u22 := (p22 > h22);

p23 := if(s23="",0,loadsymbol(s23,H));

h23 := hist(hhv(p23,lbk),1); u23 := (p23 > h23);

p24 := if(s24="",0,loadsymbol(s24,H));

h24 := hist(hhv(p24,lbk),1); u24 := (p24 > h24);

p25 := if(s25="",0,loadsymbol(s25,H));

h25 := hist(hhv(p25,lbk),1); u25 := (p25 > h25);

p26 := if(s26="",0,loadsymbol(s26,H));

h26 := hist(hhv(p26,lbk),1); u26 := (p26 > h26);

p27 := if(s27="",0,loadsymbol(s27,H));

h27 := hist(hhv(p27,lbk),1); u27 := (p27 > h27);

p28 := if(s28="",0,loadsymbol(s28,H));

h28 := hist(hhv(p28,lbk),1); u28 := (p28 > h28);

p29 := if(s29="",0,loadsymbol(s29,H));

h29 := hist(hhv(p29,lbk),1); u29 := (p29 > h29);

p30 := if(s30="",0,loadsymbol(s30,H));

h30 := hist(hhv(p30,lbk),1); u30 := (p30 > h30);

p31 := if(s31="",0,loadsymbol(s31,H));

h31 := hist(hhv(p31,lbk),1); u31 := (p31 > h31);

p32 := if(s32="",0,loadsymbol(s32,H));

h32 := hist(hhv(p32,lbk),1); u32 := (p32 > h32);

p33 := if(s33="",0,loadsymbol(s33,H));

h33 := hist(hhv(p33,lbk),1); u33 := (p33 > h33);

p34 := if(s34="",0,loadsymbol(s34,H));

h34 := hist(hhv(p34,lbk),1); u34 := (p34 > h34);

p35 := if(s35="",0,loadsymbol(s35,H));

h35 := hist(hhv(p35,lbk),1); u35 := (p35 > h35);

p36 := if(s36="",0,loadsymbol(s36,H));

h36 := hist(hhv(p36,lbk),1); u36 := (p36 > h36);

p37 := if(s37="",0,loadsymbol(s37,H));

h37 := hist(hhv(p37,lbk),1); u37 := (p37 > h37);

p38 := if(s38="",0,loadsymbol(s38,H));

h38 := hist(hhv(p38,lbk),1); u38 := (p38 > h38);

p39 := if(s39="",0,loadsymbol(s39,H));

h39 := hist(hhv(p39,lbk),1); u39 := (p39 > h39);

p40 := if(s40="",0,loadsymbol(s40,H));

h40 := hist(hhv(p40,lbk),1); u40 := (p40 > h40);

p41 := if(s41="",0,loadsymbol(s41,H));

h41 := hist(hhv(p41,lbk),1); u41 := (p41 > h41);

p42 := if(s42="",0,loadsymbol(s42,H));

h42 := hist(hhv(p42,lbk),1); u42 := (p42 > h42);

p43 := if(s43="",0,loadsymbol(s43,H));

h43 := hist(hhv(p43,lbk),1); u43 := (p43 > h43);

p44 := if(s44="",0,loadsymbol(s44,H));

h44 := hist(hhv(p44,lbk),1); u44 := (p44 > h44);

p45 := if(s45="",0,loadsymbol(s45,H));

h45 := hist(hhv(p45,lbk),1); u45 := (p45 > h45);

p46 := if(s46="",0,loadsymbol(s46,H));

h46 := hist(hhv(p46,lbk),1); u46 := (p46 > h46);

p47 := if(s47="",0,loadsymbol(s47,H));

h47 := hist(hhv(p47,lbk),1); u47 := (p47 > h47);

p48 := if(s48="",0,loadsymbol(s48,H));

h48 := hist(hhv(p48,lbk),1); u48 := (p48 > h48);

p49 := if(s49="",0,loadsymbol(s49,H));

h49 := hist(hhv(p49,lbk),1); u49 := (p49 > h49);

p50 := if(s50="",0,loadsymbol(s50,H));

h50 := hist(hhv(p50,lbk),1); u50 := (p50 > h50);

 

newhi :=u1+u2+u3+u4+u5+u6+u7+u8+u9+u10+u11+u12+u13+u14+u15+u16+u17+u18+u19+u20+u21+u22+u23+u24+u25+u26+u27+u28+u29+u30+u31+u32+u33+u34+u35+u36+u37+u38+u39+u40+u41+u42+u43+u44+u45+u46+u47+u48+u49+u50;

 

{New Lows}

 

q1 := if(s1="",0,loadsymbol(s1,L));

L1 := hist(llv(q1,lbk),1); d1 := (q1 < L1);

q2 := if(s2="",0,loadsymbol(s2,L));

L2 := hist(llv(q2,lbk),1); d2 := (q2 < L2);

q3 := if(s3="",0,loadsymbol(s3,L));

L3 := hist(llv(q3,lbk),1); d3 := (q3 < L3);

q4 := if(s4="",0,loadsymbol(s4,L));

L4 := hist(llv(q4,lbk),1); d4 := (q4 < L4);

q5 := if(s5="",0,loadsymbol(s5,L));

L5 := hist(llv(q5,lbk),1); d5 := (q5 < L5);

q6 := if(s6="",0,loadsymbol(s6,L));

L6 := hist(llv(q6,lbk),1); d6 := (q6 < L6);

q7 := if(s7="",0,loadsymbol(s7,L));

L7 := hist(llv(q7,lbk),1); d7 := (q7 < L7);

q8 := if(s8="",0,loadsymbol(s8,L));

L8 := hist(llv(q8,lbk),1); d8 := (q8 < L8);

q9 := if(s9="",0,loadsymbol(s9,L));

L9 := hist(llv(q9,lbk),1); d9 := (q9 < L9);

q10 := if(s10="",0,loadsymbol(s10,L));

L10 := hist(llv(q10,lbk),1); d10 := (q10 < L10);

q11 := if(s11="",0,loadsymbol(s11,L));

L11 := hist(llv(q11,lbk),1); d11 := (q11 < L11);

q12 := if(s12="",0,loadsymbol(s12,L));

L12 := hist(llv(q12,lbk),1); d12 := (q12 < L12);

q13 := if(s13="",0,loadsymbol(s13,L));

L13 := hist(llv(q13,lbk),1); d13 := (q13 < L13);

q14 := if(s14="",0,loadsymbol(s14,L));

L14 := hist(llv(q14,lbk),1); d14 := (q14 < L14);

q15 := if(s15="",0,loadsymbol(s15,L));

L15 := hist(llv(q15,lbk),1); d15 := (q15 < L15);

q16 := if(s16="",0,loadsymbol(s16,L));

L16 := hist(llv(q16,lbk),1); d16 := (q16 < L16);

q17 := if(s17="",0,loadsymbol(s17,L));

L17 := hist(llv(q17,lbk),1); d17 := (q17 < L17);

q18 := if(s18="",0,loadsymbol(s18,L));

L18 := hist(llv(q18,lbk),1); d18 := (q18 < L18);

q19 := if(s19="",0,loadsymbol(s19,L));

L19 := hist(llv(q19,lbk),1); d19 := (q19 < L19);

q20 := if(s20="",0,loadsymbol(s20,L));

L20 := hist(llv(q20,lbk),1); d20 := (q20 < L20);

q21 := if(s21="",0,loadsymbol(s21,L));

L21 := hist(llv(q21,lbk),1); d21 := (q21 < L21);

q22 := if(s22="",0,loadsymbol(s22,L));

L22 := hist(llv(q22,lbk),1); d22 := (q22 < L22);

q23 := if(s23="",0,loadsymbol(s23,L));

L23 := hist(llv(q23,lbk),1); d23 := (q23 < L23);

q24 := if(s24="",0,loadsymbol(s24,L));

L24 := hist(llv(q24,lbk),1); d24 := (q24 < L24);

q25 := if(s25="",0,loadsymbol(s25,L));

L25 := hist(llv(q25,lbk),1); d25 := (q25 < L25);

q26 := if(s26="",0,loadsymbol(s26,L));

L26 := hist(llv(q26,lbk),1); d26 := (q26 < L26);

q27 := if(s27="",0,loadsymbol(s27,L));

L27 := hist(llv(q27,lbk),1); d27 := (q27 < L27);

q28 := if(s28="",0,loadsymbol(s28,L));

L28 := hist(llv(q28,lbk),1); d28 := (q28 < L28);

q29 := if(s29="",0,loadsymbol(s29,L));

L29 := hist(llv(q29,lbk),1); d29 := (q29 < L29);

q30 := if(s30="",0,loadsymbol(s30,L));

L30 := hist(llv(q30,lbk),1); d30 := (q30 < L30);

q31 := if(s31="",0,loadsymbol(s31,L));

L31 := hist(llv(q31,lbk),1); d31 := (q31 < L31);

q32 := if(s32="",0,loadsymbol(s32,L));

L32 := hist(llv(q32,lbk),1); d32 := (q32 < L32);

q33 := if(s33="",0,loadsymbol(s33,L));

L33 := hist(llv(q33,lbk),1); d33 := (q33 < L33);

q34 := if(s34="",0,loadsymbol(s34,L));

L34 := hist(llv(q34,lbk),1); d34 := (q34 < L34);

q35 := if(s35="",0,loadsymbol(s35,L));

L35 := hist(llv(q35,lbk),1); d35 := (q35 < L35);

q36 := if(s36="",0,loadsymbol(s36,L));

L36 := hist(llv(q36,lbk),1); d36 := (q36 < L36);

q37 := if(s37="",0,loadsymbol(s37,L));

L37 := hist(llv(q37,lbk),1); d37 := (q37 < L37);

q38 := if(s38="",0,loadsymbol(s38,L));

L38 := hist(llv(q38,lbk),1); d38 := (q38 < L38);

q39 := if(s39="",0,loadsymbol(s39,L));

L39 := hist(llv(q39,lbk),1); d39 := (q39 < L39);

q40 := if(s40="",0,loadsymbol(s40,L));

L40 := hist(llv(q40,lbk),1); d40 := (q40 < L40);

q41 := if(s41="",0,loadsymbol(s41,L));

L41 := hist(llv(q41,lbk),1); d41 := (q41 < L41);

q42 := if(s42="",0,loadsymbol(s42,L));

L42 := hist(llv(q42,lbk),1); d42 := (q42 < L42);

q43 := if(s43="",0,loadsymbol(s43,L));

L43 := hist(llv(q43,lbk),1); d43 := (q43 < L43);

q44 := if(s44="",0,loadsymbol(s44,L));

L44 := hist(llv(q44,lbk),1); d44 := (q44 < L44);

q45 := if(s45="",0,loadsymbol(s45,L));

L45 := hist(llv(q45,lbk),1); d45 := (q45 < L45);

q46 := if(s46="",0,loadsymbol(s46,L));

L46 := hist(llv(q46,lbk),1); d46 := (q46 < L46);

q47 := if(s47="",0,loadsymbol(s47,L));

L47 := hist(llv(q47,lbk),1); d47 := (q47 < L47);

q48 := if(s48="",0,loadsymbol(s48,L));

L48 := hist(llv(q48,lbk),1); d48 := (q48 < L48);

q49 := if(s49="",0,loadsymbol(s49,L));

L49 := hist(llv(q49,lbk),1); d49 := (q49 < L49);

q50 := if(s50="",0,loadsymbol(s50,L));

L50 := hist(llv(q50,lbk),1); d50 := (q50 < L50);

 

newlo:=d1+d2+d3+d4+d5+d6+d7+d8+d9+d10+d11+d12+d13+d14+d15+d16+d17+d18+d19+d20+d21+d22+d23+d24+d25+d26+d27+d28+d29+d30+d31+d32+d33+d34+d35+d36+d37+d38+d39+d40+d41+d42+d43+d44+d45+d46+d47+d48+d49+d50;

 

[horzline=0;color=black]

[linestyle =solid;color=blue]

 

newhi-newlo;

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: 20 Feb 2013 at 4:21pm

Good work CB,

Here's another idea.  It may save time having to lookup, which stocks have made the new High, by having the stock code appear on the indicator.

 
lbk :=input("Lookback Periods",249,5);
s1 := inputsymbol("Symbol #1", "BHP");
p1 := if(s1="",0,loadsymbol(s1,H));
h1 := hist(hhv(p1,lbk),1); f1 := (p1 > h1);
s2 := inputsymbol("Symbol #2", "CBA");
p2 := if(s2="",0,loadsymbol(s2,H));
h2 := hist(hhv(p2,lbk),1); f2 := (p2 > h2);
s3 := inputsymbol("Symbol #5", "WOW");
p3 := if(s3="",0,loadsymbol(s3,H));
h3 := hist(hhv(p3,lbk),1); f3 := (p3 > h3);
f1+f2+f3;

[linestyle=Text; textalign=Above,Center]
[color=Forest Green]
If(f1>0 and hist(barssince(f1),1)>1,"BHP", undefined); f1;
[color=Dodger Blue]
If(f2>0 and hist(barssince(f2),1)>1,"CBA", undefined); f1+f2;
[color=Magenta]
If(f3>0 and hist(barssince(f3),1)>1,"WOW", undefined); f1+f2+f3;

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: 21 Feb 2013 at 11:30am
That is a neat addition, Maximo. Thank you.
I am playing with various divergence and extreme situations at the moment to be highlighted in a ribbon. Will report back.
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