Australian (ASX) Stock Market Forum

Statistical Probability of Support and Resistance Levels

Joined
Dec 13, 2017
Posts
3
Reactions
0
I have developed the Bullcharts indicator listed below which characterises current support and resistance price levels relative to the prices which have been most statistically probable over a given period. This indicator calculates a histogram of the incidence of Close prices within 25 equal bands between the minimum and maximum prices of a period which is considered representative and within each price band decays the significance of the older data.

Except for new listings which go on to trend strongly and consistently for most shares a histogram of the incidence of price levels, ranked in order of their incidence, will be skewed with a long tail of prices which occur infrequently and a number of bands with the more frequent price levels (approximately Weibull).

Other support and resistance indicators employ an exponential moving average to calculate the current representative support and resistance price levels. Those available in the Bullchart library use 280 bars as a basis, the most recent three peaks and troughs of the zigzag function and a 25 bar exponential moving average as standard.

I advocate that this proposed statistical method is a more accurate hypothetical model than a support and resistance formulation using an exponential moving average as a basis because it calculates the most statistically probable price levels but decays the significance of historical prices with a time weighted average. This formulation employs significant volume spikes or changes in cumulative volume to determine the timing in changes of support and resistance levels. Over the last few months I have found this method to be more responsive than an EMA support or resistance indicator.

Some purists may criticise this formulation for a number of reasons including;
a) either method of calculating the timing of changing between indicator support or resistance price levels involves an element of subjectivity (the sensitivity of the zigzag function), and;
b) the subjectivity of deciding the incidence cutoff between the long tail of improbable price level bands and the higher probability bands, and;
c) throughout this indicator the support and resistance levels displayed change when additional data is received, the support and resistance levels calculated for the next bar are, at least, infinitesimally different from that calculated for the current bar.

Unfortunately the Achilles heel of this indicator is that while Bullcharts can calculate it, it takes a long time to evaluate the Bullchart’s standard lowest and highest (LLV and HHV) functions. The time taken is heavily dependent on the number of bars, WHA is quick but 30 years of BHP is slow (15 minutes or more). I recently brought a fairly modern Windows 10 Professional computer and I have not thought of a way to expedite this indicator because I will not be able to markedly improve the computer’s clock speed of 4.2GHz in the near future.

The limits on number of parameters and memory size of a Metastock exploration are such that I have not thought of a way that this could be readily done in Metastock. I would appreciate it if anyone can inform me of a software which has a statistical method such as this formulated successfully.

Having written this indicator I have subsequently tried to find an academic basis for what I believe is elementary statistics. I assert that with the exception of the Weis/Wyckoff treatment of cumulative volume I wrote this Bullcharts indicator independently. Googling the terms “support resist probab statist” returns a number of academic articles on memory effect including those by Garzarelli et al and De Angelis et al but I did not find anything as pragmatic as that below. In part due to the speed of the Bullchart’s lowest and highest functions and the Metastock exploration number of parameters and memory size issues I infer that this statistical method is not readily available.

I first discussed with Bullsystems the response duration of the Lowest and Highest functions in early October and I believe we are agreed that this is an issue with these standard Bullcharts functions. If you are interested please take the time to explore the potential of the indicator below. As a workaround I have split this indicator into two parts. The first part can still take around five minutes to display the representative period (number of bars for analysis) and the corresponding minimum and maximum prices. I then manually enter these three numbers for the second part to calculate the time weighted average and display the support and resistance level indicators. Ultimately my objective is to find a way to automate calculation of this indicator and display it in under 60 seconds without human interference.

I seek your support and ask that you trial this indicator in Bullcharts, if you have a licence, as I would appreciate confirmation as to whether anyone else obtains faster results with a different operating system. Further if anyone is interested I would appreciate feedback from anyone who successfully codes it in a different software (eg AmiBroker or NinjaTrader or ?).

I accept no responsibility nor liability for any use of this indicator, in particular, noting the concerns above and its response time.

{************************************************************************The indicator below, down to the next line of asterisks, should be saved in Custom Indicators as “S&R Representative min max price” or similar. When inserted in a chart it should display two numbers in the top and bottom right corners of the Price chart by default }

