@majidg I will after I finish and clean it up, right now it's a mess of debug bubbles and vague variable names.
@TNTrader5159 yeah, got that working too.
Look at the bubbles again, it's already done.
Wow this is amazing! So you have included the depreciation factor that takes pivots from Initial Strength to End Strength?
<p>
The pivots that retain their Initial Strength value I call Primary Pivots. Once they begin to be depreciated, I call them Secondary Pivots.
<p>
I have a pivot depreciating by half a bar every time a bar crosses it for the first time. For example, a low pivot is crossed to the downside until up to half its value as
support is lost. If the market goes up with only part of that value having been lost, it retains that remainder of its
support value should the market turn back down.
<p>
I have tweaked this to add bars that straddle the pivot price as the percentage of the bar height below it * 0.5. Bars completely below the low pivot price are counted as 0.5 until the Initial Strength value is depreciated by half, at which time the pivot's
support value is lost. From there it takes on half the Initial Strength value as
resistance to any future upward price movement. If/when the original low pivot point is crossed to the upside, it depreciates from its remaining value again at the rate of half a bar for every bar above it, with bars straddling the original low pivot level counted as the percentage of the bar's height above that pivot level. The remainder of the pivot's
resistance value is then depreciated until such time as the End Strength value is 0 and goes "off the board" forever.
<p>
So these pivots, once formed in their Initial Strength value, are dynamic and to be calculated as described above for reckoning as support or resistance for/to future price movement and trading activity.
<p>
I use the term "Impedance" to generically refer to either support or resistance and term the Initial Strength value on through such time as it goes "off the board" as a pivot's Impedance Factor.
<p>
I call the pivots Peaks and Valleys, and each of those are either Primary or Secondary. We are using a threshhold of 3 for minimum trade pattern strength, so really any pivot with a value less than 3 should be rendered as 0.
<p>
The whole idea behind this is that the degree to which a pivot turned price action one way or the other is its theoretical value in supporting or resisting future price movement that challenges it. The lesser side determines this value. If, for instance, a high pivot has 100 bars to the left and only 3 to the right, it's nearly a smooth line of declination so to speak that's only worth the 3 bars that interrupted what would have been a steady decline.
<p>
There is one more factor in valuing a pivot's strength expressed in bars, but ONLY as it relates to a pattern that launched a trade to challenge it. That would be factored into the trading rules that set exit points potentially based upon the locations and values of these pivots. I will go into that later.
<p>
The only other form of impedance (support/resistance) to consider in like manner aand along with these pivot values is what I call the Price Density Index or PDI for short. It measures the values within any price congestion zones that would stop a trade like a pivot would. It is actually simpler to calculate than the pivots and is not subject to depreciation as are pivots.
<p>
Blessings be upon you, Svanoy, for the great work you are doing, and do share your source code with us!