MarcoValente

true trend

291
Easy way to look at the Trend , but still accurate. Top bar is DI +, DI - , bars change in yellow when a swing happen, histogram show the increase/decrease of Min and Max and Open-Close; 2 lines moving between +1 and - 1 folloiwng 3 Ema crossing ; a Dot (diamond shape) appear on the botton when volatility increase and finally a " + " show when volume are much bigger the usually. Yellow line on top is Willams % and help us to find top and bottom of the market.
Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu betiğin yazarı, yatırımcının anlayabilmesi ve doğrulayabilmesi için onu açık kaynak olarak yayınladı. Yazarın eline sağlık! Bunu ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları ile yönetilir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?
// by Marco
study("true trend")
len=input(10,title="period ema 1")
lena=input(20,title="period ema 2")
lenb=input(50,title="period ema 3")
mom=input(3,title="period momentum")
vol=volume
cl=close
c=(close+2*close[1]+close[2])/4
h=(high+2*high[1]+2*high[2]+high[3])/6
l=(low+2*low[1]+2*low[2]+low[3])/6
shl=(hl2+2*hl2[1]+hl2[2])/4
// volume change 
ov=sma(vol,mom)-sma(vol,len)
ovm=abs(ov-ov[1])
qq=ovm>5*ovm[1]  ? -2:na
vv=qq
vcc=qq==-2? teal :na
//change of  min and max 
up=low>low[3] ? .6 : high<high[3] ? -.6:0.3
//close and median price
cu=c>shl ? 0.5 :c<shl ? -0.5:0.3
//Moment of MA min and Max 
uma=sma(low,mom)>sma(low,mom*2)[1]?  1:sma(high,mom)<sma(high,mom*2)[1]? -1:0
//Gann Swing
hld = iff(close > sma(high,mom)[1], 1, iff(close<sma(low,mom)[1],-1, 0))
hlv = valuewhen(hld != 0, hld, 1)
//code for Plot Statements
hi = hlv == -1 ? sma(high, mom) : na
lo = hlv == 1 ? sma(low,mom) : na
closeAbove() =>  close > hi and close[1] < hi
BHcloseAbove =  close > hi and close[1] < hi
closeBelow() => close < lo and close[1] > lo
BHcloseBelow = close < lo and close[1] > lo

barcolor(closeAbove() ? yellow : na)
barcolor(closeBelow() ? yellow : na)
//Background Highlight Rules
plotshape(BHcloseAbove,style=shape.arrowup,size=size.small,location=location.bottom,color=lime ,title="Swing Up", transp=20)
plotshape(BHcloseBelow,style=shape.arrowdown,size=size.small,location=location.bottom,color=red , title="Swing Down",transp=20)
//DI+ and DI-
upz = change(high)
down = -change(low)
trur = rma(tr, len)
plus = fixnan(100 * rma(upz > down and upz > 0 ? upz : 0, len) / trur)
minus = fixnan(100 * rma(down > upz and down > 0 ? down : 0, len) / trur)
sum = plus + minus 
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), len)
di=plus-minus
df=di>=0? lime :red
oo=1.6
zs=2
o=plot(oo,color=df,title="Diretion Index color",transp=100)
wq=plot(zs,color=df,title="Diretion Index color",transp=100)
fill(o,wq,color=df,transp=40)
// volatility ( ATR )
vo=atr(mom)>=atr(len) ? 1:0
// 3 Ema crossing
ma=ema(cl,len)>ema(cl,lena)? 1.2: -1.2
mma= ma==1.2 and ema(cl,lena)>ema(cl,lenb) ? 1: ma==-1.2 and ema(cl,lena)<ema(cl,lenb)?-1 :0
//colors
co=ma>=0?teal:red
colb=uma>=0?lime:red
col=up==.6? green :up==-.6? red:blue
cola=cu==0.5? green :cu==-0.5? orange :blue
mms=asin(mma)/0.7
cm=mms>=0?white:fuchsia
//willams %R sharpen by Fish trans.
length = input(50, minval=1)
upper = highest(length)
lower = lowest(length)
out =iff (2*(.5+(close - upper) / (upper - lower))>.999,2*(.5+(close - upper) / (upper - lower))+.5*(.999),0)
iff (2*(.5+(close - upper) / (upper - lower))<-.999,2*(.5+(close - upper) / (upper - lower))+.5*(-.999),0)
tt=out==0?2*(.5+(close - upper) / (upper - lower))+.5*(out[1]):out
ou=0.25*log((1+tt)/(1-tt))+.5*(tt[1])
//plot
plot(ou,color=yellow,transp=0,title="Willams%R")
plot(up,style=columns,linewidth=1,color=col,transp=50,title="Change Min, Max")
plot(cu,style=histogram,linewidth=6,color=cola,transp=50,title="Close/HL2")
plot(uma,style=columns,linewidth=2, color=colb,transp=70,title="Sma min max Direction")
plotshape(vo,style=shape.diamond,location=location.bottom,title="Volatility Increase",color=aqua)
plot(ma,style=line,color=co,linewidth=2,title="EMA 1,2 Cross(TREND)" )
plot(mms,style=line, color=cm,linewidth=2,title="EMA 3 cross 1,2")
plotchar(vv,color=vcc,char="+",size=size.tiny,location=location.bottom,title="Volume Inc/Dec",transp=20)
hline(0)
hline(-3)