{Determine repesentative minimum and maximum price of current data}
ScopeMax:= lastvalue(highestbars(C,min(lastvalue(barnumber)-2,1300)));
ScopeMin:= lastvalue(lowestbars(C,min(lastvalue(barnumber)-2,1300)));

range:= if(lastvalue(barnumber)>1300, lastvalue(highest(c,1300)-lowest(c,1300)), lastvalue(highest(c,75)-lowest(c,75)));

mean:= if(lastvalue(barnumber)>1300, if(range=0, 0, abs(((0.5*(lastvalue(highest(c,1300)+lowest(c,1300))))-lastvalue(ma(C,1300)))/range)),

abs(((0.5*(lastvalue(highest(c,75)+lowest(c,75))))-lastvalue(ma(C,75)))/range));

infinity:= if(ScopeMax+ScopeMin>2250, 1300, 100+1200*htan((ScopeMax+ScopeMin)/40));

scope:= int(if(lastvalue(barssince(ma(V,10,s)=0))>0,min(1300,min(

infinity + (0.5*mean*(min(1300,lastvalue(barssince(ma(V,10,s)=0)))-infinity)),lastvalue(barssince(ma(V,10,s)=0)))),

infinity + (0.5*mean*(1300-infinity)) ));

timescale:= lastvalue(barnumber);
dataset:= if(timescale>scope+1,timescale-scope,1);

CDS:= valuewhen(1,if(barnumber>dataset,1,0),C);

closelo:= lastvalue(lowest(CDS,scope));
closehi:= lastvalue(highest(CDS,scope));

[linestyle=text; target=price; textalign=top,right]
if(barnumber=lastvalue(barnumber), closehi, undefined);
c;

[linestyle=text; target=price; textalign=bottom,right]
if(barnumber=lastvalue(barnumber), closelo, undefined);
c;

{***************this line is not required as Bullchart code************}
{The code above will display indicator lines but I hide them by making them the same colour as the background}

{************************************************************************The indicator below, down to the next line of asterisks, should be saved in Custom Indicators as “S&R Representative duration” or similar. When inserted in a chart it should display two numbers in the upper right corner of the Volume chart by default }

boxend:= lastvalue(barnumber);
[linestyle=text; target=volume; textalign=top, right]
if(barnumber=lastvalue(barnumber), boxend, undefined);
V;

{Determine repesentative set of current data}
ScopeMax:= lastvalue(highestbars(C,min(lastvalue(barnumber)-2,1300)));
ScopeMin:= lastvalue(lowestbars(C,min(lastvalue(barnumber)-2,1300)));

range:= if(lastvalue(barnumber)>1300, lastvalue(highest(c,1300)-lowest(c,1300)), lastvalue(highest(c,75)-lowest(c,75)));

mean:= if(lastvalue(barnumber)>1300, if(range=0, 0, abs(((0.5*(lastvalue(highest(c,1300)+lowest(c,1300))))-lastvalue(ma(C,1300)))/range)),

abs(((0.5*(lastvalue(highest(c,75)+lowest(c,75))))-lastvalue(ma(C,75)))/range));

infinity:= if(ScopeMax+ScopeMin>2250, 1300, 100+1200*htan((ScopeMax+ScopeMin)/40));

scope:= int(if(lastvalue(barssince(ma(V,10,s)=0))>0,min(1300,min(

infinity + (0.5*mean*(min(1300,lastvalue(barssince(ma(V,10,s)=0)))-infinity)),lastvalue(barssince(ma(V,10,s)=0)))),

infinity + (0.5*mean*(1300-infinity)) ));

[linestyle=text; target=volume; textalign=top, left]
if(barnumber=lastvalue(barnumber), scope, undefined);
V;

{***************this line is not required as Bullchart code************}



{************************************************************************The indicator below should be saved in Custom Indicators as “S&R Manual” or similar. When inserted in a chart it should display support and resistance levels on the price chart by default }

