Open lapphan opened 1 year ago
I fix some bugs in ZigZag, thanks. However, I'm not sure that's all. You can take the fixes from the master branch.
And I also don't understand where the price value of 15443.20 comes from. I don't find that.
And I also don't understand where the price value of 15443.20 comes from. I don't find that.
The pivot 15443.20 is a correct pivot that already showed in v0.7.5 (please check #console ouput in my initial comment). You can see it at highlighted text below:
I also tested v0.7.5.1 and now all missing pivots are showed:
(IndicatorData) source: ccxt.binanceusdm, name: ZigZag, symbol: BTCUSDT, timeframe: 1d, allowed nan
date: 2019-09-08T00:00 - 2023-05-08T00:00 (length: 1339)
Values: time, pivots, pivot_types
time pivots pivot_types
101 2019-12-18 6427.00 -1
158 2020-02-13 10540.00 1
187 2020-03-13 3621.81 -1
584 2021-04-14 64986.11 1
619 2021-05-19 28688.00 -1
794 2021-11-10 69198.70 1
1170 2022-11-21 15443.20 -1
1314 2023-04-14 31059.00 1
1323 2023-04-23 27279.70 -1
But the incomplete pivot is not correct in my opinion. Perhaps we can take the logic in TradingView's Zig Zag indicator:
My pseudocode for more clarity:
last_bar_candle = get_last_bar_candle()
if last_pivot.type = 1 # High
incomplete_pivot.time = last_bar_candle.time
incomplete_pivot.type = -1 # Low
incomplete_pivot.price = last_bar_candle.low
else if last_pivot.type = -1 # Low
incomplete_pivot.time = last_bar_candle.time
incomplete_pivot.type = 1 # High
incomplete_pivot.price = last_bar_candle.high
I hope you can understand my idea. Feel free to give any feedback to me. Thank you.
Compare to Zig Zag indicator on TradingView, live_trading_indicators's ZigZag is missing 4 pivots:
What's showing on TradingView:
What I've done:
Please help me to get all missing pivots.
Thank you.