Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=3
- //Developed by Tim Tillson
- //author: KIVANÇ @fr3762 on twitter
- study("BALTUZAR", overlay=true)
- useCurrentRes = input(true, title="Use Current Chart Resolution?")
- resCustom = input(title="Use Different Timeframe? Uncheck Box Above", type=resolution, defval="D")
- length1 = input(8, "T3 Length")
- a1 = input(0.7, "Volume Factor", step=0.1)
- 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[1]
- col3= T3<T3[1]
- color = col1 ? green : col3 ? red : yellow
- plot(T3, color=color, linewidth=3, title="T3")
- rsiPeriod = input(21, minval = 1, title = "RSI Period")
- bandLength = input(34, minval = 1, title = "Band Length")
- lengthrsipl = input(2, minval = 0, title = "Fast MA on RSI")
- lengthtradesl = input(7, minval = 1, title = "Slow MA on RSI")
- zlmaSourceDORTLU=0.0
- ma_typeDORTLU = input(title = "MA Type", type = string, defval = "SMA", options = ['ZEROLAG ','WILDERS','SMA', 'EMA', 'WMA', 'VWMA', 'HMA', 'SMMA', 'DEMA '])
- short_maDORTLU_srcDORTLU = input(title = "MA Source", type = source, defval = close)
- src = short_maDORTLU_srcDORTLU
- r = rsi(src, rsiPeriod)
- s1DORTLU =lengthtradesl
- s2DORTLU = lengthrsipl
- short_maDORTLU_srcDORTLU:=r
- zlmaSourceDORTLU:= short_maDORTLU_srcDORTLU
- short_maDORTLU = 0.0
- ma=0.0
- a1DORTLU=0.0
- a2DORTLU=0.0
- // Simple Moving Average (SMA)
- if ma_typeDORTLU == 'SMA'
- a1DORTLU := sma(short_maDORTLU_srcDORTLU, s1DORTLU)
- a2DORTLU := sma(short_maDORTLU_srcDORTLU, s2DORTLU)
- ma:= sma(short_maDORTLU_srcDORTLU, bandLength)
- // Exponential Moving Average (EMA)
- if ma_typeDORTLU == 'EMA'
- a1DORTLU := ema(short_maDORTLU_srcDORTLU, s1DORTLU)
- a2DORTLU := ema(short_maDORTLU_srcDORTLU, s2DORTLU)
- ma:= ema(short_maDORTLU_srcDORTLU, bandLength)
- // Weighted Moving Average (WMA)
- if ma_typeDORTLU == 'WMA'
- a1DORTLU := wma(short_maDORTLU_srcDORTLU, s1DORTLU)
- a2DORTLU := wma(short_maDORTLU_srcDORTLU, s2DORTLU)
- ma:= wma(short_maDORTLU_srcDORTLU, bandLength)
- // Hull Moving Average (HMA)
- if ma_typeDORTLU == 'HMA'
- a1DORTLU := wma(2*wma(short_maDORTLU_srcDORTLU, s1DORTLU/2)-wma(short_maDORTLU_srcDORTLU, s1DORTLU), round(sqrt(s1DORTLU)))
- a2DORTLU := wma(2*wma(short_maDORTLU_srcDORTLU, s2DORTLU/2)-wma(short_maDORTLU_srcDORTLU, s2DORTLU), round(sqrt(s2DORTLU)))
- ma:= wma(2*wma(short_maDORTLU_srcDORTLU, bandLength/2)-wma(short_maDORTLU_srcDORTLU, bandLength), round(sqrt(bandLength)))
- // Volume-weighted Moving Average (VWMA)
- if ma_typeDORTLU == 'VWMA'
- a1DORTLU := vwma(short_maDORTLU_srcDORTLU, s1DORTLU)
- a2DORTLU := vwma(short_maDORTLU_srcDORTLU, s2DORTLU)
- ma:= vwma(short_maDORTLU_srcDORTLU, bandLength)
- // Smoothed Moving Average (SMMA)
- if ma_typeDORTLU == 'SMMA'
- a1DORTLU := na(a1DORTLU[1]) ? sma(short_maDORTLU_srcDORTLU, s1DORTLU) : (a1DORTLU[1] * (s1DORTLU - 1) + short_maDORTLU_srcDORTLU) / s1DORTLU
- a2DORTLU := na(a2DORTLU[1]) ? sma(short_maDORTLU_srcDORTLU, s2DORTLU) : (a2DORTLU[1] * (s2DORTLU - 1) + short_maDORTLU_srcDORTLU) / s2DORTLU
- ma:= na(ma[1]) ? sma(short_maDORTLU_srcDORTLU, bandLength) : (ma[1] * (bandLength - 1) + short_maDORTLU_srcDORTLU) / bandLength
- // Double Exponential Moving Average (DEMA)
- if ma_typeDORTLU == 'DEMA '
- e1_shorta1DORTLU = ema(short_maDORTLU_srcDORTLU, s1DORTLU)
- a1DORTLU := 2 * e1_shorta1DORTLU - ema(e1_shorta1DORTLU, s1DORTLU)
- e1_shorta2DORTLU = ema(short_maDORTLU_srcDORTLU, s2DORTLU)
- a2DORTLU := 2 * e1_shorta2DORTLU - ema(e1_shorta2DORTLU, s2DORTLU)
- e111 = ema(short_maDORTLU_srcDORTLU, bandLength)
- ma := 2 * e111 - ema(e111, bandLength)
- if ma_typeDORTLU == 'WILDERS'
- wild2=0.0
- wild2:=nz(wild2[1])+(short_maDORTLU_srcDORTLU-nz(wild2[1]))/s2DORTLU
- a2DORTLU:=wild2
- if ma_typeDORTLU == 'WILDERS'
- wild1=0.0
- wild1:=nz(wild1[1])+(short_maDORTLU_srcDORTLU-nz(wild1[1]))/s1DORTLU
- a1DORTLU:=wild1
- if ma_typeDORTLU == 'WILDERS'
- wild3=0.0
- wild3:=nz(wild3[1])+(short_maDORTLU_srcDORTLU-nz(wild3[1]))/bandLength
- ma:=wild3
- if ma_typeDORTLU == 'ZEROLAG '
- zema1DORTLU=ema(zlmaSourceDORTLU, s1DORTLU)
- zema2DORTLU=ema(zema1DORTLU, s1DORTLU)
- c1bir=zema1DORTLU-zema2DORTLU
- s1DORTLU1=zema1DORTLU+c1bir
- zema1DORTLU2=ema(zlmaSourceDORTLU, s2DORTLU)
- zema2DORTLU2=ema(zema1DORTLU2, s2DORTLU)
- c12=zema1DORTLU2-zema2DORTLU2
- s2DORTLU2=zema1DORTLU2+c12
- zz1=ema(zlmaSourceDORTLU, bandLength)
- zz2=ema(zz1, bandLength)
- c11=zz1-zz2
- ma:=zz1+c11
- a1DORTLU:=s1DORTLU1
- a2DORTLU:=s2DORTLU2
- offs = (1.6185 * stdev(r, bandLength)) // Offset
- up = ma + offs // Upper Bands
- dn = ma - offs // Lower Bands
- mid = (up + dn) / 2 // Average of Upper and Lower Bands
- fastMA = a1DORTLU // Moving Average of RSI 2 bars back
- slowMA = a2DORTLU // Moving Average of RSI 7 bars back
- // ExtremelyOverbought
- renk=slowMA >fastMA ?blue:red
- // Plot Fast MA
- sart=input(true, title=" Condition Upper band / Lower Band on-off" )
- long= (slowMA >=fastMA and slowMA[1] <=fastMA[1])
- short =(slowMA <=fastMA and slowMA[1]>=fastMA[1])
- longrenk=(slowMA >=fastMA and slowMA[1] <=fastMA[1])
- shortrenk=(slowMA <=fastMA and slowMA[1]>=fastMA[1])
- longBAND= (slowMA >=dn and slowMA[1] <=dn[1])
- shortBAND =(slowMA <=up and slowMA[1]>=up[1])
- last_signal = 0
- long_final = long and (nz(last_signal[1]) == 0 or nz(last_signal[1]) == 2 or nz(last_signal[1]) == 4)
- short_final = short and (nz(last_signal[1]) == 0 or nz(last_signal[1]) == 1 or nz(last_signal[1]) == 3 )
- longBAND_final = longBAND and (nz(last_signal[1]) == 0 or nz(last_signal[1]) == 1 or nz(last_signal[1]) == 2 or nz(last_signal[1]) == 4)
- shortBAND_final = shortBAND and (nz(last_signal[1]) == 0 or nz(last_signal[1]) == 1 or nz(last_signal[1]) == 3 or nz(last_signal[1]) == 2)
- alertcondition(long_final and sart, title="al alarmı", message=" al verdi!!!")
- alertcondition(short_final and sart, title="sat alarmı", message=" sat verdi!!!")
- alertcondition(longBAND_final and sart, title="al band alarmı", message=" al verdi!!!")
- alertcondition(shortBAND_final and sart, title="sat band alarmı", message=" sat verdi!!!")
- last_signal := long_final ? 1 : short_final ? 2 :longBAND_final ? 3 :shortBAND_final ? 4 : last_signal[1]
- plotshape(long_final and sart and col1 ? slowMA : na, title="al etiketi", color=blue, text="B",
- textcolor=white,
- style=shape.labelup,
- location=location.belowbar)
- plotshape(short_final and sart and col3 ? slowMA : na, title="al etiketi", color=red, text="S",
- textcolor=white,
- style=shape.labeldown,
- location=location.abovebar)
- plotshape(longBAND_final and sart ? slowMA : na, title="al band etiketi", color=blue, text="BB",
- textcolor=white,
- style=shape.labelup,
- location=location.belowbar)
- plotshape(shortBAND_final and sart ? slowMA : na, title="al band etiketi", color=red, text="SS",
- textcolor=white,
- style=shape.labeldown,
- location=location.abovebar)
- last_signalrenk = 0
- long_finalrenk = longrenk and (nz(last_signalrenk[1]) == 0 or nz(last_signalrenk[1]) == -1)
- short_finalrenk = shortrenk and (nz(last_signalrenk[1]) == 0 or nz(last_signalrenk[1]) == 1)
- newlong = col1 and barssince(col1[1]) > barssince(col3[1])
- newshort = col3 and barssince(col3[1]) > barssince(col1[1])
- alertcondition(newlong and not sart, title="LONG", message="buy signal!!!")
- alertcondition(newshort and not sart, title="SHORT", message="sell signal!!!")
- last_signalrenk := long_finalrenk ? 1 : short_finalrenk ? -1 : last_signalrenk[1]
- plotshape(newlong and not sart ? slowMA : na, title="al etiketi renk", color=blue, text="B",
- textcolor=white,
- style=shape.labelup,
- location=location.belowbar)
- plotshape(newshort and not sart ? slowMA : na, title="al etiketi renk", color=red, text="S",
- textcolor=white,
- style=shape.labeldown,
- location=location.abovebar)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement