# MavilimW,DARVAS,Tillson T3,trailing stop loss,ichimoku

1644瀏覽
1644
//@version=3
study("MavilimW,DARVAS,Tillson T3,trailing stop loss,ichimoku", overlay=true)
M1= wma (close, 3)
M2= wma ( M1 , 5)
M3= wma ( M2 , 8)
M4= wma ( M3 , 13)
M5= wma (M4, 21)
MAVW= wma (M5, 34)
plot(MAVW, color=blue, linewidth=2)

//@version=3

//author KıvanÇ @fr3762 on twitter
//creator Nicholas Darvas

//iff(low=lowest(low,5),low,iff(low=lowest(low,5),low,iff(low=lowest(low,5),low,iff(low=lowest(low,5),low,iff(low=lowest(low,5),low,0)))))
//iff(low=lowest(low,5),low,iff(low=lowest(low,5),low,iff(low=lowest(low,5),low,iff(low=lowest(low,5),low,iff(low=lowest(low,5),low,0)))))
boxp=input(5, "BOX LENGTH")

LL = lowest(low,boxp)
k1=highest(high,boxp)
k2=highest(high,boxp-1)
k3=highest(high,boxp-2)

NH = valuewhen(high>k1,high,0)
box1 =k3<k2
TopBox = valuewhen(barssince(high>k1)==boxp-2 and box1, NH, 0)
BottomBox = valuewhen(barssince(high>k1)==boxp-2 and box1, LL, 0)

plot(TopBox, linewidth=3, color=green, title="TBbox")
plot(BottomBox, linewidth=3, color=red, title="BBbox")

T3FiboLine = input(false, title="Show T3 Fibonacci Ratio Line?")

length1 = input(8, "T3 Length")
a1 = input(0.7, "Volume Factor")

e1=ema((high + low + 2*close)/4, length1)
e2=ema(e1,length1)
e3=ema(e2,length1)
e4=ema(e3,length1)
e5=ema(e4,length1)
e6=ema(e5,length1)
c1=-a1*a1*a1
c2=3*a1*a1+3*a1*a1*a1
c3=-6*a1*a1-3*a1-3*a1*a1*a1
c4=1+3*a1+a1*a1*a1+3*a1*a1
T3=c1*e6+c2*e5+c3*e4+c4*e3

col1= T3>T3
col3= T3<T3
color = col1 ? green : col3 ? red : yellow
plot(T3, color=color, linewidth=3, title="T3")

length12 = input(5, "T3 Length fibo")
a12 = input(0.618, "Volume Factor fibo")

e12=ema((high + low + 2*close)/4, length12)
e22=ema(e12,length12)
e32=ema(e22,length12)
e42=ema(e32,length12)
e52=ema(e42,length12)
e62=ema(e52,length12)
c12=-a12*a12*a12
c22=3*a12*a12+3*a12*a12*a12
c32=-6*a12*a12-3*a12-3*a12*a12*a12
c42=1+3*a12+a12*a12*a12+3*a12*a12
T32=c12*e62+c22*e52+c32*e42+c42*e32

col12= T32>T32
col32= T32<T32
color2 = col12 ? blue : col32 ? purple : yellow
plot(T3FiboLine and T32 ? T32 : na, color=color2, linewidth=2, title="T3fibo")

plot(valuewhen(low>low , low , 1), linewidth=2, color=purple)

conversionPeriods = input(9, minval=1, title="Conversion Line Periods"),
basePeriods = input(26, minval=1, title="Base Line Periods")
laggingSpan2Periods = input(52, minval=1, title="Lagging Span 2 Periods"),
displacement = input(26, minval=1, title="Displacement")

donchian ( len ) => avg (lowest( len ), highest( len ))

conversionLine = donchian (conversionPeriods)
baseLine = donchian (basePeriods)
leadLine1 = avg (conversionLine, baseLine)
leadLine2 = donchian (laggingSpan2Periods)

plot(conversionLine, color=#0496ff, title="Conversion Line")
plot(baseLine, color=#991515, title="Base Line")
plot(close, offset = -displacement, color=#459915, title="Lagging Span")

p1 = plot(leadLine1, offset = displacement, color=green,