{Determine repesentative set of current data}
ScopeMax:= if(lastvalue(barnumber)<520,lastvalue(barnumber),lastvalue(highestbars(C,1300)));
ScopeMin:= if(lastvalue(barnumber)<520,lastvalue(barnumber),lastvalue(lowestbars(C,1300)));

mean:= 0.5*(highest(C,if(barnumber<1300,barnumber,1300))+lowest(C,if(barnumber<1300,barnumber,1300)));

average:= abs(ma(C,1300,s)-mean)/mean;

infinity:= if(ScopeMax+ScopeMin>2250, 1300, 100+1200*htan((ScopeMax+ScopeMin)/40));

scope:= input("Enter the analysis PERIOD");

timescale:= lastvalue(barnumber);
dataset:= if(timescale>scope+1,timescale-scope,1);

CDS:= valuewhen(1,if(barnumber>dataset,1,0),C);
VDS:= valuewhen(1,if(barnumber>dataset,1,0),V);

cutoff:=0.02;

{Significant Volume Peaks}
oracle:= if(C>hist(C,1), VDS/ma(VDS,40,e), if(c<hist(c,1), -1*VDS/ma(VDS,40,e), 0));

verticalrise:= lastvalue(cum(oracle));
factored:= cum(oracle) - (barnumber*verticalrise/timescale);

ScaleMin:= lastvalue(lowest(factored));
ScaleMax:= lastvalue(highest(factored));
sensitivity:= abs(ScaleMax - ScaleMin)/25;

{Significant Cumulative Volume changes}
[citation="Weis / Wyckoff"]
priceapprox:=zigzag(If(Outside() AND Ref(H,-1)>Ref(H,-2),H,If(Outside() AND Ref(L,-1)<Ref(L,-2),L,If((Outside() OR Inside()) AND C>O,H,If((Outside() OR Inside()) AND O>C,L,If(H>Ref(H,-1),H,If(L<Ref(L,-1),L,If(Ref(H,-1)>Ref(H,-2),H,If(Ref(L,-1)<Ref(L,-2),L,C)))))))), lastvalue((100*atr(14)/c)+0.8*abs(highest(c,100)-lowest(c,100))/3.00) ,%);

posivolume:= if(priceapprox>hist(priceapprox,1), previous+v, 0);
negivolume:= if(priceapprox<hist(priceapprox,1), previous-v, 0);
cumvolume:= posivolume+negivolume;

temphi:= input("Enter the MAXIMUM price");
templo:= input("Enter the MINIMUM price");
closelo:= min(templo, temphi);
gap:= abs(temphi - templo);

Band00:= sum(if(CDS>=closelo+(0.00*gap),if(CDS<closelo+(0.04*gap), CDS*(barnumber-scope),0), 0));
Band01:= sum(if(CDS>=closelo+(0.04*gap),if(CDS<closelo+(0.08*gap), CDS*(barnumber-scope),0), 0));
Band02:= sum(if(CDS>=closelo+(0.08*gap),if(CDS<closelo+(0.12*gap), CDS*(barnumber-scope),0), 0));
Band03:= sum(if(CDS>=closelo+(0.12*gap),if(CDS<closelo+(0.16*gap), CDS*(barnumber-scope),0), 0));
Band04:= sum(if(CDS>=closelo+(0.16*gap),if(CDS<closelo+(0.20*gap), CDS*(barnumber-scope),0), 0));
Band05:= sum(if(CDS>=closelo+(0.20*gap),if(CDS<closelo+(0.24*gap), CDS*(barnumber-scope),0), 0));
Band06:= sum(if(CDS>=closelo+(0.24*gap),if(CDS<closelo+(0.28*gap), CDS*(barnumber-scope),0), 0));
Band07:= sum(if(CDS>=closelo+(0.28*gap),if(CDS<closelo+(0.32*gap), CDS*(barnumber-scope),0), 0));
Band08:= sum(if(CDS>=closelo+(0.32*gap),if(CDS<closelo+(0.36*gap), CDS*(barnumber-scope),0), 0));
Band09:= sum(if(CDS>=closelo+(0.36*gap),if(CDS<closelo+(0.40*gap), CDS*(barnumber-scope),0), 0));
Band10:= sum(if(CDS>=closelo+(0.40*gap),if(CDS<closelo+(0.44*gap), CDS*(barnumber-scope),0), 0));
Band11:= sum(if(CDS>=closelo+(0.44*gap),if(CDS<closelo+(0.48*gap), CDS*(barnumber-scope),0), 0));
Band12:= sum(if(CDS>=closelo+(0.48*gap),if(CDS<closelo+(0.52*gap), CDS*(barnumber-scope),0), 0));
Band13:= sum(if(CDS>=closelo+(0.52*gap),if(CDS<closelo+(0.56*gap), CDS*(barnumber-scope),0), 0));
Band14:= sum(if(CDS>=closelo+(0.56*gap),if(CDS<closelo+(0.60*gap), CDS*(barnumber-scope),0), 0));
Band15:= sum(if(CDS>=closelo+(0.60*gap),if(CDS<closelo+(0.64*gap), CDS*(barnumber-scope),0), 0));
Band16:= sum(if(CDS>=closelo+(0.64*gap),if(CDS<closelo+(0.68*gap), CDS*(barnumber-scope),0), 0));
Band17:= sum(if(CDS>=closelo+(0.68*gap),if(CDS<closelo+(0.72*gap), CDS*(barnumber-scope),0), 0));
Band18:= sum(if(CDS>=closelo+(0.72*gap),if(CDS<closelo+(0.76*gap), CDS*(barnumber-scope),0), 0));
Band19:= sum(if(CDS>=closelo+(0.76*gap),if(CDS<closelo+(0.80*gap), CDS*(barnumber-scope),0), 0));
Band20:= sum(if(CDS>=closelo+(0.80*gap),if(CDS<closelo+(0.84*gap), CDS*(barnumber-scope),0), 0));
Band21:= sum(if(CDS>=closelo+(0.84*gap),if(CDS<closelo+(0.88*gap), CDS*(barnumber-scope),0), 0));
Band22:= sum(if(CDS>=closelo+(0.88*gap),if(CDS<closelo+(0.92*gap), CDS*(barnumber-scope),0), 0));
Band23:= sum(if(CDS>=closelo+(0.92*gap),if(CDS<closelo+(0.96*gap), CDS*(barnumber-scope),0), 0));
Band24:= sum(if(CDS>=closelo+(0.96*gap),if(CDS<closelo+(1.00*gap), CDS*(barnumber-scope),0), 0));

