Login Page - Create Account

Support Board


Date/Time: Fri, 26 Apr 2024 03:59:45 +0000



[Programming Help] - Zig Zag HH,LH,LL,HL formula?

View Count: 3837

[2018-12-14 13:14:17]
User164231 - Posts: 278
Hi, I apply zigzag study to indicator to capture the HH,LH,LL,HL. Is there a way to use color background alert to capture these 4 values and compare against the main graph prices? This is an easy way to detect divergence.
[2018-12-14 18:30:06]
Sierra Chart Engineering - Posts: 104368
Yes. There is a study Subgraph which contains values for those. This is explained here:
Zig Zag: Text Labels Subgraph Description
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2018-12-14 18:30:41
[2018-12-15 14:55:05]
User164231 - Posts: 278
Thanks but I get the idea that it stops at; ID1.SG2 where SG2 is the subgraph for for text labels. How to add these number value when using Color background alert;

LH (Lower High) = 1
HH (Higher High) = 2
HL (Higher Low) = 3
LL (Lower Low) = 4

Currently this is what I used but not working as it should; =AND(ID33.SG2>ID33.SG2,C>C[-6])
Date Time Of Last Edit: 2018-12-15 15:32:17
imageDivergence Detector.jpg / V - Attached On 2018-12-15 15:31:25 UTC - Size: 89.28 KB - 940 views
[2018-12-15 17:10:03]
Sawtooth - Posts: 3976
What you want to do is much too complex for a Simple Alert formula.
It could be done with a spreadsheet study, but it's not as easy as you might think.
It is a huge advantage to use the ZZ study because it marks where to look for a divergence, but there are other considerations.

Coding it on a spreadsheet would require creating persistent variables of the ZZ value and H/L prices at the Text Label locations.
-Then you'd need to use formulas like these to find the previous occurrences:
Spreadsheet Example Formulas and Usage: Return Last Two Zig Zag Reversal Values
-Then you'd need to subtract the two prices and the two ZZ values to see if there was a difference in direction.
-And even this wouldn't find the divergence in your example because both are downsloped.
-Now you'd need to establish parameters for differences when the slopes are in the same direction, and for how much difference should be considered if the slopes are in the opposite direction.
-And this would still miss some divergences you see with your eye, or find some that you didn't want to consider.

There are divergence detector studies out there, but they will have the same limitations:
Divergence Detector Study with lines

Detecting divergence is difficult to do with an algo. It's more of an art than a science.
[2018-12-15 17:32:54]
User164231 - Posts: 278
Thanks Tom, I have looked into others but it is not what I want.

IMO the hardest part is to identify the most recent swing highs and lows of an oscillator/indicator, which the ZZ has effectively picked up. We are now left with the easy part of creating another study/code to reference against respective main graph candle for divergences. Hopefully one day you and/or some good coders could find the last jigsaw puzzle.

Thanks anyway for the reply. Much appreciated.
Date Time Of Last Edit: 2018-12-16 04:41:13
[2018-12-15 22:57:26]
Sierra Chart Engineering - Posts: 104368
Assuming the zigzag study has an ID of 1, to detect a Higher High at a particular chart bar you would use:
ID1.SG2 = 2
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-12-16 07:01:19]
User164231 - Posts: 278
Hi, thanks for the heads up. My first step is to identify an angle of two reference points; say the LL of my attached image. Hence;
=AND(ID1.SG2=4>ID1.SG2=4). I also tried =AND(ID1.SG2=4>ID1.SG2=4[-1]), what did I do wrong?

2nd step is how to reference against the respective Main Price Graph bar close of each LL of stoch oscillator?
Date Time Of Last Edit: 2018-12-16 07:01:53

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account