DYO: Pesavento Swing Colors


Q:  Can you help me change the colors of the lines at the swing prices when a new swing starts?

A:  See this solution which has a Pesavento Patterns study on the chart and 1 DYO.

 

 

The Pesavento Patterns study will move the current swing to higher highs, or lower lows as the current trend continues to develop.  Therefore, facts about the current trend do not indicate when a new trend starts.   Instead use the Line A Study Flag for Trend Change which will be True when the Pesavento Patterns trend changes direction.

GV[1] will be True when the trend changes, and will be the trigger to change the color.   Line C will shift a set of 3 GVs that hold prior swing prices.  Line D updates GV[30] with the swing price.   The content of GV[31] will the earlier swing price after a trend change does the GV shift.

Therefore, the swing prices in [30], [31], and [32] are the sequence of swing prices and can be plotted in different colors to represent their aging.  Line F is just a little trick to skip plotting the current swing price on Line G when a new swing point is made.  This keeps some of the clutter off the chart while a trend is developing.  Note the current swing price moves to higher highs in a developing up trend, and to lower lows in a developing down trend.

The cleverness of Line C to shift a GV set makes it easy to then color the swing prices with different colors each time a trend changes.


Last modified 8/8/08 1:14 PM