Count00:= sum(if(CDS>=closelo+(0.00*gap),if(CDS<closelo+(0.04*gap), barnumber-scope,0), 0));
Count01:= sum(if(CDS>=closelo+(0.04*gap),if(CDS<closelo+(0.08*gap), barnumber-scope,0), 0));
Count02:= sum(if(CDS>=closelo+(0.08*gap),if(CDS<closelo+(0.12*gap), barnumber-scope,0), 0));
Count03:= sum(if(CDS>=closelo+(0.12*gap),if(CDS<closelo+(0.16*gap), barnumber-scope,0), 0));
Count04:= sum(if(CDS>=closelo+(0.16*gap),if(CDS<closelo+(0.20*gap), barnumber-scope,0), 0));
Count05:= sum(if(CDS>=closelo+(0.20*gap),if(CDS<closelo+(0.24*gap), barnumber-scope,0), 0));
Count06:= sum(if(CDS>=closelo+(0.24*gap),if(CDS<closelo+(0.28*gap), barnumber-scope,0), 0));
Count07:= sum(if(CDS>=closelo+(0.28*gap),if(CDS<closelo+(0.32*gap), barnumber-scope,0), 0));
Count08:= sum(if(CDS>=closelo+(0.32*gap),if(CDS<closelo+(0.36*gap), barnumber-scope,0), 0));
Count09:= sum(if(CDS>=closelo+(0.36*gap),if(CDS<closelo+(0.40*gap), barnumber-scope,0), 0));
Count10:= sum(if(CDS>=closelo+(0.40*gap),if(CDS<closelo+(0.44*gap), barnumber-scope,0), 0));
Count11:= sum(if(CDS>=closelo+(0.44*gap),if(CDS<closelo+(0.48*gap), barnumber-scope,0), 0));
Count12:= sum(if(CDS>=closelo+(0.48*gap),if(CDS<closelo+(0.52*gap), barnumber-scope,0), 0));
Count13:= sum(if(CDS>=closelo+(0.52*gap),if(CDS<closelo+(0.56*gap), barnumber-scope,0), 0));
Count14:= sum(if(CDS>=closelo+(0.56*gap),if(CDS<closelo+(0.60*gap), barnumber-scope,0), 0));
Count15:= sum(if(CDS>=closelo+(0.60*gap),if(CDS<closelo+(0.64*gap), barnumber-scope,0), 0));
Count16:= sum(if(CDS>=closelo+(0.64*gap),if(CDS<closelo+(0.68*gap), barnumber-scope,0), 0));
Count17:= sum(if(CDS>=closelo+(0.68*gap),if(CDS<closelo+(0.72*gap), barnumber-scope,0), 0));
Count18:= sum(if(CDS>=closelo+(0.72*gap),if(CDS<closelo+(0.76*gap), barnumber-scope,0), 0));
Count19:= sum(if(CDS>=closelo+(0.76*gap),if(CDS<closelo+(0.80*gap), barnumber-scope,0), 0));
Count20:= sum(if(CDS>=closelo+(0.80*gap),if(CDS<closelo+(0.84*gap), barnumber-scope,0), 0));
Count21:= sum(if(CDS>=closelo+(0.84*gap),if(CDS<closelo+(0.88*gap), barnumber-scope,0), 0));
Count22:= sum(if(CDS>=closelo+(0.88*gap),if(CDS<closelo+(0.92*gap), barnumber-scope,0), 0));
Count23:= sum(if(CDS>=closelo+(0.92*gap),if(CDS<closelo+(0.96*gap), barnumber-scope,0), 0));
Count24:= sum(if(CDS>=closelo+(0.96*gap),if(CDS<closelo+(1.00*gap), barnumber-scope,0), 0));

total:= lastvalue(Count00 + Count01 + Count02 + Count03 + Count04 + Count05 + Count06 + Count07 + Count08 + Count09 +
Count10 + Count11 + Count12 + Count13 + Count14 + Count15 + Count16 + Count17 + Count18 + Count19 +
Count20 + Count21 + Count22 + Count23 + Count24);

