Repaints Harmonic Patterns Indicator for ThinkorSwim (ZigZag, Bat, Butterfly, ABCD)

Repaints
Hi HourseRider thank you for the script. How did you make yours look so clean, do you mind showing your settings for the script? My chart looks very different. And also can you share the volume wave script too? Sorry for asking so much this late, but thank you for the script!!
user inputs for show yes or no. I set them so it only shows Elliot ; however, all harmonics are based on Elliot :)
 

Volatility Trading Range

VTR is a momentum indicator that shows if a stock is overbought or oversold based on its Weekly and Monthly average volatility trading range.

Download the indicator

I dont beleive they do repaint? Still valid triangles depending on time frames I beleive valid for tick charts too. If I'm not mistaken the coordinates for plotting these re based off fibs?
 
Has anyone purchased and tested this code from the FunWithThinkScript site? Basically is it worth the rent payment price tag? I am asking becase I pucrchaed a code for about $150 couple years ago and it was a bit over advertised and the Harmonic Patterns; "Butterfly" specifically is a bit tough to code on my own. Can anyone vouch for this code? And were you able to see it working on your TOS platform? I already checked the available Free Harmonic patterns on this site but I am only intrested in Bullish setups and find it difficult to turn off or reverse engineer all the other setups from the given script.
 
Has anyone purchased and tested this code from the FunWithThinkScript site? Basically is it worth the rent payment price tag? I am asking becase I pucrchaed a code for about $150 couple years ago and it was a bit over advertised and the Harmonic Patterns; "Butterfly" specifically is a bit tough to code on my own. Can anyone vouch for this code? And were you able to see it working on your TOS platform? I already checked the available Free Harmonic patterns on this site but I am only intrested in Bullish setups and find it difficult to turn off or reverse engineer all the other setups from the given script.
Harmonic patterns alone won’t get you anywhere without well defined trade rules - like keys to car without knowing where the key goes. Scott Carney made harmonics marketable”, but don’t ask him about his portfolio:) . Most people believe he just marketed Bryce Gilmore’s (thank him for the butterfly and one2one patterns). All his stuff is free online. It took me an entire year to work through. If you use his guidance and focus on the DOW, yes. DIS responds well to psychological levels for reason :). At some point, I wouldn’t mind working with RP though. Would be interesting to insert those rules :)
 
Harmonic patterns alone won’t get you anywhere without well defined trade rules - like keys to car without knowing where the key goes. Scott Carney made harmonics marketable”, but don’t ask him about his portfolio:) . Most people believe he just marketed Bryce Gilmore’s (thank him for the butterfly and one2one patterns). All his stuff is free online. It took me an entire year to work through. If you use his guidance and focus on the DOW, yes. DIS responds well to psychological levels for reason :). At some point, I wouldn’t mind working with RP though. Would be interesting to insert those rules :)
I included the harmonic waves pattern as a script it will plot major/minor lines it seemed like a good option. Choose stocks with high liquidity stocks that are popular and known to be in demand like apple for instance, Buy/Sell at or near tops/bottoms using the indicators provided. Watch and different stocks react and use different times to show weakness/strength. For instance if the indicators are turned down on say a 15 min chart then go lower is their strength and direction then on lower time frames if not odds are the 15 min shows the direction for movement. I myself have spent 12 months searching. Most important to help choose your entry direction check the markets I would not buy apple calls unless I see better than good odds the spx,spy ect. I watch the spy if it is dropping I wait for its bottom to buy apple.
 
Last edited:
I included the harmonic waves pattern as a script it will plot major/minor lines it seemed like a good option. Choose stocks with high liquidity stocks that are popular and known to be in demand like apple for instance, Buy/Sell at or near tops/bottoms using the indicators provided. Watch and different stocks react and use different times to show weakness/strength. For instance if the indicators are turned down on say a 15 min chart then go lower is their strength and direction then on lower time frames if not odds are the 15 min shows the direction for movement. I myself have spent 12 months searching. Most important to help choose your entry direction check the markets I would not buy apple calls unless I see better than good odds the spx,spy ect. I watch the spy if it is dropping I wait for its bottom to buy apple.
That’s great you found a use. But the rules I was referencing have 8 different entry rules and each one has 2-3 or 4 different scenarios. Some include fib levels for price and time, others stochastics and fib levels for price and time, etc. One even uses a time fib level for a price swing as far back as the last the 10th.
 
