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
This num_hundreds() function should work.
//num_hundreds(value) => value > 900 ? 9 :value > 800 ? 8 :value > 700 ? 7 :value > 600 ? 6 :value > 500 ? 5 :value > 400 ? 4 :value > 300 ? 3 : value > 200 ? 2 : value > 100 ? 1 : 0
f = floor(value / 100)
h = value > 0 and value % 100 == 0 ? f-1 : f
Will update with this function as soon I made some other adjustments. I am not 100% sure that I have everything tuned in.