PriceLevel:= max(
if(Count00>hist(Count00,1), if(lastvalue(Count00)/total<cutoff, 0, lastvalue(Band00)/lastvalue(Count00)), 0),
if(Count01>hist(Count01,1), if(lastvalue(Count01)/total<cutoff, 0, lastvalue(Band01)/lastvalue(Count01)), 0),
if(Count02>hist(Count02,1), if(lastvalue(Count02)/total<cutoff, 0, lastvalue(Band02)/lastvalue(Count02)), 0),
if(Count03>hist(Count03,1), if(lastvalue(Count03)/total<cutoff, 0, lastvalue(Band03)/lastvalue(Count03)), 0),
if(Count04>hist(Count04,1), if(lastvalue(Count04)/total<cutoff, 0, lastvalue(Band04)/lastvalue(Count04)), 0),
if(Count05>hist(Count05,1), if(lastvalue(Count05)/total<cutoff, 0, lastvalue(Band05)/lastvalue(Count05)), 0),
if(Count06>hist(Count06,1), if(lastvalue(Count06)/total<cutoff, 0, lastvalue(Band06)/lastvalue(Count06)), 0),
if(Count07>hist(Count07,1), if(lastvalue(Count07)/total<cutoff, 0, lastvalue(Band07)/lastvalue(Count07)), 0),
if(Count08>hist(Count08,1), if(lastvalue(Count08)/total<cutoff, 0, lastvalue(Band08)/lastvalue(Count08)), 0),
if(Count09>hist(Count09,1), if(lastvalue(Count09)/total<cutoff, 0, lastvalue(Band09)/lastvalue(Count09)), 0),
if(Count10>hist(Count10,1), if(lastvalue(Count10)/total<cutoff, 0, lastvalue(Band10)/lastvalue(Count10)), 0),
if(Count11>hist(Count11,1), if(lastvalue(Count11)/total<cutoff, 0, lastvalue(Band11)/lastvalue(Count11)), 0),
if(Count12>hist(Count12,1), if(lastvalue(Count12)/total<cutoff, 0, lastvalue(Band12)/lastvalue(Count12)), 0),
if(Count13>hist(Count13,1), if(lastvalue(Count13)/total<cutoff, 0, lastvalue(Band13)/lastvalue(Count13)), 0),
if(Count14>hist(Count14,1), if(lastvalue(Count14)/total<cutoff, 0, lastvalue(Band14)/lastvalue(Count14)), 0),
if(Count15>hist(Count15,1), if(lastvalue(Count15)/total<cutoff, 0, lastvalue(Band15)/lastvalue(Count15)), 0),
if(Count16>hist(Count16,1), if(lastvalue(Count16)/total<cutoff, 0, lastvalue(Band16)/lastvalue(Count16)), 0),
if(Count17>hist(Count17,1), if(lastvalue(Count17)/total<cutoff, 0, lastvalue(Band17)/lastvalue(Count17)), 0),
if(Count18>hist(Count18,1), if(lastvalue(Count18)/total<cutoff, 0, lastvalue(Band18)/lastvalue(Count18)), 0),
if(Count19>hist(Count19,1), if(lastvalue(Count19)/total<cutoff, 0, lastvalue(Band19)/lastvalue(Count19)), 0),
if(Count20>hist(Count20,1), if(lastvalue(Count20)/total<cutoff, 0, lastvalue(Band20)/lastvalue(Count20)), 0),
if(Count21>hist(Count21,1), if(lastvalue(Count21)/total<cutoff, 0, lastvalue(Band21)/lastvalue(Count21)), 0),
if(Count22>hist(Count22,1), if(lastvalue(Count22)/total<cutoff, 0, lastvalue(Band22)/lastvalue(Count22)), 0),
if(Count23>hist(Count23,1), if(lastvalue(Count23)/total<cutoff, 0, lastvalue(Band23)/lastvalue(Count23)), 0),
if(Count24>hist(Count24,1), if(lastvalue(Count24)/total<cutoff, 0, lastvalue(Band24)/lastvalue(Count24)), 0));

interim:=if(PriceLevel=0,1,0);
Normalised:= if(interim=1, previous + PriceLevel, PriceLevel);

{Resistance Level calculation}
[target=price; width=2; linestyle=dash; transparency=75; color=Red]
valuewhen(1,if(barnumber>dataset, if(peakbars(1,zigzag(factored,sensitivity,points),20)=0,1,0),0), Normalised);

{Support Level Calculation}
[target=price; width=2; linestyle=dash; transparency=75; color=Dark Green]
valuewhen(1,if(barnumber>dataset, if(troughbars(1,zigzag(factored,sensitivity,points),20)=0,1,0),0), Normalised);

{Resistance Level calculation}
[target=price; width=2; linestyle=dash; transparency=75; color=Orange]
valuewhen(1,if(barnumber>dataset, if(peakbars(1,zigzag(cumvolume, 5, percent),20)=0,1,0),0), Normalised);

{Support Level Calculation}
[target=price; width=2; linestyle=dash; transparency=75; color=Orchid]
valuewhen(1,if(barnumber>dataset, if(troughbars(1,zigzag(cumvolume, 5, percent),20)=0,1,0),0), Normalised);
 
Joined
Jan 12, 2008
Posts
4,370
Reactions
8,461
I tried it. All three parts (not two as mentioned) loaded with no syntax errors (phew).

1st part: Val MinMax produced nothing on the charts.
2nd part: Val Duration showed the number of bars of the total history for the stock code using the displayed time period (daily, weekly, monthly )

3rd part: ValS&Rmanual Required three inputs Duration (period), Max and Min prices.

