Scripting Fidelity's Cup with Handle
Author: arthur1
Creation Date: 8/14/2009 7:44 AM
profile picture

arthur1

#1
I need some help on a script. I am not a programer and have tried to work out something in wealth - lab 5.4, but have been unable. This may not work but here goes!
I use Fidelity ATP and I like the Cup with Handle indicator. There are a number of stocks with this indicator recently, but I am usually late in seeing them. I have back tested an old script on wealth lab 4 in the past, but it does not work as often as Fidelity’s indicator. I have Wealth-Lab 5.4 currently but I can’t figure out how to write the script. I found an old Fidelity ATP charting indicator definitions manual for version 5.1 I had. This is the Cup with handle interpretation and Calculation from that manual.

Interpretation.
Base should occur over at least 8 weeks but can last a year or longer.
The stock corrects 12-30% from its peak (left side of the cup), but can correct as much as 50%.
Handle is the shakeout period. Handle lasts at least a week and drifts downward 10 – 15% in normal markets but can drift as much as 20-30% in severe markets. Handle should drift sideways or preferably downward and volume should dry up during this period.
Handle should occur in the upper half of the cup, preferably starting within 15% of the previous high (left side of the cup). The handle should also form above the stock’s 200-day moving average, but not always.
The pivot point or buy point occurs when the stock breaks out or moves upward through the old point of resistance (right side of the cup). This breakout should occur on at least a 50-60% increase. Note ATP displays Cup with handle regardless of a breakout. This is done to display as many Cup patterns as possible.

Calculation
The lift and right lips of the cup portion must be high pivot points. That is, the high prices on those days must be higher than the five previous and following high prices.
The difference between the high prices on the lips be no more than 10% different than their average price.
The number of periods (i.e. days) between the lips must be greater than or equal to 8 or less-than or equal to 100.
The lowest low within the cup must be a least 50% (I believe this could be lower, maybe 12% like in the Interpretation section. How to change this value to test different lows?) of the average high price of the lips. The highest high within the cup must be less than 110% of the average high price of the lips.
The slope of a least - squares fit to the 8 prices (average of high and low) prior to the cup be above .005 times the average price of the lips. This means that each of the preceding 8 prices increases, on average .5% of the average lip price.
The R squared of the least – squares fit to the 8 prices must be at least .5. This means that the prices must form a reasonably identifiable trend.
The handle ends with the next price after the cup that is equal to or greater than the average lip price. The length of the handle must be at least .1 times the width of the cup and less than 2 times the width of the cup.
A parabola fit to the prices within the cup portion must have a minimum value that is at most 90% of the average lip price.
If any cup pattern overlaps another, the longer of the two is preserved and the shorter is eliminated.

If anyone can write this script or explain how to, it would greatly help.

profile picture

Cone

#2
Looking back it's a pretty cool "indicator", but if it uses ATP pivots, then it's only good for looking back, it cannot be detected in real-time; so it's no use in a Wealth-Lab Strategy.

I think we have a different cup and handle script for Version 4, and if we do, I'll add it to the scripts that we'll provide in the initial batch of Strategy Downloads for Version 5.5.
profile picture

arthur1

#3
I believe the ATP pivots are only used to located the lips of the cup. The actual trade is placed when the handle ends which is after the cup lips have been determined.
Fidelity's Pivot Point Description (from Active Trader Pro version 5.1)
Pivot Points are used to show the potential reversal in chart patterns. Points are displayed based on a new high or low resulting from the previous and/or 5 periods.
Interpretation
11 bars are needed to form the pivot point.
the 6th bar of the eleven has a high (or low) price that is greater (or less) than all other 10 bars. (This will then plot an image on the tip of each line or bar).
Therefore, the trade would take place at least six days after the pivot is found. These are the descriptions from an old version of ATP. I know that in the current ATP it will locate a pivot point on a chart the day after it happens!
Thanks for looking.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).