I've spent hours trying to solve what I thought would be a simple problem and it's been giving me fits. And the problem is getting pivots to plot correctly on my charts. They either draw too many or too few pivot points.
I've tried the following indicators separately and tried merging some of the code into a new indicator, but the code is way above my head.
Swing High/Low does the best job of plotting pivots and I normally use a setting of Span = 4. Doing so gives me roughly the pivots of a 3 bar span.
The image below shows Swing (4) in combination with ZigZagUTC_Swing indicators with a Span setting of 3. I've circled the areas where the Swing indicator picks up pivots points when ZigZag does not. If I change the ZigZag span from a 3 setting to 2 it does a little better at times but makes some odd choices as well.
A friend of mine uses TradeStation and has better luck with pivots and he shared the following code with me.
if PivotHighVSBar( 1, Price, LeftStrength, RightStrength, RightStrength + 1 ) -1
then
begin
Plot1[RightStrength]( High[RightStrength], "PivotHi" ) ;
Alert ;
end
else
NoPlot( 1 ) ; { remove the marker }Try as I might I cannot translate this into Ninja.
My goal is to come up with one indicator that plots the pivots correctly, includes the pip count between each high and low pivot as in the image, and connects the high pivots with a line and the low pivots with a separate line. Cory was kind enough to modify ZigZagUTC_Swing to add a "TL" trend line and that code is attached. The trend lines are shown in the 2nd image as dotted lines (rays) extending beyond the current pivot points.
I'm hoping someone can give me some pointers or take a crack at coding this monster.