-- Support & Ressittant -
instrument {
name = 'Support And Resistance',
icon = 'indicators:MA',
overlay = true
}
tf = {"1s", "5s", "10s", "15s", "30s", "1m", "2m", "5m", "10m", "15m", "30m", "1H",
"2H", "4H", "8H", "12H", "1D", "1W", "1M", "1Y"}
candle_tf1 = input(10, "Support 1 and Resistance 1 ", input.string_selection,tf)
candle_tf2 = input(12, "Support 2 and Resistance 2 ", input.string_selection,tf)
input_group {
"Support 1",
colorSupport1 = input { default = "rgba(50, 205, 50, 0)", type = input.color },
widthSupport1 = input { default = 1, type = input.line_width}
}
input_group {
"Support 2",
colorSupport2 = input { default = "rgba(50, 205, 50, 0)", type = input.color },
widthSupport2 = input { default = 2, type = input.line_width}
}
input_group {
"Resistance 1",
colorResistance1 = input { default = "rgba(255, 0, 0, 0)", type = input.color },
widthResistance1 = input { default = 1, type = input.line_width}
}
input_group {
"Resistance 2",
colorResistance2 = input { default = "rgba(255, 0, 0, 0)", type = input.color },
widthResistance2 = input { default = 2, type = input.line_width}
}
sec1 = security (current_ticker_id, tf[candle_tf1])
sec2 = security (current_ticker_id, tf[candle_tf2])
sup1 = lowest(sec1.low, 1)
sup2 = lowest(sec2.low, 1)
Res1 = highest(sec1.high, 1)
Res2 = highest(sec2.high, 1)
if sec1 and sec2 then
if (sec2.close > sec2.open) then
fill (sec2.close, sec2.high, "Supply1", sec2.high > sec2.close and
"rgba(250, 128, 114, 0.2)")
end
if (sec2.close < sec2.open) then
fill (sec2.close, sec2.low, "Supply2", sec2.low < sec2.close and "rgba(152,
251, 152, 0.2)")
end
plot(sup1[0],"Support 1", colorSupport1, widthSupport1,0, style.levels,
na_mode.continue)
plot(sup2[0],"Support 2", colorSupport2, widthSupport2,0, style.levels,
na_mode.continue)
plot(Res1[0],"Resistance 1", colorResistance1, widthResistance1,0,
style.levels, na_mode.continue)
plot(Res2[0],"Resistance 2", colorResistance2, widthResistance2,0,
style.levels, na_mode.continue)
end
instrument{name="Ronin SUPORT/REST",icon='https://bit.ly/3C8cIFQ',overlay=true}
local function a()local
b=make_series()local c=high[2]
if not get_value(c)then
return b end;
local d=high<=c and high[1]<=c and high[3]<=c and high[4]<=c;
b:set(iff(d,c,b[1]))return b end;
local function e()local b=make_series()local c=low[2]if not get_value(c)then return
b end;
local d=low>=c and low[1]>=c and low[3]>=c and low[4]>=c;
b:set(iff(d,c,b[1]))return b end;
input_group{"Color",color=input{default="rgba(0, 115, 255,
1)",type=input.color},width=input{default=1,type=input.line_width}}h=a()l=e()hline(
h,"High",color,high_width)hline(l,"Low",color,width)hline(highest(10)
[1],"HH10",color,1)hline(lowest(10)[1],"LL10",color,1)hline(highest(30)
[1],"HH30",color,1)hline(lowest(30)[1],"LL30",color,1)hline(highest(60)
[1],"HH60",color,1)hline(lowest(60)[1],"LL60",color,1)hline(highest(100)
[1],"HH100",color,1)hline(lowest(100)[1],"LL100",color,1)hline(highest(150)
[1],"HH150",color,1)hline(lowest(150)[1],"LL150",color,1)hline(highest(200)
[1],"HH200",color,1)hline(lowest(200)[1],"LL200",color,1)
instrument {
name = ' BB+RSI strategy BUY-SELL',
icon = 'indicators:MA',
overlay = true
}
BB_length = input(14, "BB_length", input.integer, 1)
BB_sdev = input(2.1, "BB_sdev", input.double, 0.001)
----BB
dev = BB_sdev * stdev(close, BB_length)
upperb = sma(close, BB_length) + dev
medium = sma(close, BB_length)
lowerb = sma(close, BB_length) - dev
plot(upperb, "upperb", "rgb(195, 0, 255, 0)" )
plot(lowerb, "lowerb", "rgb(195, 0, 255, 0)" )
fill(lowerb, upperb, "", rgba(32, 202, 396, 0))
--RSI
source = input(1, "Source", input.string_selection, inputs.titles)
local src = inputs[source]
len = input(2, "RSI Period", input.integer, 1)
lowerr = input(20, "lowerr", input.double, 0, 100, 1)
upperr = input(80, "upperr", input.double, 0, 100, 1)
rsx = rsi(src, len)
--print(rsx)
-----BB+RSI Strategy ---------------
showIndicator = (rsx > upperr and close > open and close[1] > open[1]) or (rsx <
lowerr and close < open and close[1] < open[1])
--print(showIndicator)
if showIndicator == true then
sell = rsx > upperr and (close > upperb)
buy = rsx < lowerr and (close < lowerb)
plot_shape(sell, "sell", shape_style.arrowdown, shape_size.huge, "red",
shape_location.abovebar, 0, " SELL ", "White")
plot_shape(buy, "buy", shape_style.arrowup, shape_size.huge, "lime",
shape_location.belowbar, 0, "BUY", "White")
end
--DC--
instrument { name = "Donchian Channels_20", overlay = true }
period = input (20, "front.period", input.integer, 1, 200)
input_group {
"front.top line",
upper_line_visible = input { default = true, type = input.plot_visibility },
upper_line_color = input { default = "#ff0000", type = input.color },
upper_line_width = input { default = 3, type = input.line_width }
}
input_group {
"front.middle line",
middle_line_visible = input { default = true, type = input.plot_visibility },
middle_line_color = input { default = "rgba(255, 255, 255, 0)", type =
input.color },
middle_line_width = input { default = 1, type = input.line_width }
}
input_group {
"front.bottom line",
lower_line_visible = input { default = true, type = input.plot_visibility },
lower_line_color = input { default = "#66ff33", type = input.color },
lower_line_width = input { default = 3, type = input.line_width }
}
input_group {
"front.newind.adx.fill",
fill_visible = input { default = true, type = input.plot_visibility },
fill_color = input { default = rgba(35,132,194,0), type = input.color },
}
upper = highest (high, period)
lower = lowest (low, period)
middle = (upper + lower) / 2
if fill_visible then
fill { first = upper, second = lower, color = fill_color }
end
if upper_line_visible then
plot (upper, "front.top line", upper_line_color, upper_line_width)
end
if lower_line_visible then
plot (lower, "front.bottom line", lower_line_color, lower_line_width)
end
if middle_line_visible then
plot (middle, "front.middle line", middle_line_color, middle_line_width)
end
--- ZIGZAG Liner 1 - Point 1 ---
instrument { name = "ZigZag", overlay = true }
percentage = input (1, "Percentage", input.double, 0.01, 100, 1.0) / 100
period = 3
input_group {
"front.ind.dpo.generalline",
up_color = input { default = "#0000ff", type = input.color },
down_color = input { default = "#ffff00", type = input.color },
width = input { default = 3, type = input.line_width }
}
local reference = make_series ()
reference:set(nz(reference[1], high))
local is_direction_up = make_series ()
is_direction_up:set(nz(is_direction_up[1], true))
local htrack = make_series ()
local ltrack = make_series ()
local pivot = make_series ()
reverse_range = reference * percentage / 100
if get_value (is_direction_up) then
htrack:set (max(high, nz(htrack[1], high)))
if close < htrack[1] - reverse_range then
pivot:set (htrack)
is_direction_up:set (false)
reference:set(htrack)
end
else
ltrack:set (min(low, nz(ltrack[1], low)))
if close > ltrack[1] + reverse_range then
pivot:set (ltrack)
is_direction_up:set(true)
reference:set (ltrack)
end
end
color = is_direction_up() and up_color or down_color
plot(pivot, 'ZZ', color, width, -1, style.solid_line, na_mode.continue)
instrument { name = "ZIGZAG LINER 0.9", overlay = true }
percentage = input (1, "Percentage", input.double, 0.01, 100, 1.0) / 100
period = 3
input_group {
"front.ind.dpo.generalline",
up_color = input { default = "#ffff00", type = input.color },
down_color = input { default = "#0000ff", type = input.color },
width = input { default = 6, type = input.line_width }
}
local reference = make_series ()
reference:set(nz(reference[1], high))
local is_direction_up = make_series ()
is_direction_up:set(nz(is_direction_up[1], true))
local htrack = make_series ()
local ltrack = make_series ()
local pivot = make_series ()
reverse_range = reference * percentage / 100
if get_value (is_direction_up) then
htrack:set (max(high, nz(htrack[1], high)))
if close < htrack[1] - reverse_range then
pivot:set (htrack)
is_direction_up:set (false)
reference:set(htrack)
end
else
ltrack:set (min(low, nz(ltrack[1], low)))
if close > ltrack[1] + reverse_range then
pivot:set (ltrack)
is_direction_up:set(true)
reference:set (ltrack)
end
end
color = is_direction_up() and up_color or down_color
plot(pivot, 'ZZ', color, width, -1, style.dash_line, na_mode.continue)
instrument {
name = 'ZigZag POINT 1',
short_name = 'RONIN_TRADER',
icon = "https://cdn.pic.in.th/file/picinth/attachment_109235168.png",
overlay = true
}
percentage = input (1, "Percentage", input.double, 0.01, 100, 1.0) / 100
period = 3
input_group {
"front.ind.dpo.generalline",
up_color = input { default = "rgba(255, 98, 0, 0.5)", type = input.color },
down_color = input { default = "rgba(158, 255, 62, 0.5)", type = input.color },
width = input { default = 5, type = input.line }
}
local reference = make_series ()
reference:set(nz(reference[1], high))
local is_direction_up = make_series ()
is_direction_up:set(nz(is_direction_up[1], true))
local htrack = make_series ()
local ltrack = make_series ()
local pivot = make_series ()
reverse_range = reference * percentage / 100
if get_value (is_direction_up) then
htrack:set (max(high, nz(htrack[1], high)))
if close < htrack[1] - reverse_range then
pivot:set (htrack)
is_direction_up:set (false)
reference:set(htrack)
end
else
ltrack:set (min(low, nz(ltrack[1], low)))
if close > ltrack[1] + reverse_range then
pivot:set (ltrack)
is_direction_up:set(true)
reference:set (ltrack)
end
end
color = is_direction_up() and up_color or down_color
plot(pivot, 'ZZ', color, width, -1, style.points, na_mode.continue)
instrument { name = "ZIGZAG POINT 1", overlay = true }
percentage = input (1, "Percentage", input.double, 0.01, 100, 1.0) / 100
period = 3
input_group {
"front.ind.dpo.generalline",
up_color = input { default = "#64FF1C", type = input.color },
down_color = input { default = "#ff0008", type = input.color },
width = input { default = 2, type = input.line }
}
local reference = make_series ()
reference:set(nz(reference[1], high))
local is_direction_up = make_series ()
is_direction_up:set(nz(is_direction_up[1], true))
local htrack = make_series ()
local ltrack = make_series ()
local pivot = make_series ()
reverse_range = reference * percentage / 100
if get_value (is_direction_up) then
htrack:set (max(high, nz(htrack[1], high)))
if close < htrack[1] - reverse_range then
pivot:set (htrack)
is_direction_up:set (false)
reference:set(htrack)
end
else
ltrack:set (min(low, nz(ltrack[1], low)))
if close > ltrack[1] + reverse_range then
pivot:set (ltrack)
is_direction_up:set(true)
reference:set (ltrack)
end
end
color = is_direction_up() and up_color or down_color
plot(pivot, 'ZZ', color, width, -1, style.points, na_mode.continue)
instrument { name = "ZIGZAG POINT 1", overlay = true }
percentage = input (1, "Percentage", input.double, 0.01, 100, 1.0) / 100
period = 3
input_group {
"front.ind.dpo.generalline",
up_color = input { default = "rgba(255, 255, 255, 0.6)", type = input.color },
down_color = input { default = "rgba(255, 255, 255, 0.6)", type =
input.color },
width = input { default = 1, type = input.line }
}
local reference = make_series ()
reference:set(nz(reference[1], high))
local is_direction_up = make_series ()
is_direction_up:set(nz(is_direction_up[1], true))
local htrack = make_series ()
local ltrack = make_series ()
local pivot = make_series ()
reverse_range = reference * percentage / 100
if get_value (is_direction_up) then
htrack:set (max(high, nz(htrack[1], high)))
if close < htrack[1] - reverse_range then
pivot:set (htrack)
is_direction_up:set (false)
reference:set(htrack)
end
else
ltrack:set (min(low, nz(ltrack[1], low)))
if close > ltrack[1] + reverse_range then
pivot:set (ltrack)
is_direction_up:set(true)
reference:set (ltrack)
end
end
color = is_direction_up() and up_color or down_color
plot(pivot, 'ZZ', color, width, -1, style.points, na_mode.continue)
instrument { name = "ZIGZAG POINT 1_2", overlay = true }
percentage = input (1, "Percentage", input.double, 0.01, 100, 1.0) / 100
period = 3
input_group {
"front.ind.dpo.generalline",
up_color = input { default = "#64FF1C", type = input.color },
down_color = input { default = "#ff0008", type = input.color },
width = input { default = 2, type = input.line }
}
local reference = make_series ()
reference:set(nz(reference[1], high))
local is_direction_up = make_series ()
is_direction_up:set(nz(is_direction_up[1], true))
local htrack = make_series ()
local ltrack = make_series ()
local pivot = make_series ()
reverse_range = reference * percentage / 100
if get_value (is_direction_up) then
htrack:set (max(high, nz(htrack[1], high)))
if close < htrack[1] - reverse_range then
pivot:set (htrack)
is_direction_up:set (false)
reference:set(htrack)
end
else
ltrack:set (min(low, nz(ltrack[1], low)))
if close > ltrack[1] + reverse_range then
pivot:set (ltrack)
is_direction_up:set(true)
reference:set (ltrack)
end
end
color = is_direction_up() and up_color or down_color
plot(pivot, 'ZZ', color, width, -1, style.points, na_mode.continue)
instrument { name = "Zigzaig POINT 1 ", overlay = true }
percentage = input (1, "Percentage", input.double, 0.01, 100, 1.0) / 100
period = 3
input_group {
"front.ind.dpo.generalline",
up_color = input { default = "#1a75ff", type = input.color },
down_color = input { default = "#ff0008", type = input.color },
width = input { default = 3, type = input.line }
}
local reference = make_series ()
reference:set(nz(reference[1], high))
local is_direction_up = make_series ()
is_direction_up:set(nz(is_direction_up[1], true))
local htrack = make_series ()
local ltrack = make_series ()
local pivot = make_series ()
reverse_range = reference * percentage / 100
if get_value (is_direction_up) then
htrack:set (max(high, nz(htrack[1], high)))
if close < htrack[1] - reverse_range then
pivot:set (htrack)
is_direction_up:set (false)
reference:set(htrack)
end
else
ltrack:set (min(low, nz(ltrack[1], low)))
if close > ltrack[1] + reverse_range then
pivot:set (ltrack)
is_direction_up:set(true)
reference:set (ltrack)
end
end
color = is_direction_up() and up_color or down_color
plot(pivot, 'ZZ', color, width, -1, style.points, na_mode.continue)
instrument { name = "ZigZag", overlay = true }
percentage = input (1, "Percentage", input.double, 0.01, 100, 1.0) / 100
period = 3
input_group {
"front.ind.dpo.generalline",
up_color = input { default = "#FF7700", type = input.color },
down_color = input { default = "#57A1D0", type = input.color },
width = input { default = 1, type = input.line_width }
}
local reference = make_series ()
reference:set(nz(reference[1], high))
local is_direction_up = make_series ()
is_direction_up:set(nz(is_direction_up[1], true))
local htrack = make_series ()
local ltrack = make_series ()
local pivot = make_series ()
reverse_range = reference * percentage / 100
if get_value (is_direction_up) then
htrack:set (max(high, nz(htrack[1], high)))
if close < htrack[1] - reverse_range then
pivot:set (htrack)
is_direction_up:set (false)
reference:set(htrack)
plot_shape(htrack, "sell",shape_style.arrowdown,
shape_size.large,"Red",shape_location.abovebar, 0, "SELL", "Red")
end
else
ltrack:set (min(low, nz(ltrack[1], low)))
if close > ltrack[1] + reverse_range then
pivot:set (ltrack)
is_direction_up:set(true)
reference:set (ltrack)
plot_shape(ltrack, "Buy",shape_style.arrowup,
shape_size.large,"Lime",shape_location.belowbar, 0, "BUY", "Lime")
end
end
color = is_direction_up() and up_color or down_color
plot(pivot, 'ZZ', color, width, -1, style.solid_line, na_mode.continue)
sell = close < htrack[1] - reverse_range
Buy = close > ltrack[1] + reverse_range
instrument { name = "RONIN TAMPLET BUY SELL VER.9",
short_name = 'RONIN_TRADER',
icon = "https://img5.pic.in.th/file/secure-sv1/3335b64f0d0e326fd6d.png",
overlay = true
}
percentage = input (1, "Percentage", input.double, 0.01, 100, 1.0) / 100
period = 3
input_group {
"front.ind.dpo.generalline",
up_color = input { default = "White", type = input.color },
down_color = input { default = "White", type = input.color },
width = input { default = 1, type = input.line }
}
local reference = make_series ()
reference:set(nz(reference[1], high))
local is_direction_up = make_series ()
is_direction_up:set(nz(is_direction_up[1], true))
local htrack = make_series ()
local ltrack = make_series ()
local pivot = make_series ()
reverse_range = reference * percentage / 100
if get_value (is_direction_up) then
htrack:set (max(high, nz(htrack[1], high)))
if close < htrack[1] - reverse_range then
pivot:set (htrack)
is_direction_up:set (false)
reference:set(htrack)
end
else
ltrack:set (min(low, nz(ltrack[1], low)))
if close > ltrack[1] + reverse_range then
pivot:set (ltrack)
is_direction_up:set(true)
reference:set (ltrack)
end
end
color = is_direction_up() and up_color or down_color
plot(pivot, 'ZZ', color, width, -1, style.points, na_mode.continue)