// Keterangan Gambar
// B (Hijau) - Indikator Buy dari GC MA5 & MA20
// B (Kuning) - Indikator Buy dari Bollinger Band
// Logo ✪ - Volume Spike (Buy/Sell)
//version=4
study("Cross SMA (5,20) - BB", "", true, overlay=true)
// Tentuin SMA
SMA20 = sma(close, 20)
SMA5 = sma(close, 5)
// Setup
xUp = crossover(SMA20, SMA5)
xDw = crossover(SMA5, SMA20)
// Alert
if xUp
// Trigger the alert the first time a cross occurs during the real-time bar.
alert("SMA20 (" + tostring(close) + ") cruzou SMA5 (" + tostring(SMA20) + ").", alert.freq_once_per_bar)
if xDw
alert("SMA20 (" + tostring(close) + ") cruzou SMA5 (" + tostring(SMA20) + ").", alert.freq_once_per_bar)
// Visual
plot(SMA20, color=color.red, transp=100)
plot(SMA5, color=color.blue, transp=100)
plotshape(xUp, location=location.abovebar, style=shape.labeldown, color=color.red, size=size.small, text="S", textcolor=color.white, transp=50, offset=0)
plotshape(xDw, location=location.belowbar, style=shape.labelup, color=color.green, size=size.small, text="B", textcolor=color.white, transp=50, offset=0)
// BB
sigma = input(1.8, maxval=2.0, title="Standard Deviation")
ma_period = input(30, minval=1, title="Simple MA period")
rsi_period = input(14, minval=5, title="RSI Period")
rsi_ob = input(65, maxval=100, title="RSI Overbought threshold")
src = close
basis = sma(src, ma_period)
std_dev = sigma * stdev(src, ma_period)
upper = basis + std_dev
lower = basis - std_dev
below = src < lower
reset = low < basis
above = src > upper
buy_signal = crossunder(barssince(above), barssince(reset)) and rsi(close, rsi_period) < rsi_ob
plotshape(buy_signal, color=color.yellow, style=shape.labelup, size=size.small, location=location.belowbar, text="B", textcolor=color.white, transp=50, offset=0)
upper_plot = plot(upper, color=color.gray, color=bar_index % 2 == 0 ? color.gray : #00000000, linewidth=1, transp=20, title = "Upper Band")
lower_plot = plot(lower, color=color.gray, color=bar_index % 2 == 0 ? color.gray : #00000000, linewidth=1, transp=20, title = "Lower Band")
fill(lower_plot, upper_plot, color=color.gray, transp=95)
// Volume Spike
EMovingAvg = ema(volume,input(10))
Multiplier=(volume >= (EMovingAvg * input(1.5)))
//plotshape(Multiplier, size=size.tiny, style=shape.xcross, location=location.belowbar, color=color.fuchsia)
plotchar (Multiplier, size=size.tiny, location=location.belowbar, color=color.fuchsia, char="✪")
// 5 MA
sma1 = sma(close, 10)
sma2 = sma(close, 20)
plot(sma1, title="SMA10", color = color.yellow, linewidth = 1, transp=50)
plot(sma2, title="SMA20", color = color.orange, linewidth = 1, transp=50)
sma3 = sma(close, 50)
sma4 = sma(close, 100)
sma5 = sma(close, 200)
plot(sma3, title="SMA50", color = color.white, linewidth = 1, transp=50)
plot(sma4, title="SMA100", color = color.blue, linewidth = 1, transp=50)
plot(sma5, title="SMA200", color = color.red, linewidth = 1, transp=50)
//plot(cross(sma1, sma3) ? sma1 : na, style = plot.style_cross, color = color.red, linewidth = 4)
// Fibo
Fibs = input("Plot Fibs based on Lookback", options = ["Plot Fibs based on Lookback", "Plot Fibs based on Price Input"], title = "Fibonacci Plot Type")
FIBS = Fibs == "Plot Fibs based on Lookback"?1:Fibs == "Plot Fibs based on Price Input"?2:na
Foption = input(defval = "1. Candles" , title = "Fibonacci Plot Lookback Type", options=["2. Days", "1. Candles"])
FP = input(defval = 100 , title = "Days/Candles to Lookback")
Reverse = input(defval = false , title = "Reverse Fibonacci Levels?")
ExtraFibs = input(false, "Show 0.886 and 1.113 Fibs")
Note = input(true, "â•â•â•â• ð—™ð—¶ð—¯ð˜€ ð—¯ð—®ð˜€ð—²ð—± ð—¼ð—» ð—£ð—¿ð—¶ð—°ð—² ð—œð—»ð—½ð˜‚ð˜ â•â•â•â•")
High = input(0., minval = 0, title = "High - Enter Value")
Low = input(-1., minval = -1, title = "Low - Enter Value")
Note2 = input(true, "â•â•â•â•â•â• ð—™ð—¶ð—¯ ð—Ÿð—¶ð—»ð—²/ð—Ÿð—®ð—¯ð—²ð—¹ ð—¦ð˜ð˜†ð—¹ð—² â•â•â•â•â•â•")
Bull_Color = input(#008000, type=input.color, title = "Support Fibs Color")
Bear_Color = input(#ff0000, type=input.color, title = "Resistance Fibs Color")
CurrentFib = input(false, "Show Fib Level of Current Price")
Current_Color = input(color.orange, type=input.color, title = "Current Fib Label Color")
LineStyle = input("Dotted", options = ["Dotted", "Solid"], title = "Fib Line Style")
LineWidth = input(1, minval=1, maxval=3,title = "Fib Line Width")
Ext = input(false, "Extend Lines Left")
// Transparency = input("Low", options = ["High", "Medium", "Low"], title="Fib Line Transparency")
BullColor = Bull_Color//Transparency == "High"?color.new(#008000,75):Transparency == "Medium"?color.new(#008000,50):Bull_Color
BearColor = Bear_Color//Transparency == "High"?color.new(#ff0000,75):Transparency == "Medium"?color.new(#ff0000,50):Bear_Color
FPeriod = timeframe.isintraday and Foption=="2. Days"? (1440/timeframe.multiplier)*FP:
timeframe.isdaily and Foption=="2. Days"? FP/timeframe.multiplier:
timeframe.isweekly and Foption=="2. Days"? FP/(7*timeframe.multiplier):
timeframe.ismonthly and Foption=="2. Days"? FP/(28*timeframe.multiplier):
Foption=="1. Candles"? FP:100
Fhigh = FIBS==1? highest(FPeriod) : FIBS == 2 and High == 0? highest(high,100): FIBS == 2 and High!=0? High:na
Flow = FIBS==1? lowest(FPeriod) : FIBS == 2 and Low == -1? lowest(low,100): FIBS == 2 and High!=-1? Low:na
FH = FIBS == 1?highestbars(high,FPeriod): 1
FL = FIBS == 1?lowestbars(low,FPeriod): 2
revfibs = not Reverse? FL>FH : FL<FH
Fib_x(n) =>
revfibs ? (Fhigh-Flow)*n+Flow : Fhigh-(Fhigh-Flow)*n
Current = revfibs?(close-Flow)/(Fhigh-Flow):(Fhigh-close)/(Fhigh-Flow)
var label Current_Fib_Label = na
label.delete(Current_Fib_Label)
if(CurrentFib and barstate.islast)
Current_Fib_Label := label.new(bar_index, close, tostring(Current, "##.##"), textcolor = Current_Color, color = color.new(#000000,100), style=label.style_label_left, yloc=yloc.price)
EXTEND = Ext?extend.left:extend.none
STYLE = LineStyle=="Dotted"?line.style_dotted:line.style_solid
WIDTH = LineWidth
BB = FIBS==1?(FL<FH?bar_index[-FL]:bar_index[-FH]):FIBS==2?bar_index[50]:bar_index[50]
Fib_line(x) =>
var line ln = na
line.delete(ln)
ln:=line.new(BB, x, bar_index, x, color = close>x? BullColor:BearColor, extend=EXTEND ,style=STYLE, width = WIDTH)
Fib_label(x,_txt) =>
var label lbl = na
label.delete(lbl)
lbl:=label.new(bar_index, x, _txt + tostring(x, "##.########") + " )", textcolor = close>x?BullColor:BearColor, color = color.new(#000000,100), style=label.style_label_left, yloc=yloc.price)
Fib0 = Fib_line(Fib_x(0))
Fib236 = Fib_line(Fib_x(0.236))
Fib382 = Fib_line(Fib_x(0.382))
Fib500 = Fib_line(Fib_x(0.500))
Fib618 = Fib_line(Fib_x(0.618))
Fib786 = Fib_line(Fib_x(0.786))
Fib1000 = Fib_line(Fib_x(1.000))
Fib886 = ExtraFibs?Fib_line(Fib_x(0.886)):na
if(FIBS==2)
Fib1113 = ExtraFibs?Fib_line(Fib_x(1.113)):na
Fib1272 = Fib_line(Fib_x(1.272))
Fib1618 = Fib_line(Fib_x(1.618))
Fib2000 = Fib_line(Fib_x(2.000))
Fib2236 = Fib_line(Fib_x(2.236))
Fib2618 = Fib_line(Fib_x(2.618))
Fib3236 = Fib_line(Fib_x(3.236))
Fib3618 = Fib_line(Fib_x(3.618))
Fib4236 = Fib_line(Fib_x(4.236))
Fib4618 = Fib_line(Fib_x(4.618))
LFib0 = Fib_label(Fib_x(0), "0 ( ")
LFib236 = Fib_label(Fib_x(0.236), "0.236 ( ")
LFib382 = Fib_label(Fib_x(0.382), "0.382 ( ")
LFib500 = Fib_label(Fib_x(0.500), "0.500 ( ")
LFib618 = Fib_label(Fib_x(0.618), "0.618 ( ")
LFib786 = Fib_label(Fib_x(0.786), "0.786 ( ")
LFib1000 = Fib_label(Fib_x(1.000), "1.000 ( ")
LFib886 = ExtraFibs?Fib_label(Fib_x(0.886), "0.886 ( "):na
if(FIBS==2)
LFib1113 = ExtraFibs?Fib_label(Fib_x(1.113), "1.113 ( "):na
LFib1272 = Fib_label(Fib_x(1.272), "1.272 ( ")
LFib1618 = Fib_label(Fib_x(1.618), "1.618 ( ")
LFib2000 = Fib_label(Fib_x(2.000), "2.000 ( ")
LFib2236 = Fib_label(Fib_x(2.236), "2.236 ( ")
LFib2618 = Fib_label(Fib_x(2.618), "2.618 ( ")
LFib3236 = Fib_label(Fib_x(3.236), "3.236 ( ")
LFib3618 = Fib_label(Fib_x(3.618), "3.618 ( ")
LFib4236 = Fib_label(Fib_x(4.236), "4.236 ( ")
LFib4618 = Fib_label(Fib_x(4.618), "4.618 ( ")
// B (Hijau) - Indikator Buy dari GC MA5 & MA20
// B (Kuning) - Indikator Buy dari Bollinger Band
// Logo ✪ - Volume Spike (Buy/Sell)
//version=4
study("Cross SMA (5,20) - BB", "", true, overlay=true)
// Tentuin SMA
SMA20 = sma(close, 20)
SMA5 = sma(close, 5)
// Setup
xUp = crossover(SMA20, SMA5)
xDw = crossover(SMA5, SMA20)
// Alert
if xUp
// Trigger the alert the first time a cross occurs during the real-time bar.
alert("SMA20 (" + tostring(close) + ") cruzou SMA5 (" + tostring(SMA20) + ").", alert.freq_once_per_bar)
if xDw
alert("SMA20 (" + tostring(close) + ") cruzou SMA5 (" + tostring(SMA20) + ").", alert.freq_once_per_bar)
// Visual
plot(SMA20, color=color.red, transp=100)
plot(SMA5, color=color.blue, transp=100)
plotshape(xUp, location=location.abovebar, style=shape.labeldown, color=color.red, size=size.small, text="S", textcolor=color.white, transp=50, offset=0)
plotshape(xDw, location=location.belowbar, style=shape.labelup, color=color.green, size=size.small, text="B", textcolor=color.white, transp=50, offset=0)
// BB
sigma = input(1.8, maxval=2.0, title="Standard Deviation")
ma_period = input(30, minval=1, title="Simple MA period")
rsi_period = input(14, minval=5, title="RSI Period")
rsi_ob = input(65, maxval=100, title="RSI Overbought threshold")
src = close
basis = sma(src, ma_period)
std_dev = sigma * stdev(src, ma_period)
upper = basis + std_dev
lower = basis - std_dev
below = src < lower
reset = low < basis
above = src > upper
buy_signal = crossunder(barssince(above), barssince(reset)) and rsi(close, rsi_period) < rsi_ob
plotshape(buy_signal, color=color.yellow, style=shape.labelup, size=size.small, location=location.belowbar, text="B", textcolor=color.white, transp=50, offset=0)
upper_plot = plot(upper, color=color.gray, color=bar_index % 2 == 0 ? color.gray : #00000000, linewidth=1, transp=20, title = "Upper Band")
lower_plot = plot(lower, color=color.gray, color=bar_index % 2 == 0 ? color.gray : #00000000, linewidth=1, transp=20, title = "Lower Band")
fill(lower_plot, upper_plot, color=color.gray, transp=95)
// Volume Spike
EMovingAvg = ema(volume,input(10))
Multiplier=(volume >= (EMovingAvg * input(1.5)))
//plotshape(Multiplier, size=size.tiny, style=shape.xcross, location=location.belowbar, color=color.fuchsia)
plotchar (Multiplier, size=size.tiny, location=location.belowbar, color=color.fuchsia, char="✪")
// 5 MA
sma1 = sma(close, 10)
sma2 = sma(close, 20)
plot(sma1, title="SMA10", color = color.yellow, linewidth = 1, transp=50)
plot(sma2, title="SMA20", color = color.orange, linewidth = 1, transp=50)
sma3 = sma(close, 50)
sma4 = sma(close, 100)
sma5 = sma(close, 200)
plot(sma3, title="SMA50", color = color.white, linewidth = 1, transp=50)
plot(sma4, title="SMA100", color = color.blue, linewidth = 1, transp=50)
plot(sma5, title="SMA200", color = color.red, linewidth = 1, transp=50)
//plot(cross(sma1, sma3) ? sma1 : na, style = plot.style_cross, color = color.red, linewidth = 4)
// Fibo
Fibs = input("Plot Fibs based on Lookback", options = ["Plot Fibs based on Lookback", "Plot Fibs based on Price Input"], title = "Fibonacci Plot Type")
FIBS = Fibs == "Plot Fibs based on Lookback"?1:Fibs == "Plot Fibs based on Price Input"?2:na
Foption = input(defval = "1. Candles" , title = "Fibonacci Plot Lookback Type", options=["2. Days", "1. Candles"])
FP = input(defval = 100 , title = "Days/Candles to Lookback")
Reverse = input(defval = false , title = "Reverse Fibonacci Levels?")
ExtraFibs = input(false, "Show 0.886 and 1.113 Fibs")
Note = input(true, "â•â•â•â• ð—™ð—¶ð—¯ð˜€ ð—¯ð—®ð˜€ð—²ð—± ð—¼ð—» ð—£ð—¿ð—¶ð—°ð—² ð—œð—»ð—½ð˜‚ð˜ â•â•â•â•")
High = input(0., minval = 0, title = "High - Enter Value")
Low = input(-1., minval = -1, title = "Low - Enter Value")
Note2 = input(true, "â•â•â•â•â•â• ð—™ð—¶ð—¯ ð—Ÿð—¶ð—»ð—²/ð—Ÿð—®ð—¯ð—²ð—¹ ð—¦ð˜ð˜†ð—¹ð—² â•â•â•â•â•â•")
Bull_Color = input(#008000, type=input.color, title = "Support Fibs Color")
Bear_Color = input(#ff0000, type=input.color, title = "Resistance Fibs Color")
CurrentFib = input(false, "Show Fib Level of Current Price")
Current_Color = input(color.orange, type=input.color, title = "Current Fib Label Color")
LineStyle = input("Dotted", options = ["Dotted", "Solid"], title = "Fib Line Style")
LineWidth = input(1, minval=1, maxval=3,title = "Fib Line Width")
Ext = input(false, "Extend Lines Left")
// Transparency = input("Low", options = ["High", "Medium", "Low"], title="Fib Line Transparency")
BullColor = Bull_Color//Transparency == "High"?color.new(#008000,75):Transparency == "Medium"?color.new(#008000,50):Bull_Color
BearColor = Bear_Color//Transparency == "High"?color.new(#ff0000,75):Transparency == "Medium"?color.new(#ff0000,50):Bear_Color
FPeriod = timeframe.isintraday and Foption=="2. Days"? (1440/timeframe.multiplier)*FP:
timeframe.isdaily and Foption=="2. Days"? FP/timeframe.multiplier:
timeframe.isweekly and Foption=="2. Days"? FP/(7*timeframe.multiplier):
timeframe.ismonthly and Foption=="2. Days"? FP/(28*timeframe.multiplier):
Foption=="1. Candles"? FP:100
Fhigh = FIBS==1? highest(FPeriod) : FIBS == 2 and High == 0? highest(high,100): FIBS == 2 and High!=0? High:na
Flow = FIBS==1? lowest(FPeriod) : FIBS == 2 and Low == -1? lowest(low,100): FIBS == 2 and High!=-1? Low:na
FH = FIBS == 1?highestbars(high,FPeriod): 1
FL = FIBS == 1?lowestbars(low,FPeriod): 2
revfibs = not Reverse? FL>FH : FL<FH
Fib_x(n) =>
revfibs ? (Fhigh-Flow)*n+Flow : Fhigh-(Fhigh-Flow)*n
Current = revfibs?(close-Flow)/(Fhigh-Flow):(Fhigh-close)/(Fhigh-Flow)
var label Current_Fib_Label = na
label.delete(Current_Fib_Label)
if(CurrentFib and barstate.islast)
Current_Fib_Label := label.new(bar_index, close, tostring(Current, "##.##"), textcolor = Current_Color, color = color.new(#000000,100), style=label.style_label_left, yloc=yloc.price)
EXTEND = Ext?extend.left:extend.none
STYLE = LineStyle=="Dotted"?line.style_dotted:line.style_solid
WIDTH = LineWidth
BB = FIBS==1?(FL<FH?bar_index[-FL]:bar_index[-FH]):FIBS==2?bar_index[50]:bar_index[50]
Fib_line(x) =>
var line ln = na
line.delete(ln)
ln:=line.new(BB, x, bar_index, x, color = close>x? BullColor:BearColor, extend=EXTEND ,style=STYLE, width = WIDTH)
Fib_label(x,_txt) =>
var label lbl = na
label.delete(lbl)
lbl:=label.new(bar_index, x, _txt + tostring(x, "##.########") + " )", textcolor = close>x?BullColor:BearColor, color = color.new(#000000,100), style=label.style_label_left, yloc=yloc.price)
Fib0 = Fib_line(Fib_x(0))
Fib236 = Fib_line(Fib_x(0.236))
Fib382 = Fib_line(Fib_x(0.382))
Fib500 = Fib_line(Fib_x(0.500))
Fib618 = Fib_line(Fib_x(0.618))
Fib786 = Fib_line(Fib_x(0.786))
Fib1000 = Fib_line(Fib_x(1.000))
Fib886 = ExtraFibs?Fib_line(Fib_x(0.886)):na
if(FIBS==2)
Fib1113 = ExtraFibs?Fib_line(Fib_x(1.113)):na
Fib1272 = Fib_line(Fib_x(1.272))
Fib1618 = Fib_line(Fib_x(1.618))
Fib2000 = Fib_line(Fib_x(2.000))
Fib2236 = Fib_line(Fib_x(2.236))
Fib2618 = Fib_line(Fib_x(2.618))
Fib3236 = Fib_line(Fib_x(3.236))
Fib3618 = Fib_line(Fib_x(3.618))
Fib4236 = Fib_line(Fib_x(4.236))
Fib4618 = Fib_line(Fib_x(4.618))
LFib0 = Fib_label(Fib_x(0), "0 ( ")
LFib236 = Fib_label(Fib_x(0.236), "0.236 ( ")
LFib382 = Fib_label(Fib_x(0.382), "0.382 ( ")
LFib500 = Fib_label(Fib_x(0.500), "0.500 ( ")
LFib618 = Fib_label(Fib_x(0.618), "0.618 ( ")
LFib786 = Fib_label(Fib_x(0.786), "0.786 ( ")
LFib1000 = Fib_label(Fib_x(1.000), "1.000 ( ")
LFib886 = ExtraFibs?Fib_label(Fib_x(0.886), "0.886 ( "):na
if(FIBS==2)
LFib1113 = ExtraFibs?Fib_label(Fib_x(1.113), "1.113 ( "):na
LFib1272 = Fib_label(Fib_x(1.272), "1.272 ( ")
LFib1618 = Fib_label(Fib_x(1.618), "1.618 ( ")
LFib2000 = Fib_label(Fib_x(2.000), "2.000 ( ")
LFib2236 = Fib_label(Fib_x(2.236), "2.236 ( ")
LFib2618 = Fib_label(Fib_x(2.618), "2.618 ( ")
LFib3236 = Fib_label(Fib_x(3.236), "3.236 ( ")
LFib3618 = Fib_label(Fib_x(3.618), "3.618 ( ")
LFib4236 = Fib_label(Fib_x(4.236), "4.236 ( ")
LFib4618 = Fib_label(Fib_x(4.618), "4.618 ( ")
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
