Here is a small attempt to automatically identify wedges and flags.
Tradingview standard wedge checks for only 4 pivots. In this version, I have considered 5 pivots instead - which can help reduce noise as 4 pivots forming wedge can be quite common. In future, will also try to add more pivots in pattern recognition to make the signal more accurate.
If wedge comes with a tail, then it is marked as flag :) Settings are quite simple and they are as shown below
Notes de version
⋅
Few updates
You can now select wedge based on 5 or 6 pivots (defined in settings)
Theme based colouring option added in the settings. Now users can chose either dark or light theme (Refers to chart background theme).
Option added in settings to hide zigzag lines and labels within wedge.
Angle based logic are refined as well as the settings. Angle restrictions are by default not selected as they often can be unreliable.
Snapshot of the latest settings screen look like this:
Notes de version
⋅
Added alert upon new pattern formation.
Added labels for wedge
Notes de version
⋅
Updated libraries. Removed max_bars_back
Notes de version
⋅
reverted max_bars_back change as it lead to error.
Notes de version
⋅
Added option to filter only wedge or flag using input options.
Notes de version
⋅
Added condition to alert only after bar confirmation. This is done to avoid repaints of alerts.
@Ether2020, I did think about it. Only issue is, it draws too many lines on the chart. I will see if I can do something like extend only the last pattern. But, that can be a tricky implementation.
@HeWhoMustNotBeNamed, Yes too long will clutter the chart but I would say an option to extend the trendline by X bars (X to choose the bars to extend) to the right and the extension in the same color but only 30% opacity or even less. That would make the extensions still good but the chart less cluttered. If people do not want to see the extension they could simply set the x bars to zero and it is like it right now.
What would also be great is an alert on a breakout on the (extended) trendline. I know I ask a lot but you are a true master in coding which only very few people can! I am really very impressed with your scripts! I hope you can implement that. It would make such an improvement! Thanks my dear friend!