That’s great you found a use. But the rules I was referencing have 8 different entry rules and each one has 2-3 or 4 different scenarios. Some include fib levels for price and time, others stochastics and fib levels for price and time, etc. One even uses a time fib level for a price swing as far back as the last the 10th.
I watch fibs to the next levels too I also watch the swing high/lo lines those are very important stocks always well seemingly will retests the high and lo of the day. So if a stock shows strength and say moving up it will tests the next fib level. fib levels hold both buyers and sellers.
 
@Playstation

Haha, yea I was pretty excited to find them. Can’t wait to see how this forum adds to and betters them.

One thing I noticed is sometime it will paint several different patterns over each other. This can be seen if you notice more than one label over a pattern. For instance two “A.”

Also for the mobile version I turn off the “prz...” lines and turn on “target zones” and it looks good.
 
unfortunately, the patterns do repaint, and will adjust or disappear if price breaches a certain level that causes the patterns to not be accurate.
As expected, but hope you guys understand how harmonics work, don't use it blindly, but it's certainly extremely useful.
 
@wen, the target zones appear to be based on fib levels to indicate potential zones to consider taking some profits off the table.

@Ken_Adams, it looks like the PRZmax and PRZmin are designated limits of the Potential Reversal Zone. The max appears to be the area where if exceeded, the pattern may no longer be valid. The min looks to be the area where price must reach at minimum to complete a valid pattern. Of course I didn't write the code so I can't say for sure, but that's my impression after playing with it for a bit. THANK YOU for posting these codes!

@Playstation, agree this is very useful but must be considered with overall price action in view, not traded blindly.
 
@Ken_Adams this some really good coding, but some of it looks familiar. This misses a few times, but it's not easy to rotate pivots into a perfect ZZ. thanks for the share.
 
@Ken_Adams Thanks so much for this. I've traded patterns since working with Larry Pesavento in 1998. I used to use Ensign software which had them built in. I wish they had given codes for the 3 and 5 drives. Butterfly is my absolute favorite as you can tell by my pic. :)

Tenacity,
Copy and replace the code below for 3 drives. I modified it, but just take "-tol” and “+tol" out should you not find it useful. Depending on the script, 5 Drives is not needed as it is quite common for 3 drives to form into 5. This was my experience from back tests and input from professional pattern traders.

Additionally, the Cypher structure is below as another asked. Personally, Cypher and Crab require a lot less technical analysis so I get real interested when they occur on an hourly or daily chart.

Hope your focusing on trading failed patterns since 60% of all harmonic patterns fail :)

Code:
#McDon030 4/23/2020
#Larry Pes added tolerance for choppy markets - default is .04 and no more than .07 for choppy markets. Additions && notes are:
## order should be XAB,ABC,BCD,XAD and ABCD
## 3drives
def hf0 = 1.130-tol;  ##XAB1
def hf1 = 1.618+tol;  ##XAB2
def hf2 = 0.500-tol;  ##ABC1
def hf3 = 0.786+tol;  ##ABC2
def hf4 = 1.000;      ##ABCD1   #note: should be a second ABCD in PRZ as this is ABCD1 and ABCD2==1.27
def hf5 = 1.270-tol;  ##XAD1
def hf6 = 2.618+tol;  ##XAD2
def hf7 = 1.130-tol;  ##BCD1
def hf8 = 1.618+ tol; ##BCD2


## Cypher
def hf0 = 0.382-tol;  ##XAB1
def hf1 = 0.618+tol;  ##XAB2
def hf2 = 1.130-tol;  ##ABC1
def hf3 = 1.414+tol;  ##ABC2
def hf4 = 1.000;      ##ABCD1   #note: should be a second ABCD in PRZ as this is ABCD1 and ABCD2==1.27
def hf5 = 0.786-tol;  ##XAD1
def hf6 = 0.786+tol;  ##XAD2
def hf7 = 1.272-tol;  ##BCD1
def hf8 = 2.000+ tol; ##BCD2
:)

-Mcdon030
 
after a good amount of old fashioned fiddling, I got it:

Code:
# HarmonicsAndFractals ABCD Only
# name by JQ
#hint select either showpatterns or gilmores to declutter.

