PROTECTED SOURCE SCRIPT

ind4all

// version=2
study("ind4all", overlay = true)
//Hull MA
n=input(title="period",type=integer,defval=16)
n2ma=2*wma(close,round(n/2))
nma=wma(close,n)
diff=n2ma-nma
sqn=round(sqrt(n))
n2ma1=2*wma(close[1],round(n/2))
nma1=wma(close[1],n)
diff1=n2ma1-nma1
sqn1=round(sqrt(n))
n1=wma(diff,sqn)
n2=wma(diff1,sqn)
c=n1>n2?green:red
ma=plot(n1,title = "HULL MA", linewidth=3, color=c)

//Bollinger Bands
length = input(20, minval=1)
src = input(close, title="Source")
mult = input(2.0, minval=0.001, maxval=50)
basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis - dev
p1 = plot(upper, title = "BB_UPPER", color=black, linewidth=3)
p2 = plot(lower, title = "BB_LOWER", color=black, linewidth=3)
fill(p1, p2)

// MA
plot(ema(close,6), title = "EMA 6", color = #FF9500, linewidth=3)
plot(sma(close,20), title = "SMA 20", color = blue, linewidth=3)
plot(sma(close,50), title = "SMA 50", color = blue, linewidth=3)
plot(sma(close,200), title = "SMA 200", color = red, linewidth=3)

// Parabolic SAR
start = input(2, minval=0, maxval=10, title="Start - Default = 2 - Multiplied by .01")
increment = input(2, minval=0, maxval=10, title="Step Setting (Sensitivity) - Default = 2 - Multiplied by .01" )
maximum = input(2, minval=1, maxval=10, title="Maximum Step (Sensitivity) - Default = 2 - Multiplied by .10")
sus = input(true, "Show Up Trending Parabolic Sar")
sds = input(true, "Show Down Trending Parabolic Sar")
disc = input(false, title="Start and Step settings are *.01 so 2 = .02 etc, Maximum Step is *.10 so 2 = .2")
startCalc = start * .01
incrementCalc = increment * .01
maximumCalc = maximum * .10
sarUp = sar(startCalc, incrementCalc, maximumCalc)
sarDown = sar(startCalc, incrementCalc, maximumCalc)
colUp = close >= sarDown ? lime : na
colDown = close <= sarUp ? red : na
plot(sus and sarUp ? sarUp : na, title="Up Trending SAR", style=circles, linewidth=3,color=colUp)
plot(sds and sarDown ? sarDown : na, title="Up Trending SAR", style=circles, linewidth=3,color=colDown)


//SUPER TREND
Factor=input(3, minval=1,maxval = 100)
Pd=input(7, minval=1,maxval = 100)

Up=hl2-(Factor*atr(Pd))
Dn=hl2+(Factor*atr(Pd))

TrendUp=close[1]>TrendUp[1]? max(Up,TrendUp[1]) : Up
TrendDown=close[1]<TrendDown[1]? min(Dn,TrendDown[1]) : Dn

Trend = close > TrendDown[1] ? 1: close< TrendUp[1]? -1: nz(Trend[1],1)
Tsl = Trend==1? TrendUp: TrendDown

linecolor = Trend == 1 ? green : red

plot(Tsl, color = linecolor , style = line , linewidth = 3,title = "SuperTrend")

plotshape(cross(close,Tsl) and close>Tsl , "Up Arrow", shape.triangleup,location.belowbar,green,0,0)
plotshape(cross(Tsl,close) and close<Tsl , "Down Arrow", shape.triangledown , location.abovebar, red,0,0)

plotarrow(Trend == 1 and Trend[1] == -1 ? Trend : na, title="Up Entry Arrow", colorup=lime, maxheight=60, minheight=50, transp=0)
plotarrow(Trend == -1 and Trend[1] == 1 ? Trend : na, title="Down Entry Arrow", colordown=red, maxheight=60, minheight=50, transp=0)

golong = Trend == 1 and Trend[1] == -1
alertcondition(golong, title='Long', message='SuperTrend V.1 Alert Long')
goshort = Trend == -1 and Trend[1] == 1
alertcondition(goshort, title='Short', message='SuperTrend V.1 Alert Short')

//Doji signals
Precision = input(0.15, minval=0.0001, title="Doji's Max Body size")
barcolor(abs(open - close) <= (high - low) * Precision ? yellow : na)


//Trend Trader Strategy
Length = input(21, minval=1),
Multiplier = input(3, minval=1)
avgTR = wma(atr(1), Length)
highestC = highest(Length)
lowestC = lowest(Length)
hiLimit = highestC[1]-(avgTR[1] * Multiplier)
loLimit = lowestC[1]+(avgTR[1] * Multiplier)
ret = iff(close > hiLimit and close > loLimit, hiLimit, iff(close < loLimit and close < hiLimit, loLimit, nz(ret[1], 0)))
pos = iff(close > ret, 1, iff(close < ret, -1, nz(pos[1], 0)))
plot(ret, color= black, linewidth=2,title="Trend Trader Strategy")


// Fast MA Vs Slow MA
fastPer = input(7, minval=1,title="Fast MM")
slowPer = input(20,minval=1,title="Slow MM")

start1 = input(2, minval=0, maxval=10, title="Start - Default = 2 - Multiplied by .01")
increment1 = input(2, minval=0, maxval=10, title="Step Setting (Sensitivity) - Default = 2 - Multiplied by .01" )
maximum1 = input(2, minval=1, maxval=10, title="Maximum Step (Sensitivity) - Default = 2 - Multiplied by .10")

fastMM = sma(close, fastPer)
slowMM = sma(close, slowPer)

ma1=plot( fastMM,color=rising(fastMM,2)?green:red,linewidth=2,transp=20,title="Fast MM")
ma2=plot( slowMM,color=rising(slowMM,2)?#F705F9:blue,linewidth=2,transp=20,title="Slow MM")


//version=3
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")

p12 = plot(leadLine1, offset = displacement, color=green,
title="Lead 1")
p22 = plot(leadLine2, offset = displacement, color=red,
title="Lead 2")
fill(p12, p22, color = leadLine1 > leadLine2 ? green : red)



Volume

Mã được bảo vệ

Tập lệnh này được xuất bản mã nguồn đóng và bạn có thể sử dụng một cách tự do.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Thông báo miễn trừ trách nhiệm