Untitled

 avatar
unknown
plain_text
a year ago
10 kB
59
Indexable
//@version=4
study(title="rsi,stoch rsi,RMI,Wt-cross ,MA", shorttitle="RSI+STOCH+RMI+Wt+MA")
rsishow=input(false,"Rsi Show?")
rsival=rsi(close,14)
plot(rsishow and rsival?rsival:na, color=color.purple,title="RSİ" ,linewidth=3)
hline(-40, '0 Line', linestyle=hline.style_solid, linewidth=1, color=color.gray)
hline(0, '0 Line', linestyle=hline.style_solid, linewidth=1, color=color.gray)
hline(10, '0 Line', linestyle=hline.style_solid, linewidth=1, color=color.gray)
hline(30, '0 Line', linestyle=hline.style_solid, linewidth=1, color=color.white)
hline(70, '0 Line', linestyle=hline.style_solid, linewidth=1, color=color.gray)
hline(80, '0 Line', linestyle=hline.style_solid, linewidth=1, color=color.gray)
fill(hline(70), hline(80),transp=80, color=color.red)
fill(hline(-10), hline(0),transp=80, color=color.green)
fill(hline(0), hline(10),transp=80, color=color.white)
//---------------------------------------------
//stoch rsi
stockrsishow=input(false,"StochRsi Show?")
smoothK = input(3, minval=1)
smoothD = input(3, minval=1)
lengthRSI = input(14, minval=1)
lengthStoch = input(14, minval=1)
src4 = input(close, title="RSI Source")
//---------------------------------------------
mfishow=input(false,"MFI Show?")
//period = input(14,title="period",type=integer,minval=1,maxval=500)
upper_s = sum(volume * (change(hlc3) <= 0 ? 0 : hlc3), 14)
lower_s = sum(volume * (change(hlc3) >= 0 ? 0 : hlc3), 14)
mfival= rsi(upper_s, lower_s)
plot(mfishow and mfival?mfival:na, color=color.red,title="MFI",linewidth=3)
//---------------------------------------------
rsi1 = rsi(src4, lengthRSI)
k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(k, smoothD)
plot(stockrsishow and k?k:na, color=color.black,linewidth=3)
plot(stockrsishow and d?d:na, color=color.aqua,linewidth=3)
//fill(h0, h1, color=purple, transp=80)
//relative momentum index coinigy 
rmishow=input(false,"RMI Show?")
Len = input(title="EMA Averaging Length", type=input.integer, defval=20, minval=1)
Mom = input(title="Lookback for Momentum", type=input.integer, defval=5, minval=1)
emaInc = ema(max(close - close[Mom], 0), Len)
emaDec = ema(max(close[Mom] - close, 0), Len)
RMI = emaDec == 0 ? 0 : 100 - 100 / (1 + emaInc / emaDec)
plot(rmishow and RMI?RMI:na, color=color.orange,title="RMI",linewidth=3)
//RMI değeri baz alınacak 50ye göre
//relative momentum index coinigy end
//---------------------------------------------
//--------Wt cross
Wtshow=input(false,"Wt Cross Show?")
n1 = input(10, "WT Channel Length")
n2 = input(21, "WT Average Length")
wtoperiod = input(4, "WT smoothing")
ap = hlc3 
esa = ema(ap, n1)
d2 = ema(abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d2)
tci = ema(ci, n2)
wt1 = tci
wt2 = sma(wt1,wtoperiod)
plot(wt1 and Wtshow?wt1:na, color=color.green,title="WT")
plot(wt2 and Wtshow?wt2:na, color=color.red,title="WTema")
//-------- wt  cross end
//9in1 hesaplama
momentum=(close/close [14]) * 100
cci=cci(hlc3,14)
//ultimate hesaplama
average(bp, tr_, length) => sum(bp, length) / sum(tr_, length)
high_ = max(high, close[1])
low_ = min(low, close[1])
bp = close - low_
tr_ = high_ - low_
avg7 = average(bp, tr_, 7)
avg14 = average(bp, tr_, 14)
avg28 = average(bp, tr_, 28)
ult= 100 * (4*avg7 + 2*avg14 + avg28)/7
willr=(highest(high,14)-close)/(highest(high,14)-lowest(low,14)) * -100
stosk=stoch(close,high,low,14)
avgshow=input(true," 9in1 Show?")
momaverage=(ult+mfival+momentum+cci+rsival+willr+stosk+wt1+RMI)/9
averageshow=input(true," 9in1 ema Show?")
momemalength=input(13," 9in1 ema length?")
momvwmalength=input(13," 9in1 vwma length?")
momema= ema(momaverage,momemalength)
vwmomema= vwma(momaverage,momvwmalength)
vwaverageshow=input(true," VW 9in1 ema Show?")
plot(avgshow and momaverage?momaverage:na, color=color.white, linewidth=1, title="9in1")
plot(averageshow and momema?momema:na, color=color.yellow, linewidth=1, title="ema9in1")
plot(vwaverageshow and vwmomema?vwmomema:na, color=color.orange, linewidth=1, title="vwema9in1")
overlay_main = input(false, title="Plot on price (rather than on indicator)")
oscsource = input(title="Divergence Source",defval="9in1", options=["RSI","MFI","9in1"])
getSOURCE(oscsource) =>
    getvalue = 0.0
    if oscsource == "RSI"
        getvalue := rsival
        getvalue
        
    if oscsource == "MFI"
        getvalue := mfival
        getvalue
        
    if oscsource == "9in1"
        getvalue := momaverage
        getvalue
    getvalue   
