TD Sequential (MA 1.0)

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

Input parameters:
PlotTheSetup = input(true)
PlotTheCountdown = input(true)
ShowSetupSells = input(true)
ShowCountdownSells = input(true)

Release Notes: You can set your own SetupLimit between 5 and 13, default = 9
You can set your own CountdownLimit between 8 and 16, default = 13

num_hundreds function is improved thanks to @banacek
Release Notes: Updated text at end of setup and countdown phases
Ta bort från favoritskript Lägg till som favoritskript


Thanks shimoda94,

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


num_hundreds(value) =>
f = floor(value / 100)
h = value > 0 and value % 100 == 0 ? f-1 : f
+1 Svara
banacek banacek
Make sure you indent the 2 function lines above. For some reason they were stripped whilst posting.
shimoda94 banacek
@banacek, Thanks. Somehow I missed that there is a floor-function available. Am new to Pine.
Will update with this function as soon I made some other adjustments. I am not 100% sure that I have everything tuned in.

therzma shimoda94
@shimoda94, sorry to say but the sell countdown seems to miss candles that do close above that two prior even if it's sequential. Also, what is the floor function supposed to do?
I added the indicator to my favorites and enabled, but I'm not see any numbers?
Hem Aktie-screener Forex-screener Krypto-screener Ekonomisk kalender Hur det fungerar Diagramfunktioner Priser Tipsa en vän Ordningsregler Hjälpcenter Webbsidor och mäklarlösningar Widgets Diagramlösningar Lightweight Charting Library Blogg och nyheter Twitter
Profil Profilinställningar Konto och fakturering Hänvisade vänner Mynt Mina kölappar Hjälpcenter Publicerade idéer Följare Följer Privata meddelanden Chatt Logga ut