NORMALİZED MACD formülü:
study("Normalized MACD",shorttitle='N MACD')
sma = input(12,title='Fast MA')
lma = input(21,title='Slow MA')
tsp = input(9,title='Trigger')
np = input(50,title='Normalize')
h=input(true,title='Histogram')
docol = input(false,title="Color Change")
dofill=input(false,title="Fill")
type = input(1,minval=1,maxval=3,title="1=Ema, 2=Wma, 3=Sma")
sh = type == 1 ? ema(close,sma)
: type == 2 ? wma(close, sma)
: sma(close, sma)
lon=type == 1 ? ema(close,lma)
: type == 2 ? wma(close, lma)
: sma(close, lma)
ratio = min(sh,lon)/max(sh,lon)
Mac = (iff(sh>lon,2-ratio,ratio)-1)
MacNorm = ((Mac-lowest(Mac, np)) /(highest(Mac, np)-lowest(Mac, np)+.000001)*2)- 1
MacNorm2 = iff(np<2,Mac,MacNorm)
Trigger = wma(MacNorm2, tsp)
Hist = (MacNorm2-Trigger)
Hist2 = Hist>1?1:Hist<-1?-1:Hist
swap=Hist2>Hist2[1]?green:red
swap2 = docol ? MacNorm2 > MacNorm2[1] ? #0094FF : #FF006E : red
plot(h?Hist2:na,color=swap,style=columns,title='Hist',histbase=0)
plot(MacNorm2,color=swap2,title='MacNorm')
plot(dofill?MacNorm2:na,color=MacNorm2>0?green:red,style=columns)
plot(Trigger,color=yellow,title='Trigger')
hline(0)
RSI BANDS formülü:
//
// @author LazyBear
// List of all my indicators: https://www.tradingview.com/v/4IneGo8h/
//
study("RSI Bands [LazyBear]", shorttitle="RSIBANDS_LB", overlay=true)
obLevel = input(70, title="RSI Overbought")
osLevel = input(30, title="RSI Oversold")
length = input(14, title="RSI Length")
src=close
ep = 2 * length - 1
auc = ema( max( src - src[1], 0 ), ep )
adc = ema( max( src[1] - src, 0 ), ep )
x1 = (length - 1) * ( adc * obLevel / (100-obLevel) - auc)
ub = iff( x1 >= 0, src + x1, src + x1 * (100-obLevel)/obLevel )
x2 = (length - 1) * ( adc * osLevel / (100-osLevel) - auc)
lb = iff( x2 >= 0, src + x2, src + x2 * (100-osLevel)/osLevel )
plot( ub, title="Resistance", color=red, linewidth=2)
plot( lb, title="Support", color=green, linewidth=2)
plot( avg(ub, lb), title="RSI Midline", color=gray, linewidth=1)
Verdiğiniz
"LazyBear için aşağıdaki linke kontrol sağlayabilirsiniz.
https://www.algokutuphanesi.com/Sistem/Detay/MatriksIq/SQMI-Squeeze-Momemtum" linkini indikatör olarak tanımladım ancak son kod satırı olan satırda "string türü örtülü olarak <int string> türüne dönüştürülemiyor." şeklinde hata aldım, bunu nasıl çözebilirim?
"PointColors[currentBar] =lrl.Value[0][lrl.CurrentIndex-1]>lrl.Value[0][lrl.CurrentIndex]? "#3c6300":"#98fb00";
}else
{
PointColors[currentBar] = lrl.Value[0][lrl.CurrentIndex-1]<lrl.Value[0][lrl.CurrentIndex]?"#b80013":"#ff051f";
}
}
}
}"