Using the WHA chart the ValS&R did take some time to display and had to be "coaxed" by using lower duration values. When coaxed, the lines appeared in about four seconds (WHA chart - pic 1)

However when the duration got >99 the earlier S&R lines stayed at zero. (pic 2)

Using the duration period from the Duration indicator the indicator fails completely. (pic 3).
whapic1.PNG whapic2.PNG whapic3.PNG
 
Joined
Jan 12, 2008
Posts
4,370
Reactions
8,461
Switched over to the BHP chart. Calculating..... calculating ......

Max Min and the duration values appeared in 30 secs.
The S&R lines are still calculating....

They're done before 60 sec. BUT the lines are all at zero. Probably because the parameters were applicable to WHA.

Imputing the BHP numbers that appeared on the chart. Calculating ... done in 3 min.
But again the S&R lines are all at zero. (BHPpic1)

Tried "coaxing" the lines like hand feeding wild animals. (BHPpic2) 100secs

Increasing the duration to 300 (> 1 yr price history) took 100secs. (BHPpic3)

bhppic1.PNG bhppic2.PNG bhppic2.PNG
 

Attachments

tech/a

No Ordinary Duck
Joined
Oct 14, 2004
Posts
19,529
Reactions
3,886
When you say statistical probability do you mean

How often does a single low or a double Bottom
Or a number of points with the exact same price
Or within a % of each point holds

Either as support or resistance
As you can see there are a lot of fuzzy conditions
To be satisfied let alone volume range and time between points.

Then you can throw in the characteristics of the bar/s going into support
Or resistance.

Then perhaps more importantly the characteristics of the bar that DOESNT adhere to support or resistance and or those bars leading up to the bar that ploughs through.

Your finding a problem that most find with publicly available software
That being capability.
Python would be a better language with far more capability and capacity You for solving These sort of questions .

There are many similar questions out there
 
Joined
Dec 13, 2017
Posts
3
Reactions
0
My apologies Peter although there were no syntax errors and it displays there was a logical error. The time weighted average was the last refinement I incorporated into this indicator and it requires an additional nested if function for each of the cumulative sums and counts to restrict the analysis to only the data which has been selected as representative. Please find attached a file of the updated corrected code which I have checked against the results from a spreadsheet calculation.

BHP
Please find attached views of this indicator overlaid on BHP which this week had 8012 total bars of data and the indicator was recommending a representative analysis period of 753 bars, identifying the corresponding minimum and maximum close price as 14.20 and 30.913 respectively.

WHA
For WHA the indicator does not recommend a representative analysis period nor the corresponding minimum and maximum close price, only the total number of bars of 192. I believe this omission is due to an issue with the Bullchart’s standard “if” and valuewhen functions. I have had a Bullcharts licence for nearly ten years and in all fairness I only noticed this issue in the last few months. One of my primary objectives was that this indicator would be consistent for any share. Without a recommendation for WHA the parameters I have selected by eye are 130 bars, 0.345 and 2.69 for minimum and maximum price.

Could you please let me know your computer clockspeed and operating system?
 

Attachments

Joined
Dec 13, 2017
Posts
3
Reactions
0
If I can start with two analogies which are not completely relevant.

In my opinion the results in any given week of a 45 ball lottery, and the order in which balls are selected, are completely independent from any one or all previous lotteries. Further within each game as each ball is selected the probability of the next ball to be selected is one divided by the total number of remaining balls which is completely independent irrespective of the balls which have already been selected.

If you are counting cards in a game of Blackjack the probability that the next card dealt will be of a particular value is the number of cards of that value which are still in the shoe divided by the total number of cards still in the shoe. If the shoe has been shuffled so that the cards are in a “random” order then the fact that it may have been “recently” or a “long time” since the last card of a particular value was dealt is completely irrelevant.

With that context any value for tomorrow’s (the next bar’s) closing price is statistically possible but some values are more probable than others. Whereas for Blackjack or a lottery where the next value is constrained by what is left in the shoe or still rattling around in the mouse cage there is no definite analogous restriction on the next price. If you agree with the above neither lottery nor Blackjack have a memory effect but some people consider that share charts do.

