Login Page - Create Account

Support Board


Date/Time: Sun, 06 Oct 2024 13:21:06 +0000



[User Discussion] - Average of ZigZag Length

View Count: 5785

[2017-06-11 20:56:51]
User150371 - Posts: 70
I would like to calculate the average length of zigzags on a chart. I want a separate average for up and down zigzags.
Is this possible ?
Thanks.
[2017-06-13 05:32:00]
Sierra Chart Engineering - Posts: 104368
Yes this is possible and we will prepare a Study Collection to do this.
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
[2017-06-13 10:32:22]
User150371 - Posts: 70
To give an idea of what I'm trying to create, here is a snapshot from a presentation I saw. The main chart shows the zigzags, and the lower chart regions show separate charts for upward and downward zigzags, and each has a Volume Profile of the lengths. This is an easy visual way to assess what is a " normal" versus an " extreme" zigzag for either direction.
imageZig Zag Profile.png / V - Attached On 2017-06-13 10:20:34 UTC - Size: 280.94 KB - 971 views
[2017-06-14 01:46:04]
User19165 - Posts: 346
+1

I was just going to do a request for guidance post on how I could do this today!
[2017-06-14 19:25:20]
Sierra Chart Engineering - Posts: 104368
This is not a perfect implementation but we have attached a Study Collection which calculates a Moving Average of the Zig Zag study Length Subgraph.

This actually has a dependency on a release which we have not yet made but will make later today. We had to make a small correction to Moving Average-Simple Skip Zeros for this to work properly.

Refer to the documentation here to use it:
http://www.sierrachart.com/index.php?page=doc/UsingAdvancedCustomStudies.php#UsingStudyCollection
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: 2017-06-14 19:25:39
attachmentZigZagAverageLength.StdyCollct - Attached On 2017-06-14 19:22:22 UTC - Size: 18.7 KB - 554 views
[2017-06-19 23:32:32]
User150371 - Posts: 70
Is this Study Collection working as intended ? I have tired it using different settings but the results are confusing. It seems to be assigning a negative value to downward rotations, so that the Moving Average is often around zero, as upward and downward lengths cancel each other out. I am using Version 1571.
[2017-06-20 18:42:13]
Sierra Chart Engineering - Posts: 104368
It seems to be assigning a negative value to downward rotations
Yes or no?

The Study Collection is very simplified. It is not really designed to do the extent of what you are looking for.

Provide an image of the chart or Trade DOM, by following these instructions:
https://www.sierrachart.com/index.php?page=doc/PostingInformation.php#Image
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: 2017-06-20 18:43:26
[2017-06-21 09:52:54]
Neo - Posts: 198
The Zigzag line length implementation is correct, you can visually replicate +/- swing movements from the picture posted, as shown by the green/ red squares, and horizontal profile ( see pic)
- This can all be shown in 1 chart region. however, the horizontal profile will only show visable chart bars, and not all bars loaded on the chart.

@ SC Engineering: The moving average implementation looks wrong.
-You need 2 x moving average studies- 1x moving average that ignores chart bars on the lookback and only calculates on subgraph values > 0, and 1 x moving average that ignores chart bars on the look back and only calculates on subgraph values <0.

Then if you wanted to measure "normal" versus an "extreme" zigzag length in either direction, you would do a comparison of the CurrentSubgrpah/ AverageSubgrpah.
Date Time Of Last Edit: 2017-06-21 09:53:24
imagezz length.png / V - Attached On 2017-06-21 09:49:23 UTC - Size: 67.05 KB - 694 views
[2017-06-22 05:07:37]
Sierra Chart Engineering - Posts: 104368
This is something we will not get involved with. We are leaving this discussion and marking it as a User Discussion.

We should of stayed out of it to begin with.
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
[2017-06-23 00:30:08]
Neo - Posts: 198
Can you please post the source code for the ZZ study with the line length subgraph.
[2017-06-24 19:15:46]
Sawtooth - Posts: 4093
I would like to calculate the average length of zigzags on a chart. I want a separate average for up and down zigzags.
Is this possible ?
Thanks.

Here is a custom spreadsheet study that will do this:
http://www.sawtoothtrade.com/free-stuff-15.html
[2017-10-06 03:08:19]
Kiwi - Posts: 375
I am going to do something like this as a dll for a friend so will publish here.

It will do a moving average of swing sizes (you set as per normal zz) and also the std deviation so you get +/- stdev bands like a bollinger band. Input will be number of swings & multipliers for the stdev bands.
Date Time Of Last Edit: 2017-10-06 03:19:57
[2017-10-06 04:11:01]
Neo - Posts: 198
I have 2x ACSIL generic moving average studies that:

Only calculates based on subgraph values > 0, and skips/ ignores values ≤ 0
//
Only Calculates based on subgraph values < 0, and skips/ ignores values ≥ 0

This allows you to compare the current +/- swing vs their average over the last x swings

Let me know if anyone wants to use them and i'll post the dlls also.
[2017-10-06 07:49:18]
Kiwi - Posts: 375
Not sure exactly what you're asking 40 winks .... here is the current version.

Save the dll and the study collection in your data directory. You'll then find it in your analysis menu. It puts two copies of the function on your chart, one to show the zig zag in region one, the other to show the avg and stdev bands in region 2. At the beginning of each of the band plots you can find the values plotted one bar at a time but they are then also posted below each zig zag extreme so you can see them as they change.

In the code (cpp) you'll find a section labelled //** kiwis addition **//

--

Edited to remove the old stdycollct & code.

See the post below for the latest version of the dll and study collection (don't use this one).



http://storage2.static.itmages.com/i/17/1006/h_1507276145_5994585_22f01d5a3d.png
Date Time Of Last Edit: 2017-10-08 22:10:17
Private File
Private File
[2017-10-06 11:41:07]
U_winks - Posts: 190
Hi Kiwi, please ignore my request. Thanks again for posting the indicator and study collection!
[2017-10-06 20:27:04]
apollofl - Posts: 95
Receiving error code 126, specified module can't be found.
[2017-10-06 23:53:39]
U_winks - Posts: 190
Hi apollofl, did you compile the cpp file first?

Kiwi placed the cpp file, not the dll file.

Here's the dll file below.
attachmentaTmp.dll - Attached On 2017-10-06 23:50:32 UTC - Size: 836 KB - 517 views
[2017-10-07 00:58:21]
apollofl - Posts: 95
Got it

Thanks
[2017-10-08 21:55:38]
Kiwi - Posts: 375
Sorry. I thought I'd pasted the dll onto the board and then didn't check. Thanks for compiling it 40Winks - hope it does what you needed.

I came up with a simpler version of the study collection. This one lets the zigzag function write the 3 lines in subgraph 1 and uses the Study Subgraph Add function from the analysis menu to add the zig zag to subgraph 0 (on price).

This means you can use the study collection and only change the zig zag parameters in one place. So here it is.

Edit: The earlier dll and the cpp have sc.FreeDLL set to 1 (debug mode). Here is a version of the dll with it set to zero which is more efficient. So I'd suggest updating your copy of the dll (assuming 40 Winks didnt change the code).
Date Time Of Last Edit: 2017-10-08 22:07:17
attachmentzz plus deviations.StdyCollct - Attached On 2017-10-08 21:54:13 UTC - Size: 18.7 KB - 526 views
attachmentaTmp.dll - Attached On 2017-10-08 22:06:35 UTC - Size: 836.5 KB - 632 views
attachmentaTmp.cpp - Attached On 2017-10-08 22:06:47 UTC - Size: 28.56 KB - 598 views
[2017-10-10 07:23:01]
U_winks - Posts: 190
Thanks for the update, Kiwi!

(Nope, I didn't change anything in the previous code.. it definitely won't compile if I'd ever tried to.. Haha.. )
[2020-08-12 10:09:32]
User350416 - Posts: 43
Hi Kiwi,

I know this post is a little bit old, but I wanted to use your zig zig study and I dont know how to install this in SC.
I downloaded the 3 above files to my data folder but when I open the zz plus deviations study collection I get the following error

CreateStudyDLLModuleFunctionObject Error loading C:\SierraChart\Data\aTmp_64.dll. Windows error code 126: The specified module could not be found. Likely missing dependency file.

Can you please let me know what to do ?

Thanks

Arnaud
[2022-07-24 10:29:44]
WyckoffSleuth - Posts: 16
Hi Kiwi / anybody with cpp knowledge
Just tried to load the study and with current Sierra version it doesn't seem to do anything at all. Would you (or anybody capable) be able to look at the code and check it, and potentially update it to make it functional again?
Thanks!
[2022-07-24 11:41:49]
User431178 - Posts: 511
Not Kiwi, but minimally updated file aTmp.cpp so that it will compile with current Sierra Chart version.

How to Build an Advanced Custom Study from Source Code
Date Time Of Last Edit: 2022-07-24 11:42:13
attachmentaTmp.cpp - Attached On 2022-07-24 11:39:17 UTC - Size: 28.68 KB - 175 views

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

Login

Login Page - Create Account