instrument {
overlay = true,
name = '@TRADER_CUNHA',
short_name = 'TRADER CUNHA',
icon = "indicators:ADX"
}
input_group {
"OTC - UP COLOR",
call_color = input { default = "#00FF00", type = [Link] } -- VERDE para CALL
}
input_group {
"OTC - DOWN COLOR",
put_color = input { default = "#FF0000", type = [Link] } -- VERMELHO para
PUT
}
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,
"CUNHA COMPRA",
"#00FF00"
)
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,
"CUNHA VENDA",
"#FF0000"
)
end
end
instrument { name = "U.S.A STRATEGY", overlay = true, icon = "indicators:ATR" }
period = input (18, "Perodo", [Link], 1)
multiplier = input (2, "Multiplicador", [Link], 1)
high_low = input (false, "Alta/Baixa", [Link])
input_group {
"Cores",
up = input { default = "#FFFFFF", type = [Link] }, -- Branco para tendncia
de alta
down = input { default = "#FFFFFF", type = [Link] }, -- Branco para tendncia
de baixa
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])
]]