#---------------------------------------#
#===== Irregular fractals function =====#
#---------------------------------------#
###### mcdon030 addded tolerance per Larry Pesavento and 19 more patterns
###### mcdon030 7 more patterns, elliot waves, head and shoulders and bg 90% reversal
###### notes: DUST ETF daily confluence wave4 and hns

script isRegularFractal {
    input mode = 0;
    plot ret = if mode == 1 then high[4] < high[3] and high[3] < high[2] and high[2] > high[1] and high[1] > high[0] else if mode == -1 then low[4] > low[3] and low[3] > low[2] and low[2] < low[1] and low[1] < low[0] else 0;
}
#---------------------------------------#
#===== BWilliams fractals function =====#
#---------------------------------------#
script isBWFractal {
    input mode = 0;
    plot ret = if mode == 1 then high[4] < high[2] and high[3] <= high[2] and high[2] >= high[1] and high[2] > high[0] else if mode == -1 then low[4] > low[2] and low[3] >= low[2] and low[2] <= low[1] and low[2] < low[0] else 0;
}

input showgilmore = Yes;
input showPatterns = Yes;
input showBarColors = No;
input filterBW = No;
input ShowHHLL = No;
input ShowTimeFractals1 = No;
input showArrows = No;
input tolerance = .06;
input timeframe1 = {MIN, TWO_MIN, THREE_MIN, FOUR_MIN, FIVE_MIN, TEN_MIN, FIFTEEN_MIN, TWENTY_MIN, THIRTY_MIN, HOUR, TWO_HOURS, FOUR_HOURS, default DAY, TWO_DAYS, THREE_DAYS, FOUR_DAYS, WEEK, MONTH, OPT_EXP};
input showchannel1 = No;
input showchannel2 = No;
input showchannel3 = No;
input showZigZag = Yes;
def bn = BarNumber();
def h2 = high[2];
def l2 = low[2];
def filteredtopf = if filterBW then isRegularFractal(1) else isBWFractal(1);
def filteredbotf = if filterBW then isRegularFractal(-1) else isBWFractal(-1);
plot TopFractals = filteredtopf[-2];
plot BottomFractals = filteredbotf[-2];
TopFractals.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
TopFractals.SetDefaultColor(Color.RED);
BottomFractals.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
BottomFractals.SetDefaultColor(Color.GREEN );
def b1_0 = if bn == 0 then -1 else if filteredtopf == 0 then 0 else if b1_0[1] > -1 then b1_0[1] + 1 else -1;
def b1_1 = b1_0 + GetValue(b1_0, b1_0 + 1, 0) + 1;
def b1_2 = b1_1 + GetValue(b1_0, b1_1 + 1, 0) + 1;
def b2_0 = if bn == 0 then -1 else if filteredbotf == 0 then 0 else if b2_0[1] > -1 then b2_0[1] + 1 else -1;
def b2_1 = b2_0 + GetValue(b2_0, b2_0 + 1, 0) + 1;
def b2_2 = b2_1 + GetValue(b2_0, b1_1 + 1, 0) + 1;
def higherhigh = if filteredtopf == 0 or b1_2 == b1_1 then 0 else GetValue(high[2], b1_1, 0) < GetValue(high[2], b1_0, 0) and GetValue(high[2], b1_2, 0) < GetValue(high[2], b1_0, 0);
def lowerhigh = if filteredtopf == 0 or b1_2 == b1_1 then 0 else GetValue(high[2], b1_1, 0) > GetValue(high[2], b1_0, 0) and GetValue(high[2], b1_2, 0) > GetValue(high[2], b1_0, 0);
def higherlow = if filteredbotf == 0 or b2_2 == b2_1 then 0 else GetValue(low[2], b2_1, 0) < GetValue(low[2], b2_0, 0) and GetValue(low[2], b2_2, 0) < GetValue(low[2], b2_0, 0);
def lowerlow = if filteredbotf == 0 or b2_2 == b2_1 then 0 else GetValue(low[2], b2_1, 0) > GetValue(low[2], b2_0, 0) and GetValue(low[2], b2_2, 0) > GetValue(low[2], b2_0, 0);
AddChartBubble(ShowHHLL and higherhigh, high[-2], "[HH]", Color.CYAN, yes);
AddChartBubble(ShowHHLL and lowerhigh, high[-2], "[LH]", Color.CYAN, yes);
AddChartBubble(ShowHHLL and higherlow, low[-2], "[HL]", Color.GREEN);
AddChartBubble(ShowHHLL and lowerlow, low[-2], "[LL]", Color.GREEN);
def hh = if bn == 0 then -1 else if higherhigh == 1 then 0 else if hh[1] > -1 then hh[1] + 1 else -1;
def ll = if bn == 0 then -1 else if lowerlow == 1 then 0 else if ll[1] > -1 then ll[1] + 1 else -1;
def higherhhigh = if higherhigh == 0 or hh == -1 then 0 else GetValue(high[2], hh, 0) >= high(period = timeframe1) ;
def lowerllow = if lowerlow == 0 or ll == -1 then 0 else GetValue(low[2], ll, 0) <= low(period = timeframe1);
AddChartBubble(ShowTimeFractals1 and higherhhigh , high[-2], "[TL]", Color.GREEN, yes);
AddChartBubble(ShowTimeFractals1 and lowerllow, low[-2], "[TL]", Color.GREEN);
plot TopChannel1 = if showchannel1 and filteredtopf then h2[-2] else Double.NaN;
plot BottomChannel1 = if showchannel1 and filteredbotf then l2[-2] else Double.NaN;
TopChannel1.SetDefaultColor(Color.GREEN);
BottomChannel1.SetDefaultColor(Color.RED);
TopChannel1.EnableApproximation();
BottomChannel1.EnableApproximation();
plot TopChannel2 = if showchannel2 and higherhigh then h2[-2] else Double.NaN;
plot BottomChannel2 = if showchannel2 and lowerlow then l2[-2] else Double.NaN;
TopChannel2.SetDefaultColor(Color.BLUE);
BottomChannel2.SetDefaultColor(Color.BLUE);
TopChannel2.EnableApproximation();
BottomChannel2.EnableApproximation();
plot TopChannel3 = if showchannel3 and higherhhigh then h2[-2] else Double.NaN;
plot BottomChannel3 = if showchannel3 and lowerllow then l2[-2] else Double.NaN;
TopChannel3.SetDefaultColor(Color.VIOLET);
BottomChannel3.SetDefaultColor(Color.VIOLET);
TopChannel3.EnableApproximation();
BottomChannel3.EnableApproximation();
AddCloud(TopChannel3, BottomChannel3, Color.GREEN, Color.RED);
def istop = if ShowTimeFractals1 then (if higherhhigh  then 1 else 0) else (if filteredtopf then 1 else 0);
def isbot = if ShowTimeFractals1 then (if lowerllow then 1 else 0) else (if filteredbotf then 1 else 0);
def topcount0 = if istop then bn else topcount0[1];
def botcount0 = if isbot then bn else botcount0[1];
def topcount = bn - topcount0;
def botcount = bn - botcount0;
def zigzag = if istop and topcount[1] > botcount[1] then h2 else if isbot and topcount[1] < botcount[1] then l2 else Double.NaN;
##def zigzag = if istop and topcount[1] > botcount[1] && istop>isbot[1] then h2 else if isbot and topcount[1] < botcount[1] && isbot<istop[1] then l2 else Double.NaN;