osc=getSOURCE(oscsource)
lbR = input(title="Pivot Lookback Right", defval=7)
lbL = input(title="Pivot Lookback Left", defval=7)
rangeUpper = input(title="Max of Lookback Range", defval=60)
rangeLower = input(title="Min of Lookback Range", defval=5)
plotBull = input(title="Plot Bullish", defval=true)
plotHiddenBull = input(title="Plot Hidden Bullish", defval=true)
plotBear = input(title="Plot Bearish", defval=true)
plotHiddenBear = input(title="Plot Hidden Bearish", defval=true)
delay_plot_til_closed = input(title="Delay plot until candle is closed (don't repaint)", defval=true)
bearColor = color.red
bullColor = color.green
hiddenBullColor = color.new(color.green, 80)
hiddenBearColor = color.new(color.red, 80)
textColor = color.white
noneColor = color.new(color.white, 100)

repaint = (not(delay_plot_til_closed) or barstate.ishistory or barstate.isconfirmed)

plFound = na(pivotlow(osc, lbL, lbR)) ? false : true
phFound = na(pivothigh(osc, lbL, lbR)) ? false : true
_inRange(cond) =>
	bars = barssince(cond == true)
	rangeLower <= bars and bars <= rangeUpper

//------------------------------------------------------------------------------
// Regular Bullish
// Osc: Higher Low

oscHL = osc[lbR] > valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])

// Price: Lower Low

priceLL = low[lbR] < valuewhen(plFound, low[lbR], 1)
bullCond = plotBull and priceLL and oscHL and plFound and repaint

plot(
     plFound ? overlay_main ? low[lbR] : osc[lbR] : na,
     offset=-lbR,
     title="Regular Bullish",
     linewidth=2,
     color=(bullCond ? bullColor : noneColor),
     transp=0
     )

plotshape(
	 bullCond ? overlay_main ? low[lbR] : osc[lbR] : na,
	 offset=-lbR,
	 title="Regular Bullish Label",
	 text=" Bull ",
	 style=shape.labelup,
	 location=location.absolute,
	 color=bullColor,
	 textcolor=textColor,
	 transp=0
	 )

//------------------------------------------------------------------------------
// Hidden Bullish
// Osc: Lower Low

oscLL = osc[lbR] < valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])

// Price: Higher Low

priceHL = low[lbR] > valuewhen(plFound, low[lbR], 1)
hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound and repaint

plot(
	 plFound ? overlay_main ? low[lbR] : osc[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bullish",
	 linewidth=2,
	 color=(hiddenBullCond ? hiddenBullColor : noneColor),
	 transp=0
	 )

plotshape(
	 hiddenBullCond ? overlay_main ? low[lbR] : osc[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bullish Label",
	 text=" H Bull ",
	 style=shape.labelup,
	 location=location.absolute,
	 color=bullColor,
	 textcolor=textColor,
	 transp=0
	 )

//------------------------------------------------------------------------------
// Regular Bearish
// Osc: Lower High

oscLH = osc[lbR] < valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])

// Price: Higher High

priceHH = high[lbR] > valuewhen(phFound, high[lbR], 1)

bearCond = plotBear and priceHH and oscLH and phFound and repaint

plot(
	 phFound ? overlay_main ? high[lbR] : osc[lbR] : na,
	 offset=-lbR,
	 title="Regular Bearish",
	 linewidth=2,
	 color=(bearCond ? bearColor : noneColor),
	 transp=0
	 )

plotshape(
	 bearCond ? overlay_main ? high[lbR] : osc[lbR] : na,
	 offset=-lbR,
	 title="Regular Bearish Label",
	 text=" Bear ",
	 style=shape.labeldown,
	 location=location.absolute,
	 color=bearColor,
	 textcolor=textColor,
	 transp=0
	 )

//------------------------------------------------------------------------------
// Hidden Bearish
// Osc: Higher High

oscHH = osc[lbR] > valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])

// Price: Lower High

priceLH = high[lbR] < valuewhen(phFound, high[lbR], 1)

hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound and repaint

plot(
	 phFound ? overlay_main ? high[lbR] : osc[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bearish",
	 linewidth=2,
	 color=(hiddenBearCond ? hiddenBearColor : noneColor),
	 transp=0
	 )

plotshape(
	 hiddenBearCond ? overlay_main ? high[lbR] : osc[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bearish Label",
	 text=" H Bear ",
	 style=shape.labeldown,
	 location=location.absolute,
	 color=bearColor,
	 textcolor=textColor,
	 transp=0
	 )
signalshow=input(true," Buy-Sell Show?")	
buycondition=crossover(momaverage,vwmomema) and vwmomema < 30
sellcondition=crossunder(momaverage,vwmomema) and vwmomema > 60
buycondition2=crossover(momema,vwmomema) and vwmomema < 30
sellcondition2=crossunder(momema,vwmomema) and vwmomema > 60
wtcondition=(crossover(wt1,wt2) and wt2 < -40) or (crossunder(wt1,wt2) and wt2 >70)
plotshape(buycondition and signalshow ? buycondition : na, title='Buy', text='Buy', location=location.bottom, style=shape.labelup, size=size.tiny, color=color.new(color.green, 0), textcolor=color.new(color.white, 0))
plotshape(sellcondition and signalshow ? sellcondition : na, title='Sell', text='Sell', location=location.top, style=shape.labeldown, size=size.tiny, color=color.new(color.red, 0), textcolor=color.new(color.white, 0))
alertcondition(buycondition, title='9in1 cross VW9in1 Buy', message='9in1 Buy!')
alertcondition(sellcondition, title='VW9in1 cross 9in1 Sell', message='9in1 Sell!')
alertcondition(buycondition or sellcondition , title='Dikkat', message='Dikkat..')
alertcondition(wtcondition, title='WTO Dikkat', message="WTO ={{wt1}}")
Editor is loading...
Leave a Comment