Inspired by glaz TD-Sequential script I wrote my own to also include the TD-Countdown phase.
It is not perfect by any means yet.
A problem is the 'num_hundreds' function which is needed to calculate the next number in the TD-Countdown phase if the numbers are not sequential. At the moment it can handle max 9 non-sequential bars.
It should need to be updated to a for-loop but I could not get that working.
If anyone has a fix for that, you are welcome to do it and please also send me an update.
We plot the setup phase with green or red numbers 1..9 above the bars. If we reach a 9 we insert a red or green triangle at top or bottom with text 'SELL (S)' or 'BUY (S') (S) indicates that that the setup phase is finished
We then start the countdown phase and plots lime or maroon numbers 1..13 below the bars. If we reach 13 we insert a red or green arrow at top or bottom with text 'SELL (C)' or 'BUY (C') (C) indicates that that the countdown phase is finished
PlotTheSetup = input(true)
PlotTheCountdown = input(true)
ShowSetupSells = input(true)
ShowCountdownSells = input(true)
You can set your own CountdownLimit between 8 and 16, default = 13
num_hundreds function is improved thanks to @banacek
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.