glaz

TD Sequential

3875 22 2058
TD             Sequential with candle counting
S/R lines by johan.gradin https://www.tradingview.com/u/johan.gradin/
Remove from Favorite Scripts Add to Favorite Scripts
study("TD Sequential",overlay=true)
transp=input(0)
Numbers=input(true)
SR=input(true)
Barcolor=input(true)
TD = close > close[4] ?nz(TD[1])+1:0
TS = close < close[4] ?nz(TS[1])+1:0

TDUp = TD - valuewhen(TD < TD[1], TD , 1 )
TDDn = TS - valuewhen(TS < TS[1], TS , 1 )
plotshape(Numbers?(TDUp==1?true:na):na,style=shape.triangledown,text="1",color=green,location=location.abovebar,transp=transp)
plotshape(Numbers?(TDUp==2?true:na):na,style=shape.triangledown,text="2",color=green,location=location.abovebar,transp=transp)
plotshape(Numbers?(TDUp==3?true:na):na,style=shape.triangledown,text="3",color=green,location=location.abovebar,transp=transp)
plotshape(Numbers?(TDUp==4?true:na):na,style=shape.triangledown,text="4",color=green,location=location.abovebar,transp=transp)
plotshape(Numbers?(TDUp==5?true:na):na,style=shape.triangledown,text="5",color=green,location=location.abovebar,transp=transp)
plotshape(Numbers?(TDUp==6?true:na):na,style=shape.triangledown,text="6",color=green,location=location.abovebar,transp=transp)
plotshape(Numbers?(TDUp==7?true:na):na,style=shape.triangledown,text="7",color=green,location=location.abovebar,transp=transp)
plotshape(Numbers?(TDUp==8?true:na):na,style=shape.triangledown,text="8",color=green,location=location.abovebar,transp=transp)
plotshape(Numbers?(TDUp==9?true:na):na,style=shape.triangledown,text="9",color=green,location=location.abovebar,transp=transp)

plotshape(TDDn==1?true:na,style=shape.triangleup,text="1",color=red,location=location.belowbar,transp=transp)
plotshape(TDDn==2?true:na,style=shape.triangleup,text="2",color=red,location=location.belowbar,transp=transp)
plotshape(TDDn==3?true:na,style=shape.triangleup,text="3",color=red,location=location.belowbar,transp=transp)
plotshape(TDDn==4?true:na,style=shape.triangleup,text="4",color=red,location=location.belowbar,transp=transp)
plotshape(TDDn==5?true:na,style=shape.triangleup,text="5",color=red,location=location.belowbar,transp=transp)
plotshape(TDDn==6?true:na,style=shape.triangleup,text="6",color=red,location=location.belowbar,transp=transp)
plotshape(TDDn==7?true:na,style=shape.triangleup,text="7",color=red,location=location.belowbar,transp=transp)
plotshape(TDDn==8?true:na,style=shape.triangleup,text="8",color=red,location=location.belowbar,transp=transp)
plotshape(TDDn==9?true:na,style=shape.triangleup,text="9",color=red,location=location.belowbar,transp=transp)

//------------//
// Sell Setup //
//------------//
priceflip = barssince(close<close[4])
sellsetup = close>close[4] and priceflip
sell = sellsetup and barssince(priceflip!=9)
sellovershoot = sellsetup and barssince(priceflip!=13)
sellovershoot1 = sellsetup and barssince(priceflip!=14)
sellovershoot2 = sellsetup and barssince(priceflip!=15)
sellovershoot3 = sellsetup and barssince(priceflip!=16)

//----------//
// Buy setup//
//----------//
priceflip1 = barssince(close>close[4])
buysetup = close<close[4] and priceflip1
buy = buysetup and barssince(priceflip1!=9)
buyovershoot = barssince(priceflip1!=13) and buysetup
buyovershoot1 = barssince(priceflip1!=14) and buysetup
buyovershoot2 = barssince(priceflip1!=15) and buysetup
buyovershoot3 = barssince(priceflip1!=16) and buysetup

//----------//
// TD lines //
//----------//
TDbuyh = valuewhen(buy,high,0)
TDbuyl = valuewhen(buy,low,0)
TDsellh = valuewhen(sell,high,0)
TDselll = valuewhen(sell,low,0)

//----------//
//   Plots  //
//----------//

plot(SR?(TDbuyh ? TDbuyl: na):na,style=circles, linewidth=1, color=red)
plot(SR?(TDselll ? TDsellh : na):na,style=circles, linewidth=1, color=lime)
barcolor(Barcolor?(sell? #FF0000 : buy? #00FF00 : sellovershoot? #FF66A3 : sellovershoot1? #FF3385 : sellovershoot2? #FF0066 : sellovershoot3? #CC0052 : buyovershoot? #D6FF5C : buyovershoot1? #D1FF47 : buyovershoot2? #B8E62E : buyovershoot3? #8FB224 : na):na)

Thanks so much fo the indicator. it works very well.
Numbers 1 - 8 I don't want the triangles to show, but only the number.
I tried changing plotshape to plotchar.....but I am a novice with scripting.

Could you perhaps help?
Reply
Nice script. I want to modify it by starting to count with 1 after a 9 dit not lead to a Red number. Can someone please help me?
Reply
Dear Glaz exelent script.
Is it possible to remove the non completed cycle numbers?
I have no expierence with this script or can you help me to modify it

Many thanks in advance Jan
Reply
Alphaoptions JanMobers
I know there are lots of traders to please, but I would request NOT removing the non-completed numbers as this is helpful to see and can easily be ignored for those NOT wanting to see partial cycles. Seeing cycles failures can be a system of its own. When they are removed you are forced to manually count again. Just my suggestion.
Reply
glaz Alphaoptions
i havent figure it out yet, in mql language i could use DeleteObject but not such thing in pinescript.
Reply
how to use this indicator for signals... can you explain me...?
Reply
Algyros SrikanthTirumalasetty
Take a look at the youtube video ChartArt posted in response to the same question. It's six posts above this one.
Reply
Glaz, this is great work. Very helpful to have the count of 9. The "overshoot" gives you the basic count of "13" --- there are many rules that can be applied to TD Sequential, but none 'really' go into effect til after the count of 9. If I put one thing on the list is to continue please and expand to also create the TD Combo.... Again thanks.. this is a great add to Trading View!!!
+1 Reply
Glaz - since several of us are following this project (and learning from it as you develop it), would yo mind commenting on the thoughts you have and the specific edits you make as you complete each stage. It will help us to not just follow the indicator but help us learn from someone who is very good. Thank you.
Reply
I want to point out for everyone who finds this that you have updated the code later. Here is the newer version:



The Tradingview warning: "This script was updated" is quite tiny :) And again thank you very much!
+2 Reply
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out