plot zz = if showZigZag then zigzag[-2] else Double.NaN;
zz.SetDefaultColor(Color.WHITE);
zz.EnableApproximation();
AssignPriceColor(if showBarColors and IsNaN(zigzag) == 0 then (if h2 == zigzag then Color.BLUE else if l2 == zigzag then Color.CYAN else Color.CURRENT) else Color.CURRENT);
def z_0 = if bn == 0 then -1 else if IsNaN(zigzag) == 0 then 0 else if z_0[1] > -1 then z_0[1] + 1 else -1;
def z_1 = z_0 + GetValue(z_0, z_0 + 1, 0) + 1;
def z_2 = z_1 + GetValue(z_0, z_1 + 1, 0) + 1;
def z_3 = z_2 + GetValue(z_0, z_2 + 1, 0) + 1;
def z_4 = z_3 + GetValue(z_0, z_3 + 1, 0) + 1;
def z_5 = z_4 + GetValue(z_0, z_4 + 1, 0) + 1;
def z_6= z_5 + GetValue(z_0, z_5+ 1, 0) + 1;
def z_7 = z_6 + GetValue(z_0, z_6 + 1, 0) + 1;
def z_8 = z_7+ GetValue(z_0, z_7 + 1, 0) + 1;
def z_9 = z_8+ GetValue(z_0, z_8 + 1, 0) + 1;

