instrument {overlay = true,
name = 'SUPER SCRIPT',
short_name = 'SUPER SCRIPT',
icon="indicators:ADX"}
input_group { "OTC - UP COLOR", call_color = input { default="#17f702", type =
[Link] } }
input_group { "OTC - DOWN COLOR", put_color = input { default="#fc0303", type =
[Link] } }
if ((close > close[2]) and (close[2] > open[2]) and (close[4] > close[8])) then
plot_shape(1,
'Bull_OTC',
shape_style.triangleup,
shape_size.huge,
call_color,
shape_location.belowbar,
0,
"ARRIBA",
"#fcfc03"
)
else
if ((close < close[2]) and (close[2] < open[2]) and (close[4] < close[8])) then
plot_shape(1,
'Bear_OTC',
shape_style.triangledown,
shape_size.huge,
put_color,
shape_location.abovebar,
0,
"ABAJO",
"#fcfc03"
)
end
end
instrument { name = "SUPER SCRIPT", overlay = true, icon="indicators:ATR" }
period = input (18, "[Link]", [Link], 1 )
multiplier = input (2, "[Link]", [Link], 1 )
high_low = input (false, "HighLow", [Link])
input_group {
"[Link]",
up = input { default = "#1cfc03", type = [Link] },
down = input { default = "#fc0303", type = [Link] },
width = input { default = 4, type = input.line_width }
}
atr = rma (tr, period) * multiplier
h = iff (high_low, high, close)
l = iff (high_low, low, close)
atr_ts = iff(close > nz(atr_ts[1], 0) and close[1] > nz(atr_ts[1], 0),
max(nz(atr_ts[1]), h - atr),
iff(close < nz(atr_ts[1], 0) and close[1] < nz(atr_ts[1], 0), min(nz(atr_ts[1]), l
+ atr),
iff(close > nz(atr_ts[1], 0), h - atr, l + atr)))
pos = iff(close[1] < nz(atr_ts[1], 0) and close > nz(atr_ts[1], 0), 1,
iff(close[1] > nz(atr_ts[1], 0) and close < nz(atr_ts[1], 0), -1, nz(pos[1], 0)))
plot (atr_ts, "", pos < 0 and down or up , width)
--[[
short = (pos[1] != pos[0]) and (pos[0] == -1) ? true : false
long = (pos[1] != pos[0]) and (pos[0] == 1) ? true : false
plotshape(long, style=[Link], location=[Link], color=green,
size=[Link])
plotshape(short, style=[Link], location=[Link], color=red,
size=[Link])
]]