Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large ZigZag % threshold is not drawing on intraday data #600

Closed
Salardx opened this issue Oct 28, 2021 · 9 comments
Closed

Large ZigZag % threshold is not drawing on intraday data #600

Salardx opened this issue Oct 28, 2021 · 9 comments
Labels
question Question and/or answer user support Help a user with their implementation

Comments

@Salardx
Copy link

Salardx commented Oct 28, 2021

Hi, thank you for your great tools,
I got 300 candles, when I run ZigZag(percentChange: 5) on them, it returns 300 ZigZagResult
but only its 74 latest results have values inside, the first 226 values all show null.
I expect the algorithm check all 300 candles
I pull data from coinex, its about ETH/USDT, timeframe is 5min
I attach a sample data as json here
will you please check it out?

ethusdt.txt

@Salardx Salardx added the bug Something isn't working label Oct 28, 2021
@DaveSkender
Copy link
Owner

DaveSkender commented Oct 28, 2021

We always remove the first trend period in ZigZag because it is based on an initial guess at the direction and is unreliable information. As a result, if the first trend runs for a while before reversing 5% (in your case), there can be a large chunk removed at the front end of the results data.

Thanks for providing data; I'll take a closer look to confirm that this is what is happening.

@DaveSkender DaveSkender added question Question and/or answer user support Help a user with their implementation labels Oct 28, 2021
@Salardx
Copy link
Author

Salardx commented Oct 28, 2021

Yeah, but I think its not about the first trend, kinda it always the last trend the algorithm keeps! I've tested on couple of other markets, it always keeps the latest possible trend.
I'd be thankful if you could suggest a way that keeps the whole ZigZag data for all the candles

@DaveSkender
Copy link
Owner

DaveSkender commented Oct 28, 2021

Oh, I see. I misread and thought you were referring to the first trend. The last trend should be there, assuming it's not also the first trend. The last trend does repaint though, so that's worth noting. I'll take a look with your data this weekend and give a better explanation of what you're seeing.

Are you suggesting that when there is only one trend, we shouldn't throw it away as we usually do? If so, all that would only be is a single straight line between the first and last point.

@DaveSkender
Copy link
Owner

DaveSkender commented Oct 28, 2021

I suspect the issue here is that there is no 5% reversal in the first 300 points of data; and therefore no confirmed trend to produce.

ZigZag, by definition, is the straight line between high and low points that exceed the provided percent change threshold. The first point in your quote history is neither a high or low point, it's just a random point. That's why the lines are only drawn after the first confirmed high or low point.

@DaveSkender
Copy link
Owner

DaveSkender commented Nov 12, 2021

With just a quick look at your Close prices, here's what your chart looks like:

image

Given the price around ~$4,000, a 5% range would mean you only plot swings > ~$200. From your start point around $4,250 it continues to go down, without a 5% rebound, until it gets to the first suspected bottom at $3,915 at bar number 224.

@DaveSkender
Copy link
Owner

Use a smaller change threshold, like 1.2%, and it would look like this:

image

@DaveSkender
Copy link
Owner

DaveSkender commented Nov 12, 2021

If you were to use a wider timeframe, 5% might look and work better:

image

Ref: https://schrts.co/bEtpQigk

@DaveSkender DaveSkender removed the bug Something isn't working label Nov 12, 2021
@DaveSkender
Copy link
Owner

The basic issue in your use case is that you're not using enough quote history to have a meaningful ZigZag(5) drawn.

@DaveSkender DaveSkender changed the title Apparently ZigZag cannot tolerate big number of candles Large ZigZag % threshold is not drawing on intraday data Nov 12, 2021
@github-actions
Copy link

This Issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new Issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Question and/or answer user support Help a user with their implementation
Projects
None yet
Development

No branches or pull requests

2 participants