#======= Preparing the XABCD Patterns =======#
def x1_ = GetValue(zigzag, z_5, 0);   #mcdon
def x = GetValue(zigzag, z_4, 0);
def a = GetValue(zigzag, z_3, 0);
def b = GetValue(zigzag, z_2, 0);
def c = GetValue(zigzag, z_1, 0);
def d = GetValue(zigzag, z_0, 0);

#====== Combination to create the patterns ======#
def xab = (AbsValue(b - a) / AbsValue(x - a));
def xad = (AbsValue(a - d) / AbsValue(x - a));
def abc = (AbsValue(b - c) / AbsValue(a - b));
def bcd = (AbsValue(c - d) / AbsValue(b - c));
def xabc = (AbsValue(b - c) / AbsValue(x - a));

################ mcdons additions
def x1xcd = (AbsValue(d - c) / AbsValue(x1_ - x));## wave5
def x1xab = (AbsValue(b - a) / AbsValue(x1_ - x));## wave3
def x1xxa = (AbsValue(x - a) / AbsValue(x1_ - x));## wave2
def xabbxd = (AbsValue(bcd ) / AbsValue(xab));
def dcxab = (AbsValue(xab) / AbsValue(bcd ));
def xababc = (AbsValue(xab) / AbsValue(abc));
### time measures
def currentBar = HighestAll(if   !IsNaN(c)
                            then bn
                            else double.nan);
def cp2 = if  a then currentBar-bn else cp2[1];
def cp3 = if  b then currentBar-bn else cp3[1];
def cp4 = if c  then currentBar-bn else cp4[1];
def cp5 = if d then currentBar-bn else cp5[1];
def tp3u =if b then currentBar-cp2  else tp3u[1];
def tp4u =  if c then currentBar-cp3 else tp4u[1] ;
def tp5u = if d then currentBar-cp4 else tp5u[1] ;
def tp25u =  if d then currentBar-cp2 else tp25u [1] ;

#===== Checking to see if there is a pattern functions =====#

#---------------------------------------#
#======== ABCD Pattern Function ========#
#---------------------------------------#
script isABCD {
    input _mode = 0;
    input abc = 0;
    input bcd = 0;
    input d = 0;
    input c = 0;
    def _abc = abc >= 0.382 and abc <= 0.886;
    def _bcd = bcd >= 1.13 and bcd <= 2.618;
    plot ret = _abc and _bcd and (if _mode == 1 then d < c else d > c);
}

#--------------------------------------------------#
#===== ABCD Reciprocal Harmonic Pattern Function =====#
#--------------------------------------------------#
script isABCDR {
    input _mode = 0;
    input abc = 0;
    input bcd = 0;
    input d = 0;
    input c = 0;
    def _abc = abc >= 1.13 and abc <= 0.786;
    def _bcd = bcd >= .382 and bcd <= .886;
    plot ret = _abc and _bcd and (if _mode == 1 then d < c else d > c);
}

######
#bears
######
def u_abcd1 = showPatterns and isABCD(-1, abc, bcd, d, c) and isABCD(-1, abc, bcd, d, c)[1] == 0;
AddChartBubble(u_abcd1[-2] , high, "Bear ABCD", Color.RED, yes);

######
#bulls
######
def u_abcd2 = showPatterns and isABCD(1, abc, bcd, d, c) and isABCD(1, abc, bcd, d, c)[1] == 0;
AddChartBubble(u_abcd2[-2] , low, "Bull ABCD", Color.GREEN, no);

#============ End Syracusepro Harmonics and Fractals ============#

If you want just the bear or bull, simply comment out or remove either

AddChartBubble(u_abcd1[-2] , high, "Bear ABCD", Color.RED, yes);
AddChartBubble(u_abcd2[-2] , low, "Bull ABCD", Color.GREEN, no);

probably needs some cleaning up to remove unnecessary code, but, it seems to work as an ABCD-only script for now.
 

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
239 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top