In my opinion the most significant price of the open, low, high and close of a bar is the closing price. During the currently ongoing development phase I have made some choices to simplify this formulation. If you have a different preference, at the cost of additional complexity, the high and low prices could be used for resistance and support level indicators respectively or Typical Price or Weighted Close Price could be substituted for the existing close price.

It is my guess that the statistical rule of thumb that the average of 30 price points or more in any given 4 percent histogram band will be representative holds. If I can reduce the response time it was my plan to review whether there is a noticeable improvement in accuracy by substituting forty equal histogram bands of 2.5 percent for the existing 25 bands of 4 percent. The human eye is marvellous for identifying patterns. My objective for this formulation was that it should be more accurate, more consistent, more responsive, faster and not subject to confirmation bias than hand drawn or EMA support and resistance levels.

This statistical formulation has no understanding of assigning more merit to any one candlestick pattern than to any other. As it currently uses only closing price there is no analysis of the significance of single bar (white, black, shadows) patterns. However this formulation will determine that a double bottom is more significant than a single low if;
a) the double bottom has more price points than the single low and each half of the double is of a similar pattern to the single low, and;
b) the two halves of the double are in rapid succession, and;
c) this pattern includes a significant number of points at a similar vertical level of the chart relative to the rest of the chart which has been chosen as representative.

However price points are clustered, whether they are;
a) a number of points with the exact same price, or;
b) many points in a narrow horizontal band, or;
c) several areas at similar levels re-occurring over time, or;
d) that the division between two histogram bands coincides with many points in a narrow horizontal band. This formulation consistently decays the significance of each price point in linear proportion with the age of each point. I accept that memory effect is plausible and linear time weighted average was the first I thought of and to my mind the easiest to calculate. Irrespective of a chart’s candle patterns, except that it is inherent in the vertical and horizontal clustering of close prices, the significance of each cluster of price points will be determined relative to the time weighted average of other point clusters in the chosen representative region on a chart. (I do believe candle patterns are strong signals and I do know that I have considered only Close here).

The probability that the next close price will fall within a nearby 4 percent band is the time weighted average of the historical incidence of prices within that band. The attached spreadsheet was intended for me to verify the indicator results and help me explain the math. As there is not a zigzag function in the Excel function library this spreadsheet very very roughly demonstrates that a rise in buying pressure is considered to push the resistance level to the next higher level and selling pressure that the support level will fall to the next lowest.

I am a broad brush type of person and it was my objective that this indicator should be a guideline for me as to the possible future price trajectory. I am looking at several other indicators as well, not only this in isolation. Ideally some of the development guesses I have made would be back tested but that is not realistic until I can at least improve the response time.
 

Attachments

tech/a

No Ordinary Duck
Joined
Oct 14, 2004
Posts
19,529
Reactions
3,886
By reason of your own logic
Every support and resistance and the resultant moves
Are just as independent as each other of similar length

I’d have thought that finding likely momentum and
Hopping on board would be easier than trying to predict it.

IE
Predicting a breakout is harder in my view than seeing one
The effort for a few ticks is again in my view not worth the effort.
 
Joined
Mar 5, 2008
Posts
951
Reactions
140
Again I find myself agreeing with Tech/A on TA matters.

But firstly most treat all support/resistance the same when it is clearly not!!
If a price has risen quickly, then takes a lot of time and effort to retrace fully back to support, it tends to be much stronger support than something that has risen slowly and fallen fast.
The break up from 'good support' (the first mentioned above) should be bought, as statistically it has a better performance than the latter. (IE Tech/A's seeing the breakout!!)

Any program that just tries to treat all support and resistance as the same will not throw out good numbers. It is basically a waste of time.
You will not find anything written in any book on this, but must find it for yourself.
 

tech/a

No Ordinary Duck
Joined
Oct 14, 2004
Posts
19,529
Reactions
3,886
You will not find anything written in any book on this, but must find it for yourself.

There is much written on theory and a little on long term experience.
The gems aren’t in books
They are in plain sight